当前位置: 首页>>代码示例>>C#>>正文


C# Dbconn.BeginTransaction方法代码示例

本文整理汇总了C#中Dbconn.BeginTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# Dbconn.BeginTransaction方法的具体用法?C# Dbconn.BeginTransaction怎么用?C# Dbconn.BeginTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dbconn的用法示例。


在下文中一共展示了Dbconn.BeginTransaction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        /// <summary>
        /// 删除系统权限信息
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            Dbconn conn = new Dbconn("MDM");

            try
            {
                string strAuthorization_ID = m_request.Tables[0].Rows[0]["Authorization_ID"].ToString();
                m_request.Tables[0].Columns.Remove("Authorization_ID");

                ArrayList listTable = new ArrayList();
                listTable.Add("MDM_System_Authorization");
                listTable.Add("MDM_System_Menu_AUZ");
                conn.BeginTransaction();
                conn.TableLock(listTable);

                if (strAuthorization_ID != "")
                {
                    string strWhere = " Authorization_ID=" + strAuthorization_ID;
                    conn.Delete("MDM_System_Authorization", strWhere);
                    conn.Delete("MDM_System_Menu_AUZ", strWhere);
                }
                conn.CommitTransaction();
                return true;
            }
            catch
            {
                conn.RollbackTransaction();
                throw;
            }



        }
开发者ID:huaminglee,项目名称:Code,代码行数:37,代码来源:MDM_System_Authorization_Delete.cs

示例2: Execute

        /// <summary>
        /// 编辑系统属性信息
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            Dbconn conn = new Dbconn("MDM");

            try
            {
                string strProperty_ID = m_request.Tables[0].Rows[0]["Property_ID"].ToString();
                m_request.Tables[0].Columns.Remove("Property_ID");

                ArrayList listTable = new ArrayList();
                listTable.Add("MDM_System_Property");
                conn.BeginTransaction();
                conn.TableLock(listTable);

                if (strProperty_ID == "")
                {
                    conn.Insert("MDM_System_Property", m_request.Tables[0]);
                }
                else
                {
                    string strWhere = " Property_ID=" + strProperty_ID;
                    conn.Update("MDM_System_Property", m_request.Tables[0], strWhere);
                }
                conn.CommitTransaction();
                return true;
            }
            catch
            {
                conn.RollbackTransaction();
                throw;
            }



        }
开发者ID:huaminglee,项目名称:Code,代码行数:39,代码来源:MDM_System_Property_Edit.cs

示例3: Execute

        /// <summary>
        /// 编辑WS信息
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            Dbconn conn = new Dbconn("WSRR");

            try
            {
                if(m_request == null
                    || m_request.Tables.Count==0
                    || m_request.Tables[0].Rows.Count == 0)
                {
                    return true;
                }
                string strParam_ID = m_request.Tables[0].Rows[0]["Param_ID"].ToString();
                
                ArrayList listTable = new ArrayList();
                listTable.Add("WS_Param");
                conn.BeginTransaction();
                conn.TableLock(listTable);
                string strWhere = " Param_ID = '" + strParam_ID + "'";

                conn.Delete("WS_Param", strWhere);
                conn.CommitTransaction();
                return true;
            }
            catch
            {
                conn.RollbackTransaction();
                throw;
            }



        }
开发者ID:huaminglee,项目名称:Code,代码行数:37,代码来源:WS_Param_Delete.cs

示例4: GetData

        /// <summary>
        /// EnvoTemplates信息的CRUD
        /// </summary>
        /// <returns></returns>
        public DataSet GetData()
        {
            DataSet ds_Return = new DataSet();
            string strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
            if (strXML == "")
            {
                throw new Exception("XML不能为空");
            }

            string strTemplate_ID = m_request.Tables[0].Rows[0]["Template_ID"].ToString();
            if (strTemplate_ID == "")
            {
                throw new Exception("Template_ID不能为空");

            }

            DataSet ds = Common.Common.GetDSByExcelXML(strXML);
            DataTable dt_OPTYPE = ds.Tables["OPTYPE"];

            Dbconn conn = new Dbconn("HZY_SDK");

            if (dt_OPTYPE.Rows[0][0].ToString().ToUpper() == "INSERT")
            {

                bool bResult = true;
                DataTable dt = new DataTable();
                dt.Columns.Add("Template_ID");
                dt.Rows.Add(new object[] { strTemplate_ID });
                Commom_Ds.SetUpdateInfo(dt, hzyMessage);

                conn.BeginTransaction();

                bResult = conn.Insert("Log_ViewTemlpates", dt);
                conn.ExcuteQuerryByTran("UPDATE EnvoTemplates set ViewCount=ViewCount+1 where Template_ID=" + strTemplate_ID);

                conn.CommitTransaction();


                if (bResult)
                {
                    dt_EditResult.Rows.Add(new object[] { true, "修改成功" });
                }
                else
                {
                    dt_EditResult.Rows.Add(new object[] { false, "修改失败" });

                }
                ds_Return.Tables.Add(dt_EditResult);
            }


            return ds_Return;



        }
开发者ID:huaminglee,项目名称:Code,代码行数:60,代码来源:Log_ViewTemlpates.cs

示例5: GetData

        public DataSet GetData()
        {
            Dbconn conn = new Dbconn("WSRR");
            string strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
            DataTable dt_EditResult = new dsCommon.dtResultDataTable();
            DataSet dsRequest = new DataSet();
            DataSet ds_Return = new DataSet();
            dsRequest = Common.Common.GetDSByExcelXML(strXML);
            DataTable dt_OPTYPE = dsRequest.Tables["OPTYPE"];
            DataTable dt_LIST = dsRequest.Tables["LIST"];

            for (int i = 0; i < dt_OPTYPE.Rows.Count; i++)
            {
                //获取用户权限信息
                if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "GET")
                {
                    string strUserName = dt_LIST.Rows[0]["UserName"].ToString();
                    string strSQL = @"
                                SELECT DISTINCT
	                                   T1.[AUZID]
                                      ,T1.[AUZName]
                                      ,0 AS Authorization_ID_F
                                      , CASE WHEN T2.USERNAME IS NULL THEN '0'
                                       ELSE  '1' END  HavaFlag
                                  FROM [WSRR_Manage].[F01_CERT].[AUZ] T1 WITH ( NOLOCK )
                                  LEFT JOIN [WSRR_Manage].[F01_CERT].[UserAUZ] T2 WITH ( NOLOCK ) ON T1.AUZID=T2.AUZID
			                                AND [email protected]";
                    ds_Return = conn.GetDataSet(strSQL, new string[] { strUserName });
                }
                //更新用户权限
                else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "UPDATE")
                {
                    string strUserName = dt_LIST.Rows[0]["UserName"].ToString();
                    conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[UserAUZ]");//锁定表
                    conn.BeginTransaction();
                    //1.删除该用户的所有权限
                    string strWhere = " UserName=" + strUserName;
                    bool deleteFlag = conn.Delete("[WSRR_Manage].[F01_CERT].[UserAUZ]", strWhere);
                    //2.新增勾选的权限
                    bool insertFlag = conn.Insert("[WSRR_Manage].[F01_CERT].[UserAUZ]", dt_LIST);
                    conn.CommitTransaction();
                    //删除操作和插入操作都正确的情况下
                    if (deleteFlag && insertFlag)
                    {
                        dt_EditResult.Rows.Add(new object[] { true, strUserName + "权限更新成功!" });
                    }
                    else
                    {
                        dt_EditResult.Rows.Add(new object[] { true, strUserName + "权限更新失败!" });
                    }
                    ds_Return.Tables.Add(dt_EditResult);
                }
            }
            return ds_Return;
        }
开发者ID:huaminglee,项目名称:Code,代码行数:55,代码来源:User_Authority.cs

示例6: Execute

        public Boolean Execute()
        {
            bool bReturn = true;
            string strMessage = "";
            try
            {
                Dbconn conn_DRP_EC = new Dbconn("DRP_EC");

                string strDepotID = "";
                DataTable dt = conn_DRP_EC.GetDataTable(@"
                     SELECT [CfgValue]
                      FROM [DRP_EC].[dbo].[Config]
                      WHERE Type='StockSync_DRPToWCS'
                      AND CfgName='Depot'
                ");

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (strDepotID != "")
                    {
                        strDepotID += ",";
                    }
                    strDepotID += "'" + dt.Rows[i]["CfgValue"].ToString() + "'";
                }

                string strSQL = @"
                        SELECT  clothingid AS SKU ,
                                SUM(k_num) AS totalInventory 
                        FROM    dbo.j_stock WITH(NOLOCK)
                        WHERE   depotid in (" + strDepotID + @")
                        GROUP BY clothingid
                        HAVING SUM(k_num)>0
                ";

                DataTable dt1 = m_conn.GetDataTable(strSQL);

                conn_DRP_EC.BeginTransaction();
                conn_DRP_EC.InsertBYSQLBC("Put_SkuStock", dt1);
                conn_DRP_EC.CommitTransaction();

                return bReturn;
            }
            catch (Exception ex)
            {
                m_conn.RollbackTransaction();
                bReturn = false;
                strMessage = ex.ToString();
                throw ex;
            }
            finally
            {
                //HZY.COM.Common.Log.WirteLogWS(bReturn.ToString() + strMessage,null);
            }
        }
开发者ID:huaminglee,项目名称:Code,代码行数:54,代码来源:StockToMiddleTable.cs

示例7: GetData

        public DataSet GetData()
        {

            DataSet ds_Return = null;
            Dbconn conn = new Dbconn("WSRR_Log");
            conn.BeginTransaction();
            conn.LockTableList.Add("Log_CallByXML");
            conn.LockTableList.Add("Log_CallByXML_His");

            string time = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss.fff");

            DataSet ds = conn.GetDataSetInTrans(@"  SELECT 
                                                        *,
                                                        NULL AS ElapsedTime,
                                                        NULL AS WS_ID,
                                                        NULL AS Session_ID,
                                                        NULL AS AppSN
                                                    FROM Log_CallByXML WHERE Log_Time<'" + time + "'");
            conn.ExcuteQuerryByTran("INSERT INTO Log_CallByXML_HIS SELECT * FROM Log_CallByXML WHERE Log_Time<'" + time + "'");
            conn.CommitTransaction();

            //开始分析
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string strXML = ds.Tables[0].Rows[i]["XmlInput"].ToString();
                string strWS_ID = "";
                string strSession_ID = "";
                string strAppSN = "";
                try
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.LoadXml(strXML);
                    XmlNode xml = xmlDoc.DocumentElement;
                    strAppSN = xml.Attributes["App"].Value;
                    strWS_ID = xml.Attributes["WSID"].Value;
                    strSession_ID = xml.Attributes["SessionID"].Value;
                    xml = null;
                    xmlDoc = null;
                }
                catch (Exception)
                {

                }

                //ds.Tables[0].Rows
            }

            return ds_Return;
        }
开发者ID:huaminglee,项目名称:Code,代码行数:49,代码来源:WSRR_LogAnalysis.cs

示例8: Execute

        /// <summary>
        /// 获取系统环境信息
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            Dbconn conn = new Dbconn("MDM");

            try
            {
                string strEnv_ID = m_request.Tables[0].Rows[0]["Env_ID"].ToString();
                string strEnv_SN = m_request.Tables[0].Rows[0]["Env_SN"].ToString();
                m_request.Tables[0].Columns.Remove("Env_ID");

                ArrayList listTable = new ArrayList();
                listTable.Add("MDM_System_Env");
                conn.BeginTransaction();
                conn.TableLock(listTable);

                 //核对环境简称是否存在
                string strSQL = "SELECT 1 AS a FROM MDM_System_Env where Env_SN='" + strEnv_SN + "'";
                if(strEnv_ID != "")
                {
                    strSQL += " AND Env_ID !=" + strEnv_ID;
                }

                DataTable dtTemp = conn.GetDataTableInTrans(strSQL);
                if (dtTemp.Rows.Count > 0)
                {
                    throw new Exception(strEnv_SN + "已存在!");
                }

                if (strEnv_ID == "")
                {
                    conn.Insert("MDM_System_Env", m_request.Tables[0]);
                }
                else
                {
                    string strWhere = " Env_ID=" + strEnv_ID;
                    conn.Update("MDM_System_Env", m_request.Tables[0], strWhere);
                }
                conn.CommitTransaction();
                return true;
            }
            catch
            {
                conn.RollbackTransaction();
                throw;
            }



        }
开发者ID:huaminglee,项目名称:Code,代码行数:53,代码来源:MDM_Env_Edit.cs

示例9: Execute

        /// <summary>
        /// 供销售日报使用
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {

            Dbconn conn_PLM_AS = new Dbconn("F22GP_ForSalesPlan");
            DataSet ds = conn_PLM_AS.GetDataSet(
                @"  SELECT  94 AS Env_ID , --HZY_Sale_Report
                            null AS VexSSONewID ,
                            b.userid AS App_UserName ,
                            RIGHT(sys.fn_VarBinToHexStr(hashbytes('MD5', CONVERT(VARCHAR(100), b.password))), 32) AS App_Password ,
                            b.password AS App_PasswordSrc ,
                            b.username AS App_UserName_CN ,
                            GETDATE() Chang_Password_Time ,
                            1 Checked ,
                            'system' Check_User ,
                            GETDATE() Check_Time ,
                            GETDATE() Createtime ,
                            GETDATE() Updatetime
                    FROM    j_depot a ,
                            j_user b
                    WHERE   a.depotid = b.depotid
                            AND a.m_type = 11
                     ");

            Dbconn connMDM = new Dbconn("VexSSO");

            try
            {


                ArrayList tableList = new ArrayList();
                connMDM.BeginTransaction();

                tableList.Add("MDM_System_User");
                connMDM.TableLock(tableList);

                //删除数据
                connMDM.ExcuteQuerryByTran(@"DELETE FROM MDM_System_User WHERE ENV_ID=94");

                connMDM.InsertBYSQLBC("MDM_System_User", ds.Tables[0]);
                connMDM.CommitTransaction();
                return true;
            }
            catch
            {
                connMDM.RollbackTransaction();
                throw;
            }
        }
开发者ID:huaminglee,项目名称:Code,代码行数:52,代码来源:MDM_System_User_ExceuteGetFromGPF22.cs

示例10: Execute

        /// <summary>
        /// 编辑系统属性值信息
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            Dbconn conn = new Dbconn("MDM");

            try
            {
                string strSystem_ID = m_request.Tables[0].Rows[0]["System_ID"].ToString();
                string strSystem_Code = m_request.Tables[0].Rows[0]["System_Code"].ToString();

                DataTable dt_Add = new DataTable();
                dt_Add.Columns.Add("System_ID");
                dt_Add.Columns.Add("System_Code");
                dt_Add.Columns.Add("Property_ID");
                dt_Add.Columns.Add("Property_Text");
                for (int i = 2; i < m_request.Tables[0].Columns.Count; i++)
                {
                    string strValue = m_request.Tables[0].Rows[0][i].ToString();
                    if (strValue != "")
                    {
                        dt_Add.Rows.Add(new object[] { strSystem_ID, strSystem_Code, m_request.Tables[0].Columns[i].ToString(),strValue});
                    }
                }


                ArrayList listTable = new ArrayList();
                listTable.Add("MDM_System_Property_info");
                conn.BeginTransaction();
                conn.TableLock(listTable);
                string strWhere = " System_ID=" + strSystem_ID;
                conn.Delete("MDM_System_Property_info", strWhere);

                conn.InsertBYSQLBC("MDM_System_Property_info", dt_Add);
                
                conn.CommitTransaction();
                return true;
            }
            catch
            {
                conn.RollbackTransaction();
                throw;
            }



        }
开发者ID:huaminglee,项目名称:Code,代码行数:49,代码来源:MDM_System_Property_Info_Edit.cs

示例11: Execute

        /// <summary>
        /// 删除任务参数信息
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            Dbconn conn = new Dbconn("MDM");    //创建连接类

            try
            {
                if (m_request == null
                    || m_request.Tables.Count == 0
                    || m_request.Tables[0].Rows.Count == 0)
                {
                    return true;
                }
                string strParam_ID = m_request.Tables[0].Rows[0]["param_id"].ToString();    //获取参数Param_ID
                string strTASK_ID = m_request.Tables[0].Rows[0]["task_id"].ToString();  //获取参数Task_ID

                ArrayList listTable = new ArrayList();
                listTable.Add("WS_SchedulingParam");
                conn.BeginTransaction();    //开启事务
                conn.TableLock(listTable);  //锁表WS_SchedulingParam

                string strWhere = " Param_ID = '" + strParam_ID + "'";  //创建where语句
                conn.Delete("WS_SchedulingParam", strWhere);    //删除参数

                //更新主表
                DataTable dtScheduling = new DataTable();
                dtScheduling.Columns.Add("UpdateTime");
                DataRow drScheduling = dtScheduling.NewRow();
                drScheduling["UpdateTime"] = DateTime.Now;
                dtScheduling.Rows.Add(drScheduling);
                string strSchedulingWhere = " 1=1 AND TASK_ID = '" + strTASK_ID + "'";
                conn.Update("WS_Scheduling", dtScheduling, strSchedulingWhere);    //更新数据

                conn.CommitTransaction();   //提交事务
                return true;
            }
            catch
            {
                conn.RollbackTransaction(); //回滚
                throw;
            }



        }
开发者ID:huaminglee,项目名称:Code,代码行数:48,代码来源:WSServiceCall_Param_Delete.cs

示例12: Execute

        /// <summary>
        /// 删除任务信息
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            Dbconn conn = new Dbconn("MDM");

            try
            {
                if (m_request == null
                    || m_request.Tables.Count == 0
                    || m_request.Tables[0].Rows.Count == 0)
                {
                    return true;
                }
                string strTASK_ID = m_request.Tables[0].Rows[0]["task_id"].ToString();  //获取参数TASK_ID

                ArrayList listTable = new ArrayList();
                listTable.Add("WS_Scheduling");
                conn.BeginTransaction();    //事物事务
                conn.TableLock(listTable);  //锁表WS_Scheduling

                DataTable dt_Add = new DataTable() ;
                dt_Add.Columns.Add("IsDeleted");
                dt_Add.Columns.Add("Enabled");
                dt_Add.Columns.Add("UpdateUser");
                dt_Add.Columns.Add("UpdateTime");

                DataRow dr = dt_Add.NewRow();
                dr["IsDeleted"] = "True";   //将删除标志设为“True”
                dr["Enabled"] = "False";    //将可用标志设为“False”
                dr["UpdateTime"]=DateTime.Now;  //更新时间设为当前时间
                dr["UpdateUser"] = hzyMessage.User_Name;    //设置更新者
                dt_Add.Rows.Add(dr);

                string strWhere = " TASK_ID = '" + strTASK_ID + "'";
                conn.Update("WS_Scheduling", dt_Add, strWhere); //更新操作

                conn.CommitTransaction();   //提交事务
                return true;
            }
            catch
            {
                conn.RollbackTransaction(); //回滚
                throw;
            }
        }
开发者ID:huaminglee,项目名称:Code,代码行数:48,代码来源:WSServiceCall_Delete.cs

示例13: Execute

        /// <summary>
        /// 对CFG_RequestType的CRUD,为Easyui专用
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {

            DateTime time = DateTime.Now;

            Dbconn conn = new Dbconn("VexSSO");
            conn.LockTableList.Add("SSO_Login");
            conn.BeginTransaction();
            conn.TableLock();

            string strSQL = @"
                                UPDATE dbo.SSO_Login
                                SET Logout_Time='" + time.ToString("yyyy-MM-dd HH:mm:ss.fff")+ @"',
                                MARK='SYSTEM'
                                WHERE Last_Request_Time<='" + time.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss.fff") + @"'
                                    AND Logout_Time IS NULL
                            ";

            conn.ExcuteQuerryByTran(strSQL);
            conn.CommitTransaction();


            return true ;
        }
开发者ID:huaminglee,项目名称:Code,代码行数:28,代码来源:SessionTimeOutClear.cs

示例14: Execute

        public bool Execute()
        {

            Dbconn conn = new Dbconn("AM");
            Dbconn connMDM = new Dbconn("VexSSO");

            conn.BeginTransaction();
            connMDM.BeginTransaction();


            try
            {
                DataSet ds = conn.GetDataSet(
                @"    
               DECLARE @maxid  AS BINARY(10);
 
                 SELECT t1.[__$start_lsn] AS LogID,
                        t1.[__$seqval] ,
                        t1.[__$operation] OprationType ,
                        t1.CN_ID ,
                        t1.CN_LOGIN ,
                        t1.CN_USER_NAME ,
                        t1.CN_PASSWORD ,
                        Convert(int,t1.CN_ISDELETE) as CN_ISDELETE ,
                        Convert(int,t1.CN_DISABLED) as CN_DISABLED
						INTO #tmp
                FROM   [cdc].[dbo_TN_SYS_EM_USER_CT] t1 ,
                        [M01_CONF].[S01_Sync] t2
                WHERE  1=1
				AND  t1.[__$start_lsn]> ISNULL(t2.MaxStart_lsn,0x00023FE600000FBF0004)
				AND t2.SyncName='MDM数据获取'
				AND t1.[__$update_mask] !=0x00004000
				AND  t1.[__$update_mask] !=0x00800000 
				AND t1.[__$update_mask] !=0x00804000  
                
                
				SELECT @maxid=MAX(LogID)
				FROM #tmp
                
                if(@maxid is not null)
                begin
				UPDATE [M01_CONF].[S01_Sync] SET [email protected]
				WHERE SyncName='MDM数据获取'
                end

                select * from #tmp
                order by  [LogID] ASC,[__$seqval] ASC ,[OprationType] ASC


	            ");
                string strSQL = "";

                Byte[] strMaxID = null;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    strMaxID = (Byte[])ds.Tables[0].Rows[i]["LogID"];
                    string strCN_LOGIN = ds.Tables[0].Rows[i]["CN_LOGIN"].ToString();
                    string strCN_PASSWORD = ds.Tables[0].Rows[i]["CN_PASSWORD"].ToString();
                    string strCN_ISDELETE = ds.Tables[0].Rows[i]["CN_ISDELETE"].ToString();

                    string strOprationType = ds.Tables[0].Rows[i]["OprationType"].ToString();

                    if (strOprationType == "1" || strOprationType == "4") //添加或者更新
                    {
                        if (connMDM.GetDataTableRowCount("select 1 as a from MDM_Employees where [email protected]", new string[] { strCN_LOGIN }) == 0)
                        {
                            strSQL = @"INSERT INTO MDM_Employees (Name,SSO_UserName,SSO_Password,Leave_Flag,IsActived)
                                    Values(@param0,@param1,@param2,@param3,'1')";
                        }
                        else
                        {
                            strSQL = @"update MDM_Employees 
                                        SET [email protected],[email protected]
                                        WHERE [email protected]
                                    ";
                        }
                        connMDM.ExcuteQuerryByTran(strSQL, new string[] { strCN_LOGIN, strCN_LOGIN, strCN_PASSWORD, strCN_ISDELETE });

                    }
                    else if (strOprationType == "2" || strOprationType == "3") //删除
                    {
                        strSQL = @"update MDM_Employees 
                                        SET [email protected]
                                    WHERE [email protected]";
                        connMDM.ExcuteQuerryByTran(strSQL, new string[] { "1", strCN_LOGIN });

                    }
                }

                if (strMaxID != null)
                {
                    strSQL = "UPDATE M01_CONF.S01_Sync SET [email protected],LastSyncTime=getdate() WHERE SyncName='MDM数据获取'";
                    conn.ExcuteQuerryByTran(strSQL, new object[] { strMaxID });
                }
                conn.CommitTransaction();
                connMDM.CommitTransaction();
                return true;
            }
            catch
            {
//.........这里部分代码省略.........
开发者ID:huaminglee,项目名称:Code,代码行数:101,代码来源:MDM_User_ExceuteGetFromAM_Sync.cs

示例15: GetData

        /// <summary>
        /// 根据XML内容更新到货计划
        /// </summary>
        /// <returns></returns>
        public DataSet GetData()
        {
            try
            {
                DataSet ds = new DataSet();
                DataSet ds_Return = new DataSet();
                DataSet dsRequest = new DataSet();

                ArrayList listAMSendList = new ArrayList();

                Dbconn conn = new Dbconn("GL_ERP");

                string strXML = "";
                string strSQL = "";
                strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
                //XML是前台传入
                ds = Common.Common.GetDSByExcelXML(strXML);

                if (ds.Tables["OPTYPE"].Rows[0][0].ToString().ToUpper() == "GET")
                //读取ROWS到/ROWS 中的参数
                {
                    string strWHERE = "isnull(PRA_Status,'')<>'E3CA9B7A-8E17-4E52-B667-39689445D4A1'";
                    if (ds.Tables["LIST"].Columns.Contains("Condition"))
                    {
                        if (ds.Tables["LIST"].Rows[0]["Condition"].ToString().Trim() != "")
                        //读取LIST之间参数
                        {
                            strWHERE += " AND (" + ds.Tables["LIST"].Rows[0]["Condition"].ToString().Trim() + ")";
                        }
                    }

                    strSQL = @" SELECT 
                                [PRA_CONO]
                               ,[PRA_DIVI]
                               ,[PRA_ArrivalPlanId]
                               ,[PRA_ArrivalPlanCode]
                               ,[PRA_PR1_OrderId]
                               ,[PRA_PerchaseTotal]
                               ,[PRA_ArrivalTotal]
                               ,[PRA_PlanTotal]
                               ,[PRA_PerchaseAmount]
                               ,[PRA_ArrivalAmount]
                               ,[PRA_PlanAmount]
                               ,[PRA_TotalDiff]
                               ,[PRA_AmountDiff]
                               ,[PRA_Status]
                               ,[PRA_RgUser]
                               ,[PRA_RgDt]
                               ,[PRA_LmUser]
                               ,[PRA_LmDt]
                               ,[PRA_UptNo]
                               ,A.PR1_OrderCode
                               FROM B02_Bill.PRA_ArrivalPlan
                               LEFT JOIN B02_Bill.PR1_Order A ON PRA_PR1_OrderId=PR1_OrderId                           
                               WHERE " + strWHERE;
                    ds_Return = conn.GetDataSet(strSQL);
                }
                else
                {

                    ArrayList tableList = new ArrayList();
                    tableList.Add("B02_Bill.PRA_ArrivalPlan");
                    conn.BeginTransaction();
                    //开启事物
                    conn.TableLock(tableList);
                    //锁表
                    try
                    {
                        if (ds.Tables["OPTYPE"].Rows[0][0].ToString().ToUpper() == "DELETE")
                        {
                            for (int i = 0; i < ds.Tables["LIST"].Rows.Count; i++)
                            {
                                strSQL = @"UPDATE B02_Bill.PRA_ArrivalPlan SET PRA_Status='E3CA9B7A-8E17-4E52-B667-39689445D4A1' 
                               WHERE PRA_ArrivalPlanId='" + ds.Tables["LIST"].Rows[i]["PRA_ArrivalPlanId"].ToString() + @"'
                                AND isnull(PRA_Status,'')<>'E3CA9B7A-8E17-4E52-B667-39689445D4A1' 
                                ";
                                conn.ExcuteQuerryByTran(strSQL);
                            }

                        }
                        else if (ds.Tables["OPTYPE"].Rows[0][0].ToString().ToUpper() == "EDIT")
                        {
                            for (int i = 0; i < ds.Tables["LIST"].Rows.Count; i++)
                            {
                                DataTable dt = ds.Tables["LIST"].Clone();
                                dt.ImportRow(ds.Tables["LIST"].Rows[i]);

                                strSQL = @"SELECT * FROM B02_Bill.PRA_ArrivalPlan WHERE  [email protected]
                                AND isnull(PRA_Status,'')<>'E3CA9B7A-8E17-4E52-B667-39689445D4A1'
                                 ";

                                DataTable dt_SR = conn.GetDataTable(strSQL, new string[1] { ds.Tables["LIST"].Rows[i]["PRA_ArrivalPlanId"].ToString() });
                                //update
                                if (dt_SR.Rows.Count > 0)
                                {
                                    //处理结果
//.........这里部分代码省略.........
开发者ID:huaminglee,项目名称:Code,代码行数:101,代码来源:GL_ERP_ArrivalPlan_EditByXML.cs


注:本文中的Dbconn.BeginTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。