當前位置: 首頁>>代碼示例>>C#>>正文


C# TransactionManager.Commit方法代碼示例

本文整理匯總了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;
 }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:35,代碼來源:SellChannelSttlDBHelper.cs

示例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;
 }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:39,代碼來源:ExpensesDBHelper.cs

示例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;
        }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:38,代碼來源:SellChannelSttlDBHelper.cs

示例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;
        }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:33,代碼來源:DefFormDBHelper.cs

示例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;
 }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:38,代碼來源:ReimbursementDBHelper.cs

示例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;
        }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:27,代碼來源:SubBudgetDBHelper.cs

示例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;
 }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:26,代碼來源:SubBudgetDBHelper.cs

示例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;
 }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:31,代碼來源:UserProjectInfoDBHelper.cs

示例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;
 }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:33,代碼來源:DefFormDBHelper.cs

示例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;
        }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:62,代碼來源:BatchNoRuleSetDBHelper.cs

示例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;
        }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:49,代碼來源:SellChanceDBHelper.cs

示例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;
 }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:44,代碼來源:VoucherTemaplateDBHelper.cs

示例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;

        }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:45,代碼來源:SellOfferDBHelper.cs

示例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;
        }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:43,代碼來源:SellPlanDBHelper.cs

示例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;
        }
開發者ID:kosmos-zhang,項目名稱:erp-aspnet,代碼行數:29,代碼來源:AdversaryInfoDBHelper.cs


注:本文中的XBase.Data.DBHelper.TransactionManager.Commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。