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


C# Dbconn.Update方法代码示例

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


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

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

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

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

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

示例5: Execute

        public bool Execute()
        {
            string strEnv_ID = "";
            string strEnv_SN = "HZY_CMT";

            Dbconn conn_HZY_SBS = new Dbconn("F22GP_ForSalesPlan");

            DataSet ds = conn_HZY_SBS.GetDataSet(
                @" SELECT   
                                --98 AS Env_ID ,
                                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 ,
                                CASE WHEN b.dptype <> 0 THEN ISNULL(a.depotid,'') + '_' + d_name ELSE b.username END  AS App_UserName_CN ,
                                GETDATE() Chang_Password_Time ,
                                1 Checked ,
                                'system' Check_User ,
                                GETDATE() Check_Time ,
                                GETDATE() Createtime ,
                                GETDATE() Updatetime,
                                0 as oprationFlag
                        FROM    
                                j_user b
                                LEFT JOIN j_depot a ON a.depotid = b.depotid
                     ");

            Dbconn connMDM = new Dbconn("VexSSO");

            try
            {

                ArrayList tableList = new ArrayList();
                connMDM.BeginTransaction();
                tableList.Add("MDM_System_User");
                connMDM.TableLock(tableList);

                strEnv_ID = connMDM.GetDataTableFirstValue("SELECT [Env_ID]  FROM [MDM_System_Env]  WHERE Env_SN='" + strEnv_SN + "'").ToString();
                DataTable dtMDM = connMDM.GetDataTable(@"
                                                        SELECT [App_UserID]
                                                              ,[Env_ID]
                                                              ,[VexSSONewID]
                                                              ,[App_UserName]
                                                              ,[App_Password]
                                                              ,[App_PasswordSrc]
                                                              ,[App_UserName_CN]
                                                              ,[Chang_Password_Time]
                                                              ,[Checked]
                                                              ,[Check_User]
                                                              ,[Check_Time]
                                                              ,[Createtime]
                                                              ,[Updatetime]
                                                          FROM [dbo].[MDM_System_User]
                                                          WHERE Env_ID='" + strEnv_ID + @"'
                                                        ");


                DataTable dtMDMUpdate = dtMDM.Clone();
                DataTable dtMDMInsert = dtMDM.Clone();
                DataTable dtMDMDelete = dtMDM.Clone();

                for (int i = 0; i < dtMDM.Rows.Count; i++)
                {
                    string strApp_UserName = dtMDM.Rows[i]["App_UserName"].ToString();

                    DataRow[] dr = ds.Tables[0].Select("App_UserName='" + strApp_UserName + "'");
                    if (dr.Length > 0)
                    {
                        dtMDM.Rows[i]["App_Password"] = dr[0]["App_Password"];
                        dtMDM.Rows[i]["App_PasswordSrc"] = dr[0]["App_PasswordSrc"];
                        dtMDM.Rows[i]["App_UserName_CN"] = dr[0]["App_UserName_CN"];

                        dtMDMUpdate.ImportRow(dtMDM.Rows[i]);
                        dr[0]["oprationFlag"] = "1";
                    }
                    else
                    {
                        dtMDMDelete.ImportRow(dtMDM.Rows[i]);
                    }
                }

                DataRow[] drInsert = ds.Tables[0].Select("oprationFlag=0");
                for (int i = 0; i < drInsert.Length; i++)
                {
                    DataRow dr = dtMDMInsert.NewRow();
                    dr["Env_ID"] = strEnv_ID;
                    dr["VexSSONewID"] = drInsert[i]["VexSSONewID"];
                    dr["App_UserName"] = drInsert[i]["App_UserName"];
                    dr["App_Password"] = drInsert[i]["App_Password"];
                    dr["App_PasswordSrc"] = drInsert[i]["App_PasswordSrc"];
                    dr["App_UserName_CN"] = drInsert[i]["App_UserName_CN"];
                    dr["Chang_Password_Time"] = drInsert[i]["Chang_Password_Time"];
                    dr["Checked"] = drInsert[i]["Checked"];
                    dr["Check_User"] = drInsert[i]["Check_User"];
                    dr["Check_Time"] = drInsert[i]["Check_Time"];
                    dr["Createtime"] = drInsert[i]["Createtime"];
                    dr["Updatetime"] = drInsert[i]["Updatetime"];
                    dtMDMInsert.Rows.Add(dr);
                }

//.........这里部分代码省略.........
开发者ID:huaminglee,项目名称:Code,代码行数:101,代码来源:MDM_System_User_ExceuteGetFromGPF22ForHZYCMT.cs

示例6: GetData


//.........这里部分代码省略.........
                                    if (ds.Tables["LIST"].Rows[i]["PRA_LmUser"].ToString() != "")
                                    {
                                        string strCode = dt_SR.Rows[0]["PRA_UptNo"].ToString();
                                        if (strCode == "0")
                                        {
                                            strCode = Convert.ToInt32(strCode) + 1.ToString();
                                        }
                                        else
                                        {
                                            strCode = "0";
                                        }

                                        if (!dt.Columns.Contains("PRA_LmDt"))
                                        {
                                            dt.Columns.Add("PRA_LmDt");
                                        }


                                        if (!dt.Columns.Contains("PRA_UptNo"))
                                        {
                                            dt.Columns.Add("PRA_UptNo");
                                        }

                                       // if (!dt.Columns.Contains("PRA_Status"))
                                       // {
                                       //     dt.Columns.Add("PRA_Status");
                                       // }

                                       // dt.Rows[0]["PRA_Status"] = '0';
                                        dt.Rows[0]["PRA_LmDt"] = DateTime.Now;
                                        dt.Rows[0]["PRA_UptNo"] = strCode;
                                    }

                                    conn.Update("B02_Bill.PRA_ArrivalPlan", dt, "PRA_ArrivalPlanId='" + ds.Tables["LIST"].Rows[i]["PRA_ArrivalPlanId"].ToString() + @"'");

                  
                                    }            

                                else  //add
                                {

                                    string PRA_ArrivalPlanId = Guid.NewGuid().ToString();


                                    if (!dt.Columns.Contains("PRA_ArrivalPlanId"))
                                    {
                                        dt.Columns.Add("PRA_ArrivalPlanId");
                                    }

                                  //  if (!dt.Columns.Contains("PRA_Status"))
                                  //  {
                                  //      dt.Columns.Add("PRA_Status");
                                  //  }


                                    if (!dt.Columns.Contains("PRA_RgDt"))
                                    {
                                        dt.Columns.Add("PRA_RgDt");
                                    }

                                    if (!dt.Columns.Contains("PRA_LmDt"))
                                    {
                                        dt.Columns.Add("PRA_LmDt");
                                    }

                                    if (!dt.Columns.Contains("PRA_UptNo"))
开发者ID:huaminglee,项目名称:Code,代码行数:67,代码来源:GL_ERP_ArrivalPlan_EditByXML.cs

示例7: SetFATypes

        /// <summary>
        /// 新建或修改固定资产类别记录
        /// </summary>
        /// <returns></returns>
        public DataSet SetFATypes(Dbconn conn, String strType)
        {
            String strCode = "";
            DataSet ds_Return = new DataSet();
            string strActor = m_request.Tables[0].Rows[0]["actor"].ToString();
            string strXML = m_request.Tables[0].Rows[0]["XML"].ToString(); 
            DataSet dsXML = Common.Common.GetDSByExcelXML(strXML);
            String strOPType = dsXML.Tables["OPTYPE"].Rows[0][0].ToString().ToUpper();
            String strID = dsXML.Tables["LIST"].Rows[0]["ct1_id"].ToString();
            String strFatherID = dsXML.Tables["LIST"].Rows[0]["ct1_fatherid"].ToString();
            DataTable dt_List = dsXML.Tables["LIST"];
            if (strID == "")
            {
                throw new Exception("数据异常,缺少主键,请联系管理员!");
            } 
            bool bResult = false;
            if (strType == "NewFATypeDL") //新建大类
            {
                String strSQL1 = @" SELECT MAX(CT1_Code) AS code "
                          + @" FROM M01_CONF.CT0_CSYTAB WHERE 1=1 "
                          + " AND  ISNULL(CONVERT(VARCHAR(50),CT1_FatherID),'') = '" + strFatherID
                          + "'";
                DataSet ds1 = conn.GetDataSet(strSQL1);
                if (ds1.Tables == null)
                {
                    dsXML.Tables["LIST"].Rows[0]["ct1_code"] = "01";
                }
                else
                {
                    dsXML.Tables["LIST"].Rows[0]["ct1_code"] = int.Parse(ds1.Tables[0].Rows[0]["code"].ToString()) + 1;
                    if (int.Parse(ds1.Tables[0].Rows[0]["code"].ToString()) < 9)
                    {
                        dsXML.Tables["LIST"].Rows[0]["ct1_code"] = "0" + dsXML.Tables["LIST"].Rows[0]["ct1_code"].ToString();
                    } 
                } 
                conn.BeginTransaction();
                bResult = conn.Insert("M01_CONF.CT0_CSYTAB", dt_List);
                conn.CommitTransaction();
            }
            else if (strType == "NewFATypeXL") //新建小类
            {
                String strSQL1 = @" SELECT MAX(CT1_Code) AS code "
                          + @" FROM M01_CONF.CT0_CSYTAB WHERE 1=1 "
                          + " AND  ISNULL(CONVERT(VARCHAR(50),CT1_FatherID),'') = '" + strFatherID
                          + "'";
                DataSet ds1 = conn.GetDataSet(strSQL1);
                if (ds1.Tables == null)
                {
                    return ds_Return;
                }
                else
                {
                    if (ds1.Tables[0].Rows[0]["code"].ToString() == "")
                    {
                        String strSQL2 = @" SELECT CT1_Code "
                                                  + @" FROM M01_CONF.CT0_CSYTAB WHERE 1=1 "
                                                  + " AND  ISNULL(CONVERT(VARCHAR(50),CT1_ID),'') = '" + strFatherID
                                                  + "'";
                        DataSet ds2 = conn.GetDataSet(strSQL2);
                        dsXML.Tables["LIST"].Rows[0]["ct1_code"] = ds2.Tables[0].Rows[0]["CT1_Code"].ToString() + "001";
                    }
                    else
                    {
                        dsXML.Tables["LIST"].Rows[0]["ct1_code"] = int.Parse(ds1.Tables[0].Rows[0]["code"].ToString()) + 1;
                        if (int.Parse(ds1.Tables[0].Rows[0]["code"].ToString()) < 9999)
                        {
                            dsXML.Tables["LIST"].Rows[0]["ct1_code"] = "0" + dsXML.Tables["LIST"].Rows[0]["ct1_code"].ToString();
                        } 
                    } 
                } 
                //dt_List.Columns.Add("CT1_RgUser");
                //dt_List.Rows[0]["CT1_RgUser"] = strActor;
                conn.BeginTransaction();
                bResult = conn.Insert("M01_CONF.CT0_CSYTAB", dt_List);
                conn.CommitTransaction();
            }
            else if (strType == "UpdFAType") //修改大小类
            {
                conn.BeginTransaction();
                bResult = conn.Update("M01_CONF.CT0_CSYTAB", dt_List, "ct1_id='" + strID + "'");
                conn.CommitTransaction();
            } 


            strCode = dsXML.Tables["LIST"].Rows[0]["ct1_code"].ToString(); 
            if (bResult)
            {
                dt_EditResult.Rows.Add(new object[] { true, strCode });
            }
            else
            {
                dt_EditResult.Rows.Add(new object[] { false, "保存失败!" });

            }
            ds_Return.Tables.Add(dt_EditResult);
            return ds_Return;
//.........这里部分代码省略.........
开发者ID:huaminglee,项目名称:Code,代码行数:101,代码来源:PE_OA_BaseData.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 strTASK_ID = m_request.Tables[0].Rows[0]["task_id"].ToString();  //获取参数Task_ID
                string strParam_Name = m_request.Tables[0].Rows[0]["param_name"].ToString();  //获取参数Param_Name
                string strParam_ID = m_request.Tables[0].Rows[0]["param_id"].ToString();  //获取参数Param_ID

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

                if (!string.IsNullOrEmpty(strTASK_ID))
                {
                    strWhere += " AND TASK_ID = '" + strTASK_ID + "'";
                }

                if (!string.IsNullOrEmpty(strParam_Name))
                {
                    strWhere += " AND Param_Name = '" + strParam_Name + "'";
                }

                //创建DataTable
                DataTable dt_Add = new DataTable();
                dt_Add.Columns.Add("Param_ID");
                dt_Add.Columns.Add("TASK_ID");
                dt_Add.Columns.Add("Param_Name");
                dt_Add.Columns.Add("Param_Value");

                DataRow dr = dt_Add.NewRow();

                for (int i = 0; i < dt_Add.Columns.Count; i++)
                {
                    dr[i] = m_request.Tables[0].Rows[0][dt_Add.Columns[i].ColumnName].ToString();   //将m_request中的数据逐个赋值
                }
                dt_Add.Rows.Add(dr);



                if (strParam_ID == "") //如果为空,说明是复制数据
                {
                    //判断是否已经存在
                    int nRow = conn.GetDataTableRowCount("SELECT * FROM WS_SchedulingParam WHERE " + strWhere, new string[0]);
                    if (nRow > 0)
                    {
                        throw new Exception(strParam_Name + "已经存在,不能更新");
                    }
                    strParam_ID = Guid.NewGuid().ToString();    //创建GUID

                    dt_Add.Rows[0]["Param_ID"] = strParam_ID;
                    conn.Insert("WS_SchedulingParam", dt_Add);  //插入数据
                }
                else
                {
                    dt_Add.Columns.Remove("Param_ID");  //删除Param_ID,更新不需要
                    dt_Add.Columns.Remove("Task_ID");  //删除Task_ID,更新不需要
                    strWhere = " 1=1 AND Param_ID = '" + strParam_ID + "'"; //重新设置where语句
                    conn.Update("WS_SchedulingParam", dt_Add, 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,代码行数:91,代码来源:WSServiceCall_Param_Edit.cs

示例9: 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 strEnvo_ID = m_request.Tables[0].Rows[0]["Envo_ID"].ToString();

            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() == "GET")
            {

                if (strEnvo_ID == "")
                {
                    throw new Exception("Envo_ID不能为空");
                }

                ds_Return = conn.GetDataSet(@"
                            SELECT 
                                    Template_ID ,
                                    Envo_ID ,
                                    Template_Name ,
                                    --replace(replace(REPLACE([Text],CHAR(9),'    '),char(13),'ㄧ'),char(10),'ㄧ') Text ,
                                    Text ,
                                    ViewCount ,
                                    UpdateTime ,
                                    UpdateUser 
                            FROM dbo.EnvoTemplates
                            WHERE [email protected]
                            ORDER BY ViewCount DESC 
                    ", new string[] { strEnvo_ID });

            }
            else if (dt_OPTYPE.Rows[0][0].ToString().ToUpper() == "UPDATE")
            {

                bool bResult = true;

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

                    ds.Tables["list"].Columns.Remove("Template_ID");

                    Commom_Ds.SetUpdateInfo(ds.Tables["list"], hzyMessage);

                    conn.BeginTransaction();
                    if (CheckName(ds.Tables["list"], conn) == false)
                    {
                        conn.RollbackTransaction();
                        throw new Exception("模板名称已经存在");
                    }

                    bResult = conn.Update("EnvoTemplates", ds.Tables["list"], "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);
            }
            else if (dt_OPTYPE.Rows[0][0].ToString().ToUpper() == "INSERT")
            {

                bool bResult = true;

                if (ds.Tables["list"].Rows.Count > 0)
                {
                    ds.Tables["list"].Columns.Remove("Template_ID");

                    Commom_Ds.SetUpdateInfo(ds.Tables["list"], hzyMessage);

                    conn.BeginTransaction();
                    if (CheckName(ds.Tables["list"], conn) == false)
                    {
                        conn.RollbackTransaction();
                        throw new Exception("模板名称已经存在");
//.........这里部分代码省略.........
开发者ID:huaminglee,项目名称:Code,代码行数:101,代码来源:EnvoTemplates.cs

示例10: 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 strSQL = @"
                            SELECT 
                                   [MenuID]
                                  ,[MenuName]
                                  ,[MenuFatherID]
                                  ,[ActionURL]
                              FROM [WSRR_Manage].[F01_CERT].[Menu]
                        ";
                    ds_Return = conn.GetDataSet(strSQL);
                    //ds_Return.Tables[0].Rows.Add(new object[] { "0", "00_根目录", "-1", "-1" });
                }     
                //更新
                else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "EDIT")
                {
                    string strMenuID = dt_LIST.Rows[0]["MenuID"].ToString();
                    bool bResult = false;
                    conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[Menu]");//锁定表
                    conn.BeginTransaction();//开始事务
                    dt_LIST.Columns.Remove("MenuID");//移除属性,标识符列(ID)不能更新
                    bResult = conn.Update("[WSRR_Manage].[F01_CERT].[Menu]", dt_LIST, "MenuID=" + strMenuID);//update语句
                    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);
                }
                else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "INSERT")
                {
                    string strMenuID = dt_LIST.Rows[0]["MenuID"].ToString();
                    bool bResult = false;
                    conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[Menu]");//锁定表
                    conn.BeginTransaction();//开始事务
                    dt_LIST.Columns.Remove("MenuID");//移除属性,标识符列(ID)不能更新
                    bResult = conn.Insert("[WSRR_Manage].[F01_CERT].[Menu]", dt_LIST);//update语句
                    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);
                }
                else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "DELETE")
                {
                    string strMenuID = dt_LIST.Rows[0]["MenuID"].ToString();
                    bool bResult = false;
                    conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[Menu]");//锁定表
                    conn.BeginTransaction();//开始事务
                    dt_LIST.Columns.Remove("MenuID");//移除属性,标识符列(ID)不能更新
                    bResult = conn.Delete("[WSRR_Manage].[F01_CERT].[Menu]" , "MenuID=" + strMenuID);//update语句
                    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,代码行数:92,代码来源:MenuManage.cs

示例11: GetData

        /// <summary>
        /// 根据XML内容更新服务器申请单
        /// </summary>
        /// <returns></returns>
        public DataSet GetData()
        {
            try
            {
                DataSet ds_Return = new DataSet();
                DataSet ds = new DataSet();
                DataSet dsRequest = new DataSet();

                Dbconn conn = new Dbconn("HZY_ExcelAppStore");

                string strXML = "";
                string strSQL = "";
                strXML = m_request.Tables[0].Rows[0]["XML"].ToString();

                ds = Common.Common.GetDSByExcelXML(strXML);

                if (ds.Tables["OPTYPE"].Rows[0][0].ToString().ToUpper() == "GET")
                {
                    string strWHERE = " Deleted=0 ";
                    if (ds.Tables["LIST"].Columns.Contains("Condition"))
                    {
                        if (ds.Tables["LIST"].Rows[0]["Condition"].ToString().Trim() != "")
                        {
                            strWHERE += " AND (" + ds.Tables["LIST"].Rows[0]["Condition"].ToString().Trim() + ")";
                        }
                    }

                    strSQL = @" SELECT *
                                FROM    ExcelAppStore WITH ( NOLOCK )
                                WHERE " + strWHERE;
                    ds_Return = conn.GetDataSet(strSQL);
                }
                else
                {

                    ArrayList tableList = new ArrayList();
                    tableList.Add("ExcelAppStore");
                    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 ExcelAppStore SET Deleted=1 
                               WHERE AppName='" + ds.Tables["LIST"].Rows[i]["AppName"].ToString() + @"'
                                AND Deleted=0 ";
                                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 ExcelAppStore WHERE  [email protected]
                                AND Deleted=0 ";

                                DataTable dt_SR = conn.GetDataTable(strSQL, new string[1] { ds.Tables["LIST"].Rows[i]["AppName"].ToString() });
                                //update
                                if (dt_SR.Rows.Count > 0)
                                {
                                    //运维操作
                                    if (ds.Tables["LIST"].Rows[i]["AppName"].ToString() != "")
                                    {
                                        conn.Update("ExcelAppStore", dt, "AppName='" + ds.Tables["LIST"].Rows[i]["AppName"].ToString() + @"'");
                                    }

                                }
                                else  //add
                                {

                                    conn.Insert("ExcelAppStore", dt);
                                }

                            }
                        }
                        conn.CommitTransaction();

 
                        ds_Return = Common.Common.GetRequestDataSet(new string[]{"Result"},new string[]{"true"});
                    }
                    catch
                    {
                        conn.RollbackTransaction();
                        throw;
                    }
                }
                return ds_Return;
            }
            catch
            {
//.........这里部分代码省略.........
开发者ID:huaminglee,项目名称:Code,代码行数:101,代码来源:ITSM_ExcelAppStore_EditByXML.cs

示例12: CheckUser

    public bool CheckUser(string SessionID)
    {

        if (SessionID == null || SessionID == "")
        {
            throw new Exception("身份验证错误");
        }
        Dbconn conn = new Dbconn("VexSSO");
        string strSQL = @"
              SELECT 
                    [SSO_Guid]
                  ,[Company_sn]
                  ,[Company_ID]
                  ,[Env_sn]
                  ,[Env_ID]
                  ,[Request_IP]
                  ,[Request_ComputerName]
                  ,[Login_Env_sn]
                  ,[Login_Env_ID] 
                  ,[VexSSONewID]
                  ,[User_ID]
                  ,[User_Name]
              FROM [dbo].[SSO_Login] with(nolock)
              where [SSO_Guid][email protected]
              and Logout_Time is null
        ";

        DataTable dt = conn.GetDataTable(strSQL, new string[] { SessionID });
        if (dt.Rows.Count == 1)
        {
            hzyMessage.Session_ID = dt.Rows[0]["SSO_Guid"].ToString();
            //hzyMessage.Company_SN = dt.Rows[0]["Company_sn"].ToString();
            //hzyMessage.Company_ID = dt.Rows[0]["Company_ID"].ToString();
            hzyMessage.Env_SN = dt.Rows[0]["Env_sn"].ToString();
            hzyMessage.Env_ID = dt.Rows[0]["Env_ID"].ToString();
            hzyMessage.LoginEnv_SN = dt.Rows[0]["Login_Env_sn"].ToString();
            hzyMessage.LoginEnv_ID = dt.Rows[0]["Login_Env_ID"].ToString();

            hzyMessage.VexSSONewID = dt.Rows[0]["VexSSONewID"].ToString();
            hzyMessage.User_ID = dt.Rows[0]["User_ID"].ToString();
            hzyMessage.User_Name = dt.Rows[0]["User_Name"].ToString();


            //需要更新用户的最后访问日期
            DataTable dt_UpdateLastRequestTime = new System.Data.DataTable();
            dt_UpdateLastRequestTime.Columns.Add("Last_Request_Time");
            dt_UpdateLastRequestTime.Rows.Add(new object[] { DateTime.Now });

            conn.BeginTransaction();
            conn.Update("SSO_Login", dt_UpdateLastRequestTime, "SSO_Guid='" + hzyMessage.Session_ID + "'");
            conn.CommitTransaction();

            return true;
        }
        else
        {
            throw new Exception("身份验证错误");
        }
    }
开发者ID:huaminglee,项目名称:Code,代码行数:59,代码来源:WSRR.cs

示例13: GetData


//.........这里部分代码省略.........
                                    }
                                    else
                                        if (ds.Tables["LIST"].Rows[i]["FNP_LmUser"].ToString() != "")
                                        {
                                            string strCode = dt_SR.Rows[0]["FNP_UptNo"].ToString();
                                            if (strCode == "0")
                                            {
                                                strCode = Convert.ToInt32(strCode) + 1.ToString();
                                            }
                                            else
                                            {
                                                strCode = "0";
                                            }

                                            if (!dt.Columns.Contains("FNP_LmDt"))
                                            {
                                                dt.Columns.Add("FNP_LmDt");
                                            }
                                          //  if (!dt.Columns.Contains("FNP_Status"))
                                          //  {
                                          //      dt.Columns.Add("FNP_Status");
                                          //  }

                                            if (!dt.Columns.Contains("FNP_UptNo"))
                                            {
                                                dt.Columns.Add("FNP_UptNo");
                                            }

                                          //  dt.Rows[0]["FNP_Status"] = '0';
                                            dt.Rows[0]["FNP_LmDt"] = DateTime.Now;
                                            dt.Rows[0]["FNP_UptNo"] = strCode;
                                        }

                                    conn.Update("B02_Bill.FNP_PayApply", dt, "FNP_PayApplyId='" + ds.Tables["LIST"].Rows[i]["FNP_PayApplyId"].ToString() + @"'");

                                }
                                else  //add
                                {


                                    string FNP_PayApplyId = Guid.NewGuid().ToString();


                                    if (!dt.Columns.Contains("FNP_PayApplyId"))
                                    {
                                        dt.Columns.Add("FNP_PayApplyId");
                                    }

                               //    if (!dt.Columns.Contains("FNP_Status"))
                                  //  {
                                  //      dt.Columns.Add("FNP_Status");
                                 //   }

                                    if (!dt.Columns.Contains("FNP_RgDt"))
                                    {
                                        dt.Columns.Add("FNP_RgDt");
                                    }

                                    if (!dt.Columns.Contains("FNP_LmDt"))
                                    {
                                        dt.Columns.Add("FNP_LmDt");
                                    }
                
                                    if (!dt.Columns.Contains("FNP_UptNo"))
                                    {
                                        dt.Columns.Add("FNP_UptNo");
开发者ID:huaminglee,项目名称:Code,代码行数:67,代码来源:GL_ERP_PayApply_EditByXML.cs

示例14: UpdateCMData

        private void UpdateCMData(Dbconn conn, DataTable dt_CMData)
        {
            //更新旧数据
            if (m_OldAutoId != "")
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("IsHistory");
                dt.Rows.Add(new object[] { "1" });
                conn.Update("CM_Depot_Opration_History", dt, "autoid =" + m_OldAutoId);
            }

            //插入新数据
            conn.Insert("CM_Depot_Opration_History", dt_CMData);
        }
开发者ID:huaminglee,项目名称:Code,代码行数:14,代码来源:CM_Depot_Opration_History.cs

示例15: GetData


//.........这里部分代码省略.........
                                DataTable dt_SR = conn.GetDataTable(strSQL, new string[1] { ds.Tables["LIST"].Rows[i]["WFT_AFDId"].ToString() });
                                //update
                                if (dt_SR.Rows.Count > 0)
                                {
                                    //处理结果
                                    if (ds.Tables["LIST"].Rows[i]["WFT_LmUser"].ToString() != "")
                                    {
                                        string strCode = dt_SR.Rows[0]["WFT_UptNo"].ToString();
                                        if (strCode == "0")
                                        {
                                            strCode = Convert.ToInt32(strCode) + 1.ToString();
                                        }
                                        else
                                        {
                                            strCode = "0";
                                        }

                                        if (!dt.Columns.Contains("WFT_LmDt"))
                                        {
                                            dt.Columns.Add("WFT_LmDt");
                                        }


                                        if (!dt.Columns.Contains("WFT_UptNo"))
                                        {
                                            dt.Columns.Add("WFT_UptNo");
                                        }


                                        dt.Rows[0]["WFT_LmDt"] = DateTime.Now;
                                        dt.Rows[0]["WFT_UptNo"] = strCode;
                                    }

                                    conn.Update("GL_ERP.M02_BPM.WFT_AuditFlowDefine", dt, "WFT_AFDId='" + ds.Tables["LIST"].Rows[i]["WFT_AFDId"].ToString() + @"'");


                                }

                                else  //add
                                {

                                    string WFT_AFDId = Guid.NewGuid().ToString();


                                    if (!dt.Columns.Contains("WFT_AFDId"))
                                    {
                                        dt.Columns.Add("WFT_AFDId");
                                    }


                                    if (!dt.Columns.Contains("WFT_RgDt"))
                                    {
                                        dt.Columns.Add("WFT_RgDt");
                                    }

                                    if (!dt.Columns.Contains("WFT_LmDt"))
                                    {
                                        dt.Columns.Add("WFT_LmDt");
                                    }

                                    if (!dt.Columns.Contains("WFT_UptNo"))
                                    {
                                        dt.Columns.Add("WFT_UptNo");
                                    }

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


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