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


C# Dbconn.Insert方法代码示例

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


在下文中一共展示了Dbconn.Insert方法的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: 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

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

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


//.........这里部分代码省略.........
                                        {
                                            strCode = Convert.ToInt32(strCode) + 1.ToString();
                                        }
                                        else
                                        {
                                            strCode = "0";
                                        }

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

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

                                       // dt.Rows[0]["PD0_Status"] = '0';
                                        dt.Rows[0]["PD0_LmDt"] = DateTime.Now;
                                        dt.Rows[0]["PD0_UptNo"] = strCode;
                                    }

                                    conn.Update("B01_MDM.PD0_Product", dt, "PD0_ProductId='" + ds.Tables["LIST"].Rows[i]["PD0_ProductId"].ToString() + @"'");


                                }
                                else  //add
                                {


                                 //   string PD0_ProductId = Guid.NewGuid().ToString();


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

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

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

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

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


                                //    dt.Rows[0]["PD0_ProductId"] = PD0_ProductId;
                                  //  dt.Rows[0]["PD0_Status"] = '0';
                                    dt.Rows[0]["PD0_RgDt"] = DateTime.Now;
                                    dt.Rows[0]["PD0_LmDt"] = DateTime.Now;
                                    dt.Rows[0]["PD0_UptNo"] = '0';
                             
                                    conn.Insert("B01_MDM.PD0_Product", dt);

                          


                                }

                            }
                        }
                        conn.CommitTransaction();



                        ds_Return = Common.Common.GetRequestDataSet(new string[] { "Result" }, new string[] { "true" });
                    }
                    catch
                    {
                        conn.RollbackTransaction();
                        //事物结束
                        throw;
                    }
                }
                return ds_Return;
            }
            catch
            {
                throw;
            }

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

示例6: SetBMTypes

        /// <summary>
        /// 新建或修改预算科目类别记录
        /// </summary>
        /// <returns></returns>
        public DataSet SetBMTypes(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 == "NewBMType") //新建大小类
            { 
                conn.BeginTransaction();
                bResult = conn.Insert("M01_CONF.CT0_CSYTAB", dt_List);
                conn.CommitTransaction();
            } 
            else if (strType == "UpdBMType") //修改大小类
            {
                conn.BeginTransaction();
                bResult = conn.Update("M01_CONF.CT0_CSYTAB", dt_List, "ct1_id='" + strID + "'");
                conn.CommitTransaction();
            } 
             
            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,代码行数:45,代码来源:PE_OA_BaseData.cs

示例7: SaveRows

        /// <summary>
        /// 新建或修改记录
        /// </summary>
        /// <returns></returns>
        public DataSet SaveRows(Dbconn conn, String strType)
        {
            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);
            DataTable dtOptypes = dsXML.Tables["OPTYPE"];
            bool bResult = true;
            conn.BeginTransaction();
            for (int i = 0; i < dtOptypes.Rows.Count; i++)
            {
                //如果包含rowindex,就循环移除
                if (dsXML.Tables[i + 1].Columns.Contains("rowindex"))
                {
                    dsXML.Tables[i + 1].Columns.Remove("rowindex");
                }
                //如果子表解析出来的XML,类型有insert,做新增
                if (dtOptypes.Rows[i][0].ToString().ToUpper() == "INSERT")
                {
                    DataTable dt_List1 = dsXML.Tables[i + 1];
                    //如果包含bg3_lmdt,就循环移除
                    if (dt_List1.Columns.Contains("ct1_lmdt"))
                    {
                        dt_List1.Columns.Remove("ct1_lmdt");
                    }
                    bResult = conn.Insert("M01_CONF.CT0_CSYTAB", dt_List1);
                }
                //如果类型包含,update,解析成表,做update
                else if (dtOptypes.Rows[i][0].ToString().ToUpper() == "UPDATE")
                {
                    DataTable dt_List2 = dsXML.Tables[i + 1];
                    //添加更新主键,按照GUID更新
                    ArrayList ListKey = new ArrayList();
                    ListKey.Add("ct1_id");
                    bResult = conn.Update("M01_CONF.CT0_CSYTAB", dt_List2, ListKey);
                }
                //如果类型包含,DELETE,解析成表,做DELETE
                else if (dtOptypes.Rows[i][0].ToString().ToUpper() == "DELETE")
                {
                    DataTable dt_List3 = dsXML.Tables[i + 1];
                    for (int k = 0; k < dt_List3.Rows.Count; k++)
                    {
                        string strID1 = dt_List3.Rows[k]["ct1_id"].ToString();
                        bResult = conn.Delete("M01_CONF.CT0_CSYTAB", "ct1_id=" + "'" + strID1 + "'");
                    }
                }
            }
            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,代码行数:64,代码来源:PE_OA_BaseData.cs

示例8: GetData

        public DataSet GetData()
        {
            Dbconn conn = new Dbconn("WSRR");
            string strWhere = string.Empty;
            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 
                           [AUZID]
                          ,[AUZName]
                      FROM [WSRR_Manage].[F01_CERT].[AUZ]";
                    ds_Return = conn.GetDataSetForPageList(strSQL,m_hzyPageInfo);
                }
                //新增环境的权限名称
                else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "INSERT")
                {
                    //String Env_ID = dt_LIST.Rows[0]["Env_ID"].ToString();
                    String strAuzName = dt_LIST.Rows[0]["AuzName"].ToString();
                    string strsql = @"
                        SELECT COUNT(1) AS Cnt 
                        FROM  [WSRR_Manage].[F01_CERT].[AUZ] 
                        WHERE  Authorization_Name='" + strAuzName + "'";
                    DataTable dt = conn.GetDataTable(strsql);
                    if (int.Parse(dt.Rows[0][0].ToString()) > 0)
                    {
                        dt_EditResult.Rows.Add(new object[] { false, "权限:" + strAuzName + "已存在!" });
                    }
                    else
                    {
                        //dt_LIST.Rows[0]["AuzID"] = Guid.NewGuid().ToString();
                        conn.BeginTransaction();
                        bool flag = conn.Insert(" [WSRR_Manage].[F01_CERT].[AUZ]", dt_LIST);
                        conn.CommitTransaction();
                        if (flag)
                        {
                            dt_EditResult.Rows.Add(new object[] { true, "权限:" + strAuzName + "添加成功!" });
                        }
                        else
                        {
                            dt_EditResult.Rows.Add(new object[] { true, "权限:" + strAuzName + "添加失败!" });
                        }
                    }
                    ds_Return.Tables.Add(dt_EditResult);
                }
                //修改权限的菜单树
                else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "EDIT")
                {
                    String strAuZID = dt_LIST.Rows[0]["AuzID"].ToString();
                    strWhere = " AuzID=" + strAuZID;
                    dt_LIST.Columns.Remove("AuzID");//移除属性,标识符列(ID)不能更新
                    conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[AUZ]");
                    conn.BeginTransaction();
                    bool flag = conn.Update("[WSRR_Manage].[F01_CERT].[AUZ]", dt_LIST, strWhere);
                    conn.CommitTransaction();
                    if (flag)
                    {
                        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 strAuZID = dt_LIST.Rows[0]["AuzID"].ToString();
                    strWhere = " AuzID=" + strAuZID;
                    conn.BeginTransaction();
                    bool flag = conn.Delete("[WSRR_Manage].[F01_CERT].[AUZ]", strWhere);
                    conn.CommitTransaction();
                    if (flag)
                    {
                        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,代码行数:97,代码来源:Authority.cs

示例9: Execute

        /// <summary>
        /// 部署WS
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            Dbconn conn = new Dbconn("WSRR");
            Dbconn connDeploy = new Dbconn("WSRR_Deploy");

            try
            {
                if(m_request == null
                    || m_request.Tables.Count==0
                    || m_request.Tables[0].Rows.Count == 0)
                {
                    return true;
                }
                string strWS_ID = m_request.Tables[0].Rows[0]["WS_ID"].ToString();

                string strSQL = "";

                DataSet ds = conn.GetDataSet(@"
                            SELECT * FROM dbo.WS
                            WHERE [email protected];

                            SELECT * FROM dbo.WS_Param
                            WHERE [email protected]",new string[]{strWS_ID});

                if (ds.Tables.Count !=2 || ds.Tables[0].Rows.Count == 0)
                {
                    throw new Exception("WS_ID的信息不正确!");
                }
                string strENV =  ConfigurationManager.AppSettings["WSRR_ENV"];

                if (strENV.ToLower() == "prod")
                {
                    ds.Tables[0].Rows[0]["WS_Host"] = ds.Tables[0].Rows[0]["WS_Host_Test"].ToString();
                }
                else
                {
                    ds.Tables[0].Rows[0]["WS_Host"] = ds.Tables[0].Rows[0]["WS_Host_Prod"].ToString();
                }

                ArrayList tableList = new ArrayList();
                tableList.Add("WS");
                tableList.Add("WS_Param");
                connDeploy.BeginTransaction();
                connDeploy.TableLock(tableList);

                connDeploy.Delete("WS", "WS_ID='" + strWS_ID + "'");
                connDeploy.Delete("WS_Param", "WS_ID='" + strWS_ID + "'");

                connDeploy.Insert("WS", ds.Tables[0]);
                connDeploy.Insert("WS_Param", ds.Tables[1]);
                connDeploy.CommitTransaction();

                return true;
            }
            catch
            {
                conn.RollbackTransaction();
                throw;
            }



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

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

示例11: GetData


//.........这里部分代码省略.........
                                            {
                                                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");
                                    }


                                    dt.Rows[0]["FNP_PayApplyId"] = FNP_PayApplyId;
                                   // dt.Rows[0]["FNP_Status"] = '0';
                                    dt.Rows[0]["FNP_RgDt"] = DateTime.Now;
                                    dt.Rows[0]["FNP_LmDt"] = DateTime.Now;
                                    dt.Rows[0]["FNP_UptNo"] = '0';
                                    conn.Insert("B02_Bill.FNP_PayApply", dt);


                                    GL_ERP_Common.CreateWorkFlow(conn, "PayApply", ds.Tables["LIST"].Rows[i]["FNP_CONO"].ToString(), ds.Tables["LIST"].Rows[i]["FNP_DIVI"].ToString(), FNP_PayApplyId,
                                     "PayApply", "", "", ds.Tables["LIST"].Rows[i]["FNP_Status"].ToString(), ds.Tables["LIST"].Rows[i]["FNP_RgUser"].ToString(),
                                     ds.Tables["LIST"].Rows[i]["FNP_LmUser"].ToString(), "", "FNP_PayApplyId", "B02_Bill.FNP_PayApply");
          
                                }

                            }
                        }
                        conn.CommitTransaction();



                        ds_Return = Common.Common.GetRequestDataSet(new string[] { "Result" }, new string[] { "true" });
                    }
                    catch
                    {
                        conn.RollbackTransaction();
                        //事物结束
                        throw;
                    }
                }
                return ds_Return;
            }
            catch
            {
                throw;
            }

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

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

示例13: GetData


//.........这里部分代码省略.........
                                //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");
                                    }


                                    dt.Rows[0]["WFT_AFDId"] = WFT_AFDId;
                                    dt.Rows[0]["WFT_RgDt"] = DateTime.Now;
                                    dt.Rows[0]["WFT_LmDt"] = DateTime.Now;
                                    dt.Rows[0]["WFT_UptNo"] = '0';



                                    conn.Insert("GL_ERP.M02_BPM.WFT_AuditFlowDefine", dt);


                                }

                            }
                        }
                        conn.CommitTransaction();



                        ds_Return = Common.Common.GetRequestDataSet(new string[] { "Result" }, new string[] { "true" });
                    }
                    catch
                    {
                        conn.RollbackTransaction();
                        //事物结束
                        throw;
                    }
                }
                return ds_Return;
            }
            catch
            {
                throw;
            }

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

示例14: Execute

        /// <summary>
        /// 获取MDM应用的数据
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {



            DateTime dateStart = DateTime.Now;
            DateTime dateEnd = DateTime.Now;


            if (m_request != null && m_request.Tables.Count >0 &&  m_request.Tables[0].Rows.Count == 1)
            {
                if (m_request.Tables[0].Columns.Contains("dateStart"))
                {
                    dateStart = Convert.ToDateTime(m_request.Tables[0].Rows[0]["dateStart"]).AddDays(-1);
                }

                if (m_request.Tables[0].Columns.Contains("dateEnd"))
                {
                    dateEnd = Convert.ToDateTime(m_request.Tables[0].Rows[0]["dateEnd"]).AddDays(-1);
                }
            }



            DateTime currentDate = dateStart;
            Dbconn conn = new Dbconn("BI_CustomerFlow");

            DataTable dtLog = new DataTable();
            dtLog.Columns.Add("Execute_Date");
            dtLog.Columns.Add("Result");
            dtLog.Columns.Add("Message");
            dtLog.Columns.Add("Exception");

            while (currentDate <= dateEnd)
            {
                try
                {
                    dtLog.Clear();

                    //获取FTP的数据
                    GetFTPData(currentDate);
                    conn.LockTableList.Add("T_CustomerFlow");
                    conn.BeginTransaction();

                    conn.Delete("T_CustomerFlow", "Local_Date_and_Time between '" + currentDate.ToString("yyyy-MM-dd 00:00:00.000") + "' and '" + currentDate.ToString("yyyy-MM-dd 23:59:59.999") + "' ");
                    //插入数据
                    conn.InsertBYSQLBC("T_CustomerFlow", m_dtFTP);

                    dtLog.Rows.Add(new object[] { currentDate, true, "", "" });
                    conn.Insert("Log_GetFTPData", dtLog);
                    //throw new Exception("test");
                    conn.CommitTransaction();

                }
                catch (Exception ex)
                {
                    conn.RollbackTransaction();


                    try
                    {
                        dtLog.Rows.Add(new object[] { currentDate, false, ex.Message, ex.ToString() });
                        conn.BeginTransaction();
                        conn.Insert("Log_GetFTPData", dtLog);
                        conn.CommitTransaction();

                    }
                    catch (Exception ex1)
                    {


                    }

                    try
                    {
                        AMSendWS.MsgCenter cls = new AMSendWS.MsgCenter();
                        cls.SendMsg("AM", "BI客流数据获取", "马卫清", "信息部服务中心", "BI客流数据获取:执行日期:“" + currentDate.ToString("yyyy-MM-dd") + "”时发生错误:" + ex.ToString(), DateTime.Now.AddDays(-1).ToString());
                    }
                    catch (Exception ex2)
                    {


                    }
                }

                currentDate = currentDate.AddDays(1);
            }
            return true;

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

示例15: GetData


//.........这里部分代码省略.........

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

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

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





                                    dt.Rows[0]["PR1D_OrderDetailId"] = PR1D_OrderDetailId;
                                    dt.Rows[0]["PR1D_RgDt"] = DateTime.Now;
                                    dt.Rows[0]["PR1D_LmDt"] = DateTime.Now;
                                    dt.Rows[0]["PR1D_UptNo"] = '0';
                                    dt.Rows[0]["PR1D_CurrencyAmount"] = PR1D_CurrencyAmount;
                                    dt.Rows[0]["PR1D_PCurrencyPrice"] = PR1D_PCurrencyPrice;
                                    dt.Rows[0]["PR1D_OriginalAmount"] = PR1D_OriginalAmount;
                                    dt.Rows[0]["PR1D_EstimateCost"] = PR1D_EstimateCost;
                                    dt.Rows[0]["PR1D_SCurrencyPrice"] = PR1D_SCurrencyPrice;
                                    dt.Rows[0]["PR1D_POriginalPrice"] = PR1D_POriginalPrice;

                                    dt.Columns.Remove("PR1D_SupplierType");
                                    dt.Columns.Remove("PR1D_PD0_SKUSU");
                                    conn.Insert("B02_Bill.PR1D_OrderDetail", dt);



                                    strSQL = @"UPDATE AA SET AA.PR1_PurchaseTotal=BB.PR1_PurchaseTotal,
                                               AA.PR1_PurchaseAmount=BB.PR1_PurchaseAmount,AA.PR1_POriginalAmount=BB.PR1_POriginalAmount,
                                               AA.PR1_LmUser='" + ds.Tables["LIST"].Rows[i]["PR1D_LmUser"].ToString() + @"',
                                               AA.PR1_LmDt=CONVERT(VARCHAR(100),GETDATE(),121),
                                               AA.PR1_UptNo=AA.PR1_UptNo+1
                                               FROM 
                                               B02_Bill.PR1_Order AA, 
                                               (SELECT SUM(PR1D_Total) AS PR1_PurchaseTotal,SUM(PR1D_OriginalAmount) AS PR1_POriginalAmount,
                                                SUM(PR1D_EstimateCost) AS PR1D_EstimateCost,SUM(PR1D_CurrencyAmount) AS PR1_PurchaseAmount,PR1D_PR1_OrderId
                                                FROM B02_Bill.PR1D_OrderDetail WHERE PR1D_PR1_OrderId='" + ds.Tables["LIST"].Rows[i]["PR1D_PR1_OrderId"].ToString() + @"'
                                                AND isnull(PR1D_Status,'')<>'E3CA9B7A-8E17-4E52-B667-39689445D4A1'                                         
                                                GROUP BY PR1D_PR1_OrderId)BB
                                                WHERE AA.PR1_OrderId=BB.PR1D_PR1_OrderId";

                                    conn.ExcuteQuerryByTran(strSQL);

                                    strSQL1 = @"UPDATE B01_MDM.PD0_Product SET PD0_PurchasePrice='" + PR1D_CurrencyAmount + @"',
                                               PD0_SalePrice='" + PR1D_SCurrencyPrice + @"',
                                               PD0_LmUser='" + ds.Tables["LIST"].Rows[i]["PR1D_LmUser"].ToString() + @"',
                                               PD0_LmDt=CONVERT(VARCHAR(100),GETDATE(),121),
                                               PD0_UptNo=PD0_UptNo+1
                                               WHERE PD0_ProductId='" + ds.Tables["LIST"].Rows[i]["PR1D_PD0_ProductId"].ToString() + @"'                "
                                               ;
                                    conn.ExcuteQuerryByTran(strSQL1);


                                    strSQL1 = @"UPDATE  A  SET A.PR0_Amount=B.PR1_POriginalAmount,A.PR0_Total=PR1_PurchaseTotal
                                                FROM B02_Bill.PR0_Contract A,
                                                    (select SUM(PR1_POriginalAmount) as   PR1_POriginalAmount,PR1_PR0_ContractId,SUM(PR1_PurchaseTotal) as   PR1_PurchaseTotal 
开发者ID:huaminglee,项目名称:Code,代码行数:67,代码来源:GL_ERP_OrderDetail_EditByXML.cs


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