本文整理汇总了C#中XBase.Data.DBHelper.TransactionManager.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# TransactionManager.Commit方法的具体用法?C# TransactionManager.Commit怎么用?C# TransactionManager.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XBase.Data.DBHelper.TransactionManager
的用法示例。
在下文中一共展示了TransactionManager.Commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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 [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;
}
示例4: 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] ";
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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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);
InsertSellOfferDetail(sellOfferModel, SellOrderDetailModelList, tran);
InsertSellOfferHistory(sellOfferModel, sellOfferHistoryModelList, tran);
tran.Commit();
isSucc = true;
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
isSucc = false;
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
isSucc = false;
strMsg = "该编号已被使用,请输入未使用的编号!";
}
return isSucc;
}
示例14: Save
/// <summary>
/// 保存销售计划
/// </summary>
/// <returns></returns>
public static bool Save(Hashtable ht,SellPlanModel sellPlanModel, SellPlanDetailModel sellPlanDetailModel, out string strMsg)
{
bool isSucc = false;//是否添加成功
strMsg = "";
//判断计划编号是否存在
if (NoIsExist(sellPlanModel.PlanNo))
{
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
InsertOrder(sellPlanModel, tran);
#region 拓展属性
GetExtAttrCmd(sellPlanModel, ht, tran);
#endregion
if (sellPlanDetailModel.PlanNo != null)
{
InsertOrderDetail(sellPlanDetailModel, tran);
}
tran.Commit();
isSucc = true;
strMsg = "保存成功!";
}
catch (Exception ex)
{
tran.Rollback();
strMsg = "保存失败,请联系系统管理员!";
throw ex;
}
}
else
{
isSucc = false;
strMsg = "该编号已被使用,请输入未被使用的编号!";
}
return isSucc;
}
示例15: InsertOrder
/// <summary>
/// 添加单据
/// </summary>
/// <param name="sellChanceModel">销售机会表实体</param>
/// <param name="sellChancePushModel">销售阶段表实体</param>
/// <returns>是否添加成功</returns>
public static bool InsertOrder(AdversaryInfoModel adversaryInfoModel, List<AdversaryDynamicModel> adversaryDynamicModelList)
{
bool isSucc = false;//是否添加成功
TransactionManager tran = new TransactionManager();
tran.BeginTransaction();
try
{
InsertAdversaryInfo( adversaryInfoModel, tran);
InsertAdversaryDynamic(adversaryDynamicModelList, tran);
tran.Commit();
isSucc = true;
}
catch(Exception ex)
{
tran.Rollback();
isSucc = false;
throw ex;
}
return isSucc;
}