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


C# Dbconn.TableLock方法代码示例

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


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

示例1: 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

示例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>
        /// 删除系统权限信息
        /// </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

示例4: 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

示例5: 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

示例6: 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

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

示例8: 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

示例9: 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

示例10: GetData


//.........这里部分代码省略.........
                                    ,R.[DC0_DictName1] AS StatusDictName
                                    ,S.[DC0_DictName1] AS AccountDictName
                                FROM   B02_Bill.PR0_Contract WITH ( NOLOCK )  
                                LEFT JOIN  B01_MDM.SU0_Supplier A        ON    PR0_SU0_SupplierId=A.SU0_SupplierId  
                                LEFT JOIN  M02_BPM.WFT_AuditFlowDefine B ON    B.WFT_Type='Contract' and B.WFT_Step='1'
                                LEFT JOIN  M02_BPM.WFT_AuditFlowDefine C ON    C.WFT_Type='Contract' and C.WFT_Step='2'
                                LEFT JOIN  M02_BPM.WFT_AuditFlowDefine D ON    D.WFT_Type='Contract' and D.WFT_Step='3'
                                LEFT JOIN  M02_BPM.WFT_AuditFlowDefine E ON    E.WFT_Type='Contract' and E.WFT_Step='4'
                                LEFT JOIN  M02_BPM.WFT_AuditFlowDefine F ON    F.WFT_Type='Contract' and F.WFT_Step='5'
                                LEFT JOIN  M02_BPM.WFP_AuditFlow G       ON    PR0_ContractId=G.WFP_BillId AND G.WFP_WFT_AFDId=B.WFT_AFDId
                                LEFT JOIN  M02_BPM.WFP_AuditFlow H       ON    PR0_ContractId=H.WFP_BillId AND H.WFP_WFT_AFDId=C.WFT_AFDId
                                LEFT JOIN  M02_BPM.WFP_AuditFlow I       ON    PR0_ContractId=I.WFP_BillId AND I.WFP_WFT_AFDId=D.WFT_AFDId
                                LEFT JOIN  M02_BPM.WFP_AuditFlow J       ON    PR0_ContractId=J.WFP_BillId AND J.WFP_WFT_AFDId=E.WFT_AFDId
                                LEFT JOIN  M02_BPM.WFP_AuditFlow K       ON    PR0_ContractId=K.WFP_BillId AND K.WFP_WFT_AFDId=F.WFT_AFDId
                                LEFT JOIN  M01_CONF.DC0_Dictionary L     ON    G.WFP_AFResultId=L.DC0_DictId 
                                LEFT JOIN  M01_CONF.DC0_Dictionary M     ON    H.WFP_AFResultId=M.DC0_DictId
                                LEFT JOIN  M01_CONF.DC0_Dictionary N     ON    I.WFP_AFResultId=N.DC0_DictId
                                LEFT JOIN  M01_CONF.DC0_Dictionary O     ON    J.WFP_AFResultId=O.DC0_DictId
                                LEFT JOIN  M01_CONF.DC0_Dictionary P     ON    K.WFP_AFResultId=P.DC0_DictId                             
                                LEFT JOIN  M01_CONF.DC0_Dictionary Q     ON    PR0_CurrencyId=Q.DC0_DictId   
                                LEFT JOIN  M01_CONF.DC0_Dictionary R     ON    PR0_Status=R.DC0_DictId  
                                LEFT JOIN  M01_CONF.DC0_Dictionary S     ON    PR0_SettleAccount=S.DC0_DictId   
                                WHERE " + strWHERE
                                + @"ORDER BY [PR0_LmDt] DESC "; 
                    ds_Return = conn.GetDataSet(strSQL);
                }
                else
                {

                    ArrayList tableList = new ArrayList();
                    tableList.Add("B02_Bill.PR0_Contract");
                    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.PR0_Contract SET PR0_Status='E3CA9B7A-8E17-4E52-B667-39689445D4A1'
                               WHERE PR0_ContractId='" + ds.Tables["LIST"].Rows[i]["PR0_ContractId"].ToString() + @"'
                                AND ISNULL(PR0_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.PR0_Contract WHERE  [email protected]
                                  AND ISNULL(PR0_Status,'') <>'E3CA9B7A-8E17-4E52-B667-39689445D4A1' ";

                                DataTable dt_SR = conn.GetDataTable(strSQL, new string[1] { ds.Tables["LIST"].Rows[i]["PR0_ContractId"].ToString() });
                                //update
                                if (dt_SR.Rows.Count > 0)
                                {

                                    strSQL = @"SELECT * FROM M02_BPM.WFP_AuditFlow  WHERE  [email protected]
                                         AND  WFP_AFResultId<>''
开发者ID:huaminglee,项目名称:Code,代码行数:67,代码来源:GL_ERP_Contract_EditByXML.cs

示例11: Execute

        public bool Execute()
        {

            Dbconn conn = new Dbconn("AM");
            DataSet ds = conn.GetDataSet(
                @"SELECT  cn_id as AM_User_id,
                        CN_LOGIN as AM_login,
                        CN_USER_NAME as AM_User_Name,
                        CN_PASSWORD AM_Password,
                        CN_EMAIL AM_Email,
                        CN_TITLE AM_Title,
                        CN_HANDSET AM_Handset,
                        CN_ISDELETE AM_IsDelete

                FROM    dbo.TN_SYS_EM_USER t1 ,
                         dbo.TN_SYS_EM_USER_PROP t2
                WHERE   t1.cn_id = t2.CN_USERID
	");



            Dbconn connMDM = new Dbconn("MDM");

            try
            {


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

                tableList.Add("AM_User_log");
                tableList.Add("AM_User");
                connMDM.TableLock(tableList);


//                //存入日志数据
//                connMDM.ExcuteQuerryByTran(@"INSERT  INTO dbo.AM_User_log
//                (   Log_datetime ,
//                    AM_User_id ,
//                    AM_LOGIN ,
//                    AM_USER_NAME,
//                    AM_PASSWORD,
//                    AM_EMAIL,
//                    AM_TITLE,
//                    AM_HANDSET,
//                    AM_ISDELETE,
//                    CreateTime ,
//                    UpdateTime ,
//                    Timestamps_old
//		        
//                )
//                SELECT  GETDATE() ,
//                        AM_User_id ,
//                        AM_LOGIN ,
//                        AM_USER_NAME,
//                        AM_PASSWORD,
//                        AM_EMAIL,
//                        AM_TITLE,
//                        AM_HANDSET,
//                        AM_ISDELETE,
//                        CreateTime ,
//                        UpdateTime,
//                        CONVERT(BIGINT,Timestamps)
//                FROM    AM_User;");
                //删除数据
                connMDM.ExcuteQuerryByTran("DELETE  FROM AM_User");
                connMDM.InsertBYSQLBC("AM_User", ds.Tables[0]);

                //更新MDM_Employees的用户信息
                connMDM.ExcuteQuerryByTran(@"UPDATE MDM_Employees 
                                    SET SSO_Password=t2.AM_Password,
                                    Leave_Flag=AM_ISDELETE
                                    FROM dbo.AM_User t2 WHERE MDM_Employees.SSO_UserName = t2.AM_login
                                    "
                    );


                //并添加新入职的数据
                connMDM.ExcuteQuerryByTran(@" 
                    INSERT INTO dbo.MDM_Employees
                            ( 
                              Name ,
                              Sex ,
                              Phone ,
                              Moblie ,
                              SSO_UserName ,
                              SSO_Password ,
                              In_Time ,
                              Leave_Time ,
                              Leave_Flag ,
                              IsActived 
                            )
                    SELECT  
                            AM_login ,
                            NULL,
                            NULL,
                            NULL,
                            AM_login ,
                            AM_Password ,
                            GETDATE(),
//.........这里部分代码省略.........
开发者ID:huaminglee,项目名称:Code,代码行数:101,代码来源:MDM_StyleInfo_ExceuteGetFromDRP.cs

示例12: Execute

        public bool Execute()
        {
            Dbconn conn = new Dbconn("iCollecter");
            DataSet ds = conn.GetDataSet(
                @"  SELECT  AMLoginName AS CN_LOGIN,TfgMachineNo,ComputerName
                    FROM    ( SELECT    ROW_NUMBER() OVER ( PARTITION BY TfgMachineNo ORDER BY collectDate DESC ) AS RowIndex ,
                                        ComputerName ,
                                        AMLoginName,
                                        TfgMachineNo
                              FROM      dbo.AMAndTFG WITH(NOLOCK)
                              WHERE     1 = 1
                                        AND ISNULL(AMLoginUsers, '') <> ''
                            ) t
                    WHERE   RowIndex = 1
 	                    ");



            Dbconn connMDM = new Dbconn("MDM");


            //获取用户ID
            ds.Tables[0].Columns.Add("AM_User_id", typeof(Int32));

            ds.Tables[0].AcceptChanges();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string[] strParm = new string[1];
                strParm[0]=ds.Tables[0].Rows[i]["CN_LOGIN"].ToString();

                DataTable dt = connMDM.GetDataTable("SELECT AM_User_id FROM AM_User WHERE [email protected]", strParm);
                if (dt.Rows.Count > 0)
                {
                    ds.Tables[0].Rows[i]["AM_User_id"] = dt.Rows[0]["AM_User_id"];
                }
                else
                {
                    ds.Tables[0].Rows[i].Delete();
                }

            }

            ds.Tables[0].Columns.Remove("CN_LOGIN");
            ds.Tables[0].AcceptChanges();
            try
            {


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

                tableList.Add("AM_TFG_Relation_log");
                tableList.Add("AM_TFG_Relation");
                connMDM.TableLock(tableList);


                //存入日志数据
                connMDM.ExcuteQuerryByTran(@"INSERT  INTO dbo.AM_TFG_Relation_log
                ( Log_datetime ,
                  AM_User_id ,
                  TfgMachineNo ,
                  ComputerName ,
                  CreateTime ,
                  UpdateTime ,
                  Timestamps_old
		        
                )
                SELECT  GETDATE() ,
                        AM_User_id ,
                        TfgMachineNo ,
                        ComputerName ,
                        CreateTime ,
                        UpdateTime,
                        Convert(bigint,Timestamps)
                FROM    AM_TFG_Relation;");


                //删除数据
                connMDM.ExcuteQuerryByTran("DELETE  FROM AM_TFG_Relation");
                connMDM.Insert("AM_TFG_Relation", ds.Tables[0]);
                connMDM.CommitTransaction();

                return true;

            }
            catch
            {
                connMDM.RollbackTransaction();
                throw;
            }
        }
开发者ID:huaminglee,项目名称:Code,代码行数:91,代码来源:MDM_UserRelation_ExecuteGetFromTFG.cs

示例13: DoLogout

    /// <summary>
    /// 登出操作
    /// </summary>
    /// <param name="pSessionID"></param>
    /// <returns></returns>
    private bool DoLogout(string pSessionID)
    {
        bool returnValue = false;
        Dbconn conn = new Dbconn("VexSSO");

        DataTable dt = new System.Data.DataTable();
        dt.Columns.Add("Logout_Time");
        dt.Rows.Add(new object[] { DateTime.Now });

        conn.BeginTransaction();

        ArrayList tableList = new ArrayList();
        tableList.Add("SSO_Login");
        conn.TableLock(tableList);
        returnValue = conn.Update("SSO_Login", dt, "SSO_Guid='" + pSessionID + "'");
        conn.CommitTransaction();

        hzyMessage.ClearUserInfo();
        hzyMessage.Message = "登出成功";

        return returnValue;
    }
开发者ID:huaminglee,项目名称:Code,代码行数:27,代码来源:WS.cs

示例14: 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(BD0_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 
                                    [BD0_CONO]
                                   ,[BD0_DIVI]
                                   ,[BD0_BrandId]
                                   ,[BD0_BrandCode]
                                   ,[BD0_SU0_SupplierId]
                                   ,[BD0_BrandName]
                                   ,[BD0_CountryId]
                                   ,[BD0_StyleId]
                                   ,[BD0_CusGrpId]
                                   ,[BD0_Status]
                                   ,[BD0_RgUser]
                                   ,[BD0_RgDt]
                                   ,[BD0_LmUser]
                                   ,[BD0_LmDt]
                                   ,[BD0_UptNo]
                                   ,A.[SU0_SupplierCode] 
                                   ,B.[DC0_DictName1] AS CountryDictName
                                   ,C.[DC0_DictName1] AS StyleDictName
                                   ,D.[DC0_DictName1] AS CusGrpDictName
                                FROM   B01_MDM.BD0_Brand WITH ( NOLOCK )    
                                LEFT JOIN  B01_MDM.SU0_Supplier A ON  BD0_SU0_SupplierId=A.SU0_SupplierId   
                                LEFT JOIN  M01_CONF.DC0_Dictionary B ON  BD0_CountryId=B.DC0_DictId  
                                LEFT JOIN  M01_CONF.DC0_Dictionary C ON  BD0_StyleId=C.DC0_DictId 
                                LEFT JOIN  M01_CONF.DC0_Dictionary D ON  BD0_CusGrpId=D.DC0_DictId                                   
                                WHERE " + strWHERE
                                + @"ORDER BY [BD0_LmDt] DESC ";
                    ds_Return = conn.GetDataSet(strSQL);
                }
                else
                {

                    ArrayList tableList = new ArrayList();
                    tableList.Add("B01_MDM.BD0_Brand");
                    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 B01_MDM.BD0_Brand SET BD0_Status=1 
                               WHERE BD0_BrandId='" + ds.Tables["LIST"].Rows[i]["BD0_BrandId"].ToString() + @"'
                                AND ISNULL(BD0_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 B01_MDM.BD0_Brand WHERE  [email protected]
                                AND ISNULL(BD0_Status,'') <>'E3CA9B7A-8E17-4E52-B667-39689445D4A1' ";

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

示例15: Execute

        public bool Execute()
        {

            Dbconn conn = new Dbconn("AM");
            DataSet ds = conn.GetDataSet(
                @"SELECT  DISTINCT t1.CN_S_EMITEM_ID AS AM_USER_ID ,
                            t1.CN_P_EMITEM_ID AS AM_S_Dept_ID  	
                    FROM     TN_SYS_EM_USER t2 WITH ( NOLOCK )
                            LEFT   JOIN  TN_SYS_EM_RELATION t1 WITH ( NOLOCK ) ON t1.CN_S_EMITEM_ID = t2.CN_ID
                    WHERE   1 = 1
                            AND t2.CN_ISDELETE = 0
                            AND t2.CN_DISABLED = 0
                            AND t1.CN_REL_TYPE = 1
                            AND CN_S_EMITEM_TYPE=0
                            AND ( 
                            ( CN_P_EMITEM_TYPE = 1
                                    AND EXISTS ( SELECT 1
                                                 FROM    TN_SYS_EM_GROUP t3 WITH ( NOLOCK )
                                                 WHERE  T1.CN_P_EMITEM_ID = T3.cn_id
                                                        AND T3.CN_OWNERID = 0 )
                                  )
                                  OR 
                                  ( CN_P_EMITEM_TYPE = 3
                                       AND EXISTS ( SELECT  1
                                                    FROM     TN_SYS_EM_VIEW T4 WITH ( NOLOCK )
                                                    WHERE   1 = 1
                                                            AND CN_VIEW_TYPE = 1
                                                            AND CN_OWNERID = 0
                                                            AND CN_P_EMITEM_ID = T4.cn_id )
                                     )
                                )
                     ");



            Dbconn connMDM = new Dbconn("MDM");

            try
            {


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

                tableList.Add("Am_User_Dept_log");
                tableList.Add("Am_User_Dept");
                connMDM.TableLock(tableList);


//                //存入日志数据
//                connMDM.ExcuteQuerryByTran(@"INSERT  INTO dbo.Am_User_Dept_log
//                ( Log_datetime ,
//				  AM_USER_ID,
//                  AM_S_Dept_ID ,
//                  CreateTime ,
//                  UpdateTime,
//                  Timestamps_old
//		        
//                )
//                SELECT  GETDATE() ,
//						AM_USER_ID,
//                        AM_S_Dept_ID ,
//                        CreateTime ,
//                        UpdateTime,
//                        convert(bigint,Timestamps)
//                FROM    Am_User_Dept");


                //删除数据
                connMDM.ExcuteQuerryByTran("DELETE  FROM Am_User_Dept");
                connMDM.InsertBYSQLBC("Am_User_Dept", ds.Tables[0]);
                connMDM.CommitTransaction();
                return true;
            }
            catch
            {
                connMDM.RollbackTransaction();
                throw;
            }
        }
开发者ID:huaminglee,项目名称:Code,代码行数:80,代码来源:MDM_User_Dept_ExceuteGetFromAM.cs


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