本文整理汇总了C#中XBase.Data.DBHelper.TransactionManager类的典型用法代码示例。如果您正苦于以下问题:C# TransactionManager类的具体用法?C# TransactionManager怎么用?C# TransactionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionManager类属于XBase.Data.DBHelper命名空间,在下文中一共展示了TransactionManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddTable
/// <summary>
/// 添加自定义表单
/// </summary>
/// <returns></returns>
public static int AddTable(CustomTableModel model, List<StructTable> sonModel, out string strMsg)
{
int TableID = 0;
strMsg = "";
//判断单据编号是否存在
if (!Exists(model.CompanyCD, model.CustomTableName))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
TableID = AddCustomTable(model, tran);
AddStructTable(sonModel, TableID, tran);
tran.Commit();
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
strMsg = "该表名已被使用,请输入未使用的表名!";
}
return TableID;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:33,代码来源:DefFormDBHelper.cs
示例2: Add
public static int Add(XBase.Model.Office.SellReport.UserProductInfo model)
{
int num = 0;
string sqlstr = "insert into officedba.UserProductInfo(CompanyCD,productNum,productName,price,bref,memo) values(@CompanyCD,@productNum,@productName,@price,@bref,@memo)";
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
SqlParameter[] param = {
new SqlParameter("@CompanyCD",SqlDbType.VarChar,50),
new SqlParameter("@productNum",SqlDbType.VarChar,50),
new SqlParameter("@productName",SqlDbType.VarChar,200),
new SqlParameter("@price",SqlDbType.Decimal),
new SqlParameter("@bref",SqlDbType.VarChar,500),
new SqlParameter("@memo",SqlDbType.VarChar,1000)
};
param[0].Value = model.CompanyCD;
param[1].Value = model.productNum;
param[2].Value = model.productName;
param[3].Value = model.price;
param[4].Value = model.bref;
param[5].Value = model.memo;
try
{
num = SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlstr, param);
tran.Commit();
}
catch
{
tran.Rollback();
}
return num;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:31,代码来源:UserProjectInfoDBHelper.cs
示例3: SaveExpensesApply
/// <summary>
/// 添加费用申请单
/// </summary>
/// <param name="expApplyModel"></param>
/// <param name="expDetailModelList"></param>
/// <param name="strMsg"></param>
/// <returns></returns>
public static bool SaveExpensesApply(ExpensesApplyModel expApplyModel, List<ExpDetailsModel> expDetailModelList,out string strMsg)
{
bool isSucc = false;//是否添加成功
strMsg = "";
//判断单据编号是否存在
if (NoIsExist(expApplyModel.ExpCode,expApplyModel.CompanyCD))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
int expID;
expID = InsertExpensesApply(expApplyModel, tran);
InsertExpensesDetails(expDetailModelList, expID,tran);
tran.Commit();
isSucc = true;
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
isSucc = false;
strMsg = "该编号已被使用,请输入未使用的编号!";
}
return isSucc;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:39,代码来源:ExpensesDBHelper.cs
示例4: UpdateOrder
/// <summary>
/// 更新销售委托代销单
/// </summary>
/// <returns></returns>
public static bool UpdateOrder(Hashtable ht, SellChannelSttlModel sellChannelSttlModel, List<SellChannelSttlDetailModel> sellChannelSttlDetailModellist, out string strMsg)
{
bool isSucc = false;//是否添加成功
strMsg = "";
if (IsUpdate(sellChannelSttlModel.SttlNo))
{
string strSql = "delete from officedba.SellChannelSttlDetail where [email protected] and Com[email protected]";
SqlParameter[] paras = { new SqlParameter("@SttlNo", sellChannelSttlModel.SttlNo), new SqlParameter("@CompanyCD", sellChannelSttlModel.CompanyCD) };
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
UpdateOrderInfo(ht,sellChannelSttlModel, tran);
SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, strSql.ToString(), paras);
InsertOrderDetail(sellChannelSttlDetailModellist, tran);
tran.Commit();
isSucc = true;
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
isSucc = false;
strMsg = "非制单状态的未提交审批、审批未通过或撤销审批单据不可修改!";
}
return isSucc;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:38,代码来源:SellChannelSttlDBHelper.cs
示例5: InsertSellReport
/// <summary>
/// 销售汇报 插入主表信息
/// </summary>
/// <param name="sellrptModel"></param>
/// <param name="tran"></param>
private static int InsertSellReport(SellReportModel sellrptModel, TransactionManager tran)
{
StringBuilder strSql = new StringBuilder();
strSql.AppendLine("insert into officedba.SellReport(");
strSql.AppendLine("CompanyCD,SellDept,productID,productName,price,sellNum,sellPrice,createdate,memo)");
strSql.AppendLine(" values (");
strSql.AppendLine("@CompanyCD,@SellDept,@productID,@productName,@price,@sellNum,@sellPrice,@createdate,@memo)");
strSql.AppendLine(";set @[email protected]@IDENTITY");
SqlParameter[] param = {
new SqlParameter("@CompanyCD",sellrptModel.CompanyCD),
new SqlParameter("@SellDept",sellrptModel.SellDept),
new SqlParameter("@productID",sellrptModel.ProductID),
new SqlParameter("@productName",sellrptModel.ProductName),
new SqlParameter("@price",sellrptModel.Price),
new SqlParameter("@sellNum",sellrptModel.SellNum),
new SqlParameter("@sellPrice",sellrptModel.SellPrice),
new SqlParameter("@createdate",sellrptModel.CreateDate),
new SqlParameter("@memo",sellrptModel.Memo),
new SqlParameter("@Id",SqlDbType.Int,6)
};
param[9].Direction = ParameterDirection.Output;
foreach (SqlParameter para in param)
{
if (para.Value == null)
{
para.Value = DBNull.Value;
}
}
SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, strSql.ToString(), param);
int Id = Convert.ToInt32(param[9].Value);
return Id;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:39,代码来源:SellProductReportDBHepler.cs
示例6: SaveOrder
/// <summary>
/// 保存销售委托代销单
/// </summary>
/// <returns></returns>
public static bool SaveOrder(Hashtable ht, SellChannelSttlModel sellChannelSttlModel, List<SellChannelSttlDetailModel> sellChannelSttlDetailModellist, out string strMsg)
{
bool isSucc = false;//是否添加成功
strMsg = "";
//判断单据编号是否存在
if (NoIsExist(sellChannelSttlModel.SttlNo))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
InsertOrderInfo(ht,sellChannelSttlModel, tran);
InsertOrderDetail(sellChannelSttlDetailModellist, tran);
tran.Commit();
isSucc = true;
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
isSucc = false;
strMsg = "该编号已被使用,请输入未使用的编号!";
}
return isSucc;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:35,代码来源:SellChannelSttlDBHelper.cs
示例7: SaveReimbursement
/// <summary>
/// 保存费用报销单
/// </summary>
/// <param name="reimbModel"></param>
/// <param name="reimbDetailList"></param>
/// <param name="strMsg"></param>
public static bool SaveReimbursement(ReimbursementModel reimbModel, List<ReimbDetailsModel> reimbDetailList, out string strMsg)
{
bool isSucc = false;//是否添加成功
strMsg = "";
//判断单据编号是否存在
if (NoIsExist(reimbModel.ReimbNo, reimbModel.CompanyCD))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
int reimbID;
reimbID = InsertReimbursement(reimbModel, tran);
InsertReimbDetails(reimbDetailList, reimbID, tran);
tran.Commit();
isSucc = true;
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
isSucc = false;
strMsg = "该编号已被使用,请输入未使用的编号!";
}
return isSucc;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:38,代码来源:ReimbursementDBHelper.cs
示例8: EditTable
/// <summary>
/// 修改自定义表单
/// </summary>
/// <param name="model"></param>
/// <param name="sonModel"></param>
/// <param name="strMsg"></param>
/// <returns></returns>
public static bool EditTable(CustomTableModel model, List<StructTable> sonModel, out string strMsg)
{
bool isSucc = false;//是否添加成功
strMsg = "";
string strSql = "delete from defdba.StructTable where [email protected]bleID ";
SqlParameter[] paras = { new SqlParameter("@TableID", model.ID) };
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
EidtCustomTable(model, tran);
SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, strSql.ToString(), paras);
AddStructTable(sonModel, Convert.ToInt32(model.ID), tran);
tran.Commit();
isSucc = true;
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
return isSucc;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:33,代码来源:DefFormDBHelper.cs
示例9: Update
public static int Update(XBase.Model.Office.SellReport.UserProductInfo model)
{
int num = 0;
string sqlstr = "update officedba.UserProductInfo set [email protected],[email protected],[email protected],[email protected],[email protected] where [email protected]";
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
SqlParameter[] param = {
new SqlParameter("@CompanyCD",SqlDbType.VarChar,50),
new SqlParameter("@productNum",SqlDbType.VarChar,50),
new SqlParameter("@productName",SqlDbType.VarChar,200),
new SqlParameter("@price",SqlDbType.Decimal),
new SqlParameter("@bref",SqlDbType.VarChar,500),
new SqlParameter("@memo",SqlDbType.VarChar,1000),
new SqlParameter("@id",SqlDbType.Int,4)
};
param[0].Value = model.CompanyCD;
param[1].Value = model.productNum;
param[2].Value = model.productName;
param[3].Value = model.price;
param[4].Value = model.bref;
param[5].Value = model.memo;
param[6].Value = model.id;
try
{
num = SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlstr, param);
tran.Commit();
}
catch
{
tran.Rollback();
}
return num;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:33,代码来源:UserProjectInfoDBHelper.cs
示例10: AddSubBudgetInfo
public static int AddSubBudgetInfo(SubBudgetModel subBudgetModel, XBase.Common.UserInfoUtil userinfo)
{
StringBuilder sqlstr = new StringBuilder();
sqlstr.Append("insert into officedba.SubBudget(CompanyCD,projectid,BudgetName) values(@CompanyCD,@projectid,@BudgetName)");
SqlParameter[] param = {
new SqlParameter("@CompanyCD",SqlDbType.VarChar,50),
new SqlParameter("@projectid",SqlDbType.Int),
new SqlParameter("@BudgetName",SqlDbType.VarChar,200)
};
param[0].Value = userinfo.CompanyCD;
param[1].Value = subBudgetModel.Projectid;
param[2].Value = subBudgetModel.BudgetName;
TransactionManager tran = new TransactionManager();
int num = 0;
tran.BeginTransaction();
try
{
num = SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlstr.ToString(), param);
tran.Commit();
}
catch
{
tran.Rollback();
}
return num;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:27,代码来源:SubBudgetDBHelper.cs
示例11: EditSubBudget
public static int EditSubBudget(SubBudgetModel subBudgetModel, XBase.Common.UserInfoUtil userinfo)
{
StringBuilder sqlstr = new StringBuilder();
sqlstr.Append("update officedba.SubBudget set [email protected],[email protected] where [email protected]");
SqlParameter[] param = {
new SqlParameter("@BudgetName",SqlDbType.VarChar,200),
new SqlParameter("@projectid",SqlDbType.Int,4),
new SqlParameter("@ID",SqlDbType.Int)
};
param[0].Value = subBudgetModel.BudgetName;
param[1].Value = subBudgetModel.Projectid;
param[2].Value = subBudgetModel.ID;
TransactionManager tran = new TransactionManager();
int num = 0;
tran.BeginTransaction();
try
{
num = SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlstr.ToString(), param);
tran.Commit();
}
catch
{
tran.Rollback();
}
return num;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:26,代码来源:SubBudgetDBHelper.cs
示例12: SaveBatchRule
/// <summary>
/// 保存批次规则设置
/// </summary>
/// <param name="model">BachNoRuleSet实体</param>
/// <param name="strMsg">返回信息</param>
/// <returns>规则ID</returns>
public static int SaveBatchRule(BatchNoRuleSet model, out string strMsg)
{
int ruleID = 0;
strMsg = "";
StringBuilder strSql = new StringBuilder();
if (!IsExisted(model.CompanyCD))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
strSql.AppendLine(" insert into officedba.BatchRule ");
strSql.AppendLine(" (CompanyCD,RuleName,RulePrefix,RuleDateType,RuleNoLen,LastNo,RuleExample,");
strSql.AppendLine(" Remark,IsDefault,UsedStatus,ModifiedDate,ModifiedUserID) values");
strSql.AppendLine(" (@CompanyCD,@RuleName,@RulePrefix,@RuleDateType,@RuleNoLen,@LastNo,@RuleExample,");
strSql.AppendLine(" @Remark,@IsDefault,@UsedStatus,getdate(),@ModifiedUserID)");
strSql.AppendLine(" ;select @@IDENTITY ");
SqlParameter[] param = {
new SqlParameter("@CompanyCD",model.CompanyCD),
new SqlParameter("@RuleName",model.RuleName),
new SqlParameter("@RulePrefix",model.RulePrefix),
new SqlParameter("@RuleDateType",model.RuleDateType),
new SqlParameter("@RuleNoLen",model.RuleNoLen),
new SqlParameter("@LastNo",model.LastNo),
new SqlParameter("@RuleExample",model.RuleExample),
new SqlParameter("@Remark",model.Remark),
new SqlParameter("@IsDefault",model.IsDefault),
new SqlParameter("@UsedStatus",model.UsedStatus),
new SqlParameter("@ModifiedUserID",model.ModifiedUserID)
};
foreach (SqlParameter para in param)
{
if (para.Value == null)
{
para.Value = DBNull.Value;
}
}
ruleID = Convert.ToInt32(SqlHelper.ExecuteScalar(strSql.ToString(), param));
tran.Commit();
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
strMsg = "保存失败,已存在批次规则!";
}
return ruleID;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:62,代码来源:BatchNoRuleSetDBHelper.cs
示例13: InsertExpensesApply
/// <summary>
/// 插入费用申请主表信息
/// </summary>
/// <param name="expApplyModel"></param>
/// <param name="tran"></param>
public static int InsertExpensesApply(ExpensesApplyModel expApplyModel, TransactionManager tran)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into officedba.FeeApply (");
strSql.Append(" CompanyCD,ExpCode,Title,Applyor,AriseDate,NeedDate,TotalAmount,PayType,CanViewUser,");
strSql.Append(" Reason,DeptID,TransactorID,Status,Creator,CreateDate,ExpType,CustID,SellChanceNo,IsReimburse,");
strSql.Append(" ModifiedUserID,ModifiedDate,Confirmor,ConfirmDate,ProjectID,Attachment,EndReimbTime)");
strSql.Append(" values (@CompanyCD,@ExpCode,@Title,@Applyor,@AriseDate,@NeedDate,@TotalAmount,@PayType,@CanViewUser,");
strSql.Append(" @Reason,@DeptID,@TransactorID,@Status,@Creator,@CreateDate,");
strSql.Append(" @ExpType,@CustID,@SellChanceNo,@IsReimburse,@ModifiedUserID,@ModifiedDate,@Confirmor,@ConfirmDate,");
strSql.Append(" @ProjectID,@Attachment,@EndReimbTime); set @[email protected]@IDENTITY");
#region 参数
SqlParameter[] param={
new SqlParameter ("@CompanyCD",expApplyModel.CompanyCD ),
new SqlParameter ("@ExpCode",expApplyModel.ExpCode ),
new SqlParameter("@Title",expApplyModel.Title ),
new SqlParameter("@Applyor",expApplyModel.Applyor ),
new SqlParameter("@AriseDate",expApplyModel.AriseDate ),
new SqlParameter("@NeedDate",expApplyModel.NeedDate ),
new SqlParameter("@TotalAmount",expApplyModel.TotalAmount ),
new SqlParameter("@PayType",expApplyModel.PayType ),
new SqlParameter("@Reason",expApplyModel.Reason ),
new SqlParameter("@DeptID",expApplyModel.DeptID ),
new SqlParameter("@TransactorID",expApplyModel.TransactorID ),
new SqlParameter("@Status",expApplyModel.Status ),
new SqlParameter("@Creator",expApplyModel.Creator ),
new SqlParameter("@CreateDate",expApplyModel.CreateDate ),
new SqlParameter("@ExpType",expApplyModel.ExpType ),
new SqlParameter("@CustID",expApplyModel.CustID ),
new SqlParameter("@SellChanceNo",expApplyModel.SellChanceNo ),
new SqlParameter("@IsReimburse",expApplyModel.IsReimburse ),
new SqlParameter("@ModifiedUserID",expApplyModel.ModifiedUserID ),
new SqlParameter("@ModifiedDate",expApplyModel.ModifiedDate ),
new SqlParameter("@Confirmor",DBNull.Value ),
new SqlParameter("@ConfirmDate",DBNull.Value),
new SqlParameter("@Id",SqlDbType.Int,6),
new SqlParameter("@CanViewUser",expApplyModel.CanViewUser),
new SqlParameter("@ProjectID",expApplyModel.ProjectID),
new SqlParameter("@Attachment",expApplyModel.Attachment),
new SqlParameter("@EndReimbTime",expApplyModel.EndReimbTime)
};
param[22].Direction=ParameterDirection.Output;
foreach (SqlParameter para in param)
{
//if (para.Value == null)
if (para.Value == null || para.Value.ToString() == "-1")
{
para.Value = DBNull.Value;
}
}
//SqlHelper.ExecuteSql(strSql.ToString(), param);
SqlHelper.ExecuteTransSql(strSql.ToString(), param);
int Id =Convert.ToInt32(param[22].Value);
return Id;
#endregion
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:61,代码来源:ExpensesDBHelper.cs
示例14: InsertReimbursement
/// <summary>
/// 费用报销单主表数据插入
/// </summary>
/// <param name="reimbModel">费用报销单主表实体</param>
/// <param name="tran">事务</param>
/// <returns>主表插入后返回的ID</returns>
public static int InsertReimbursement(ReimbursementModel reimbModel, TransactionManager tran)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into officedba.FeeReturn (");
strSql.Append(" CompanyCD,ReimbNo,Title,FromType,Applyor,ReimbDate,ReimbDeptID,UserReimbID,CanViewUser,");
strSql.Append(" ExpAllAmount,ReimbAllAmount,RestoreAllAmount,Status,Creator,CreateDate,Remark,");
strSql.Append(" ModifiedUserID,ModifiedDate,Confirmor,ConfirmDate,ProjectID,SubjectsNo,CustID,ContactsUnitID,FromTBName,ContactsUnitName,Attachment)");
strSql.Append(" values (@CompanyCD,@ReimbNo,@Title,@FromType,@Applyor,@ReimbDate,@ReimbDeptID,@UserReimbID,@CanViewUser,");
strSql.Append(" @ExpAllAmount,@ReimbAllAmount,@RestoreAllAmount,@Status,@Creator,@CreateDate,");
strSql.Append(" @Remark,@ModifiedUserID,@ModifiedDate,@Confirmor,@ConfirmDate,@ProjectID,@SubjectsNo,@CustID,");
strSql.Append(" @ContactsUnitID,@FromTBName,@ContactsUnitName,@Attachment); set @[email protected]@IDENTITY");
SqlParameter[] param ={
new SqlParameter("@CompanyCD",reimbModel.CompanyCD ),
new SqlParameter("@ReimbNo",reimbModel.ReimbNo ),
new SqlParameter("@Title",reimbModel.Title ),
new SqlParameter("@FromType",reimbModel.FromType),
new SqlParameter("@Applyor",reimbModel.Applyor ),
new SqlParameter("@ReimbDate",reimbModel.ReimbDate ),
new SqlParameter("@ReimbDeptID",reimbModel.ReimbDeptID ),
new SqlParameter("@UserReimbID",reimbModel.UserReimbID ),
new SqlParameter("@ExpAllAmount",reimbModel.ExpAllAmount ),
new SqlParameter("@ReimbAllAmount",reimbModel.ReimbAllAmount ),
new SqlParameter("@RestoreAllAmount",reimbModel.RestoreAllAmount ),
new SqlParameter("@Status",reimbModel.Status ),
new SqlParameter("@Creator",reimbModel.Creator ),
new SqlParameter("@CreateDate",reimbModel.CreateDate ),
new SqlParameter("@Remark",reimbModel.Remark ),
new SqlParameter("@ModifiedUserID",reimbModel.ModifiedUserID ),
new SqlParameter("@ModifiedDate",reimbModel.ModifiedDate ),
new SqlParameter("@Confirmor",DBNull.Value ),
new SqlParameter("@ConfirmDate",DBNull.Value),
new SqlParameter("@Id",SqlDbType.Int,6),
new SqlParameter("@CanViewUser",reimbModel.CanViewUser),
new SqlParameter("@ProjectID",reimbModel.ProjectID),
new SqlParameter("@SubjectsNo",reimbModel.SubjectsNo),
new SqlParameter("@CustID",reimbModel.CustID),
new SqlParameter("@ContactsUnitID",reimbModel.ContactsUnitID),
new SqlParameter("@FromTBName",reimbModel.FromTBName),
new SqlParameter("@ContactsUnitName",reimbModel.ContactsUnitName),
new SqlParameter("@Attachment",reimbModel.Attachment)
};
param[19].Direction = ParameterDirection.Output;
foreach (SqlParameter para in param)
{
if (para.Value == null || para.Value.ToString() == "-1")
{
para.Value = DBNull.Value;
}
}
SqlHelper.ExecuteTransSql(strSql.ToString(), param);
int Id = Convert.ToInt32(param[19].Value);
return Id;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:60,代码来源:ReimbursementDBHelper.cs
示例15: Update
/// <summary>
/// 更新销售计划
/// </summary>
/// <returns></returns>
public static bool Update(Hashtable ht,SellPlanModel sellPlanModel, SellPlanDetailModel sellPlanDetailModel, string strDetailAction, out string strMsg)
{
bool isSucc = false;//是否添加成功
strMsg = "";
if (IsUpdate(sellPlanModel.PlanNo))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
UpdateOrder(sellPlanModel, tran);
#region 拓展属性
GetExtAttrCmd(sellPlanModel, ht, tran);
#endregion
//明细操作的类型
switch (strDetailAction)
{
case "1"://无操作
break;
case "2"://添加新明细
InsertOrderDetail(sellPlanDetailModel, tran);
break;
case "3"://更新明细
UpdateOrderDetail(sellPlanDetailModel, tran);
break;
case "4"://删除明细
DelOrderDetail(sellPlanDetailModel, tran);
break;
default:
break;
}
tran.Commit();
strMsg = "保存成功!";
isSucc = true;
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
isSucc = false;
strMsg = "非制单状态的未提交审批、审批未通过或撤销审批计划不可修改!";
}
return isSucc;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:58,代码来源:SellPlanDBHelper.cs
示例16: SaveTableModel
/// <summary>
/// 保存模板
/// </summary>
/// <param name="tbModel">ModuleTableModel模板实体</param>
/// <param name="strMsg"></param>
public static int SaveTableModel(ModuleTableModel tbModel, out string strMsg)
{
StringBuilder strSql = new StringBuilder();
strMsg = "";
int tbID = 0;
if (!IsRepeatedModule(tbModel.TableID, "0"))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
strSql.AppendLine(" insert into defdba.ModuleTable (CompanyCD,ModuleContent,TableID,ModuleType,UseStatus)");
strSql.AppendLine(" values(@CompanyCD,@ModuleContent,@TableID,@ModuleType,@UseStatus)");
strSql.AppendLine(" ;select @@IDENTITY ");
SqlParameter[] param = {
new SqlParameter("@CompanyCD",tbModel.CompanyCD ),
new SqlParameter("@ModuleContent",tbModel.ModuleContent ),
new SqlParameter("@TableID",tbModel.TableID ),
new SqlParameter("@ModuleType",tbModel.ModuleType ),
new SqlParameter("@UseStatus",tbModel.UseStatus )
};
foreach (SqlParameter para in param)
{
if (para.Value == null)
{
para.Value = DBNull.Value;
}
}
tbID = Convert.ToInt32(SqlHelper.ExecuteScalar(strSql.ToString(), param));
tran.Commit();
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
strMsg = "保存失败,该表的模板已定义!";
}
return tbID;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:51,代码来源:CreateTableViewModelDBHelper.cs
示例17: InsertSellChance
/// <summary>
/// 添加销售机会及阶段
/// </summary>
/// <param name="sellChanceModel">销售机会表实体</param>
/// <param name="sellChancePushModel">销售阶段表实体</param>
/// <returns>是否添加成功</returns>
public static bool InsertSellChance(Hashtable ht,SellChanceModel sellChanceModel, SellChancePushModel sellChancePushModel)
{
bool isSucc = false;//是否添加成功
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
int sellChID = InsertChanece(tran, sellChanceModel);
//若是设置了手机提醒 则插入以下信息
if (sellChanceModel.IsMobileNotice == "1")
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into officedba.NoticeHistory(");
strSql.Append(" CompanyCD,SourceFlag,SourceID,PlanNoticeDate ) ");
strSql.Append(" values(@CompanyCD, @SourceFlag,@SourceID,@PlanNoticeDate ) ");
SqlParameter[] param = {
new SqlParameter("@CompanyCD",sellChanceModel.CompanyCD),
new SqlParameter("@SourceFlag","4"),
new SqlParameter("@SourceID",sellChID),
new SqlParameter("@PlanNoticeDate",sellChanceModel.RemindTime)
};
SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, strSql.ToString(), param);//.ExecuteTransWithCommand(commN);
}
//拓展属性
GetExtAttrCmd(sellChanceModel,ht, tran);
InsertPush(tran, sellChancePushModel);
tran.Commit();
isSucc = true;
}
catch (Exception ex)
{
tran.Rollback();
isSucc = false;
throw ex;
}
return isSucc;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:49,代码来源:SellChanceDBHelper.cs
示例18: Insert
/// <summary>
/// 添加新单据
/// </summary>
/// <returns></returns>
public static bool Insert(VoucherTemplateModel voucherTemplateModel, List<VoucherTemplateDetailModel> voucherTemplateDetailModelList, out string strMsg, out int Id)
{
bool isSucc = false;//是否添加成功
strMsg = "";
Id = 0;
//判断单据编号是否存在
if (NoIsExist(voucherTemplateModel.TemNo))
{
if (IsTypeUsed(voucherTemplateModel.TemType.ToString(), voucherTemplateModel.CompanyCD))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
InsertVoucherTemplate(voucherTemplateModel, tran, out Id);
InsertVoucherTemplateDetail(voucherTemplateDetailModelList, tran);
tran.Commit();
isSucc = true;
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
isSucc = false;
strMsg = "该模板类型已存在,请选择其他未使用的模板类型!";
}
}
else
{
isSucc = false;
strMsg = "该编号已被使用,请输入未使用的编号!";
}
return isSucc;
}
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:44,代码来源:VoucherTemaplateDBHelper.cs
示例19: InsertOrder
/// <summary>
/// 添加销售报价单
/// </summary>
/// <param name="sellChanceModel">销售机会表实体</param>
/// <param name="sellChancePushModel">销售阶段表实体</param>
/// <returns>是否添加成功</returns>
public static bool InsertOrder(Hashtable ht, SellOfferModel sellOfferModel, List<SellOfferDetailModel> SellOrderDetailModelList,
List<SellOfferHistoryModel> sellOfferHistoryModelList, out string strMsg)
{
bool isSucc = false;//是否添加成功
strMsg = "";
//判断单据编号是否存在
if (NoIsExist(sellOfferModel.OfferNo))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
InsertSellOffer(sellOfferModel, tran);
//拓展属性
GetExtAttrCmd(sellOfferModel, ht, tran);
|
请发表评论