/// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TPP_TURNAROUND_PLAN model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TPP_TURNAROUND_PLAN(");
            strSql.Append("C_STA_ID,D_START_TIME,D_END_TIME,C_PLAN_TYPE,C_REMARK,N_STATUS,C_EMP_ID,C_SH_EMP_ID,D_SH_MOD_DT,C_TYPE,C_STA_CODE,C_PRO_CODE,N_TIEM)");
            strSql.Append(" values (");
            strSql.Append(":C_STA_ID,:D_START_TIME,:D_END_TIME,:C_PLAN_TYPE,:C_REMARK,:N_STATUS,:C_EMP_ID,:C_SH_EMP_ID,:D_SH_MOD_DT,:C_TYPE,:C_STA_CODE,:C_PRO_CODE,:N_TIEM)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STA_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":D_START_TIME", OracleDbType.Date),
                new OracleParameter(":D_END_TIME",   OracleDbType.Date),
                new OracleParameter(":C_PLAN_TYPE",  OracleDbType.Varchar2, 100),
                new OracleParameter(":C_REMARK",     OracleDbType.Varchar2, 500),
                new OracleParameter(":N_STATUS",     OracleDbType.Int16,      4),
                new OracleParameter(":C_EMP_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SH_EMP_ID",  OracleDbType.Varchar2, 100),
                new OracleParameter(":D_SH_MOD_DT",  OracleDbType.Date),
                new OracleParameter(":C_TYPE",       OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_CODE",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PRO_CODE",   OracleDbType.Varchar2, 100),
                new OracleParameter(":N_TIEM",       OracleDbType.Int16, 5)
            };
            parameters[0].Value  = model.C_STA_ID;
            parameters[1].Value  = model.D_START_TIME;
            parameters[2].Value  = model.D_END_TIME;
            parameters[3].Value  = model.C_PLAN_TYPE;
            parameters[4].Value  = model.C_REMARK;
            parameters[5].Value  = model.N_STATUS;
            parameters[6].Value  = model.C_EMP_ID;
            parameters[7].Value  = model.C_SH_EMP_ID;
            parameters[8].Value  = model.D_SH_MOD_DT;
            parameters[9].Value  = model.C_TYPE;
            parameters[10].Value = model.C_STA_CODE;
            parameters[11].Value = model.C_PRO_CODE;
            parameters[12].Value = model.N_TIEM;

            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        private void btn_sh_Click(object sender, EventArgs e)
        {
            try
            {
                if (DialogResult.No == MessageBox.Show("是否确认审核?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
                {
                    return;
                }

                int   selectedNum = this.gv_jxjh.SelectedRowsCount;
                int   commitNum   = 0;                              //审核记录数量
                int   failtNum    = 0;                              //审核失败数量
                int[] rownumber   = this.gv_jxjh.GetSelectedRows(); //获取选中行号数组;
                for (int i = 0; i < rownumber.Length; i++)
                {
                    int    selectedHandle = rownumber[i];
                    string strID          = this.gv_jxjh.GetRowCellValue(selectedHandle, "C_ID").ToString();

                    Mod_TPP_TURNAROUND_PLAN model = blljxjh.GetModel(strID);
                    model.N_STATUS    = 2;
                    model.C_SH_EMP_ID = RV.UI.UserInfo.userName;
                    model.D_SH_MOD_DT = RV.UI.ServerTime.timeNow();
                    bool update = blljxjh.Update(model);
                    if (update)
                    {
                        commitNum = commitNum + 1;
                    }
                    else
                    {
                        failtNum = failtNum + 1;
                    }
                }
                MessageBox.Show("选择" + selectedNum.ToString() + "条记录,审核" + commitNum.ToString() + "条记录!");

                Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "审核检修计划");//添加操作日志
                BindInfo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #3
0
        /// <summary>
        /// 保存信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_SaveDetails_Click(object sender, EventArgs e)
        {
            try
            {
                #region 验证信息
                if (txt_remark.Text.Trim() != "")
                {
                    MessageBox.Show("备注不能为空!");
                    return;
                }

                #endregion
                bool res = false;
                if (DialogResult.No == MessageBox.Show("是否确认保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
                {
                    return;
                }
                Mod_TPP_TURNAROUND_PLAN model = new Mod_TPP_TURNAROUND_PLAN();
                model.C_STA_CODE = stacode;
                Mod_TB_STA mod = bllSta.GetModelByCODE(stacode);
                if (mod != null)
                {
                    model.C_STA_ID = mod.C_ID;
                }
                model.D_START_TIME = Convert.ToDateTime(this.dt_jx_from_time.Text);
                model.D_END_TIME   = Convert.ToDateTime(this.dt_jx_end_time.Text);
                model.C_PLAN_TYPE  = this.cbo_jxlb.Text;
                model.C_REMARK     = txt_remark.Text;
                model.C_EMP_ID     = RV.UI.UserInfo.userID;
                res = blljxjh.Add(model);
                Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加轧线检修计划");//添加操作日志
                if (res)
                {
                    MessageBox.Show("操作成功!");
                    BindInfo();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPP_TURNAROUND_PLAN GetModel(string C_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select C_ID,C_STA_ID,D_START_TIME,D_END_TIME,C_PLAN_TYPE,C_REMARK,N_STATUS,C_EMP_ID,D_MOD_DT,C_SH_EMP_ID,D_SH_MOD_DT,C_TYPE,C_STA_CODE,C_PRO_CODE,N_TIEM from TPP_TURNAROUND_PLAN ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_ID;

            Mod_TPP_TURNAROUND_PLAN model = new Mod_TPP_TURNAROUND_PLAN();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TPP_TURNAROUND_PLAN model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TPP_TURNAROUND_PLAN set ");
            strSql.Append("C_STA_ID=:C_STA_ID,");
            strSql.Append("D_START_TIME=:D_START_TIME,");
            strSql.Append("D_END_TIME=:D_END_TIME,");
            strSql.Append("C_PLAN_TYPE=:C_PLAN_TYPE,");
            strSql.Append("C_REMARK=:C_REMARK,");
            strSql.Append("N_STATUS=:N_STATUS,");
            strSql.Append("C_EMP_ID=:C_EMP_ID,");
            strSql.Append("D_MOD_DT=:D_MOD_DT,");
            strSql.Append("C_SH_EMP_ID=:C_SH_EMP_ID,");
            strSql.Append("D_SH_MOD_DT=:D_SH_MOD_DT,");
            strSql.Append("C_TYPE=:C_TYPE,");
            strSql.Append("C_STA_CODE=:C_STA_CODE,");
            strSql.Append("C_PRO_CODE=:C_PRO_CODE,");
            strSql.Append("N_TIEM=:N_TIEM");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STA_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":D_START_TIME", OracleDbType.Date),
                new OracleParameter(":D_END_TIME",   OracleDbType.Date),
                new OracleParameter(":C_PLAN_TYPE",  OracleDbType.Varchar2, 100),
                new OracleParameter(":C_REMARK",     OracleDbType.Varchar2, 500),
                new OracleParameter(":N_STATUS",     OracleDbType.Int16,      4),
                new OracleParameter(":C_EMP_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",     OracleDbType.Date),
                new OracleParameter(":C_SH_EMP_ID",  OracleDbType.Varchar2, 100),
                new OracleParameter(":D_SH_MOD_DT",  OracleDbType.Date),
                new OracleParameter(":C_TYPE",       OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_CODE",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PRO_CODE",   OracleDbType.Varchar2, 100),
                new OracleParameter(":N_TIEM",       OracleDbType.Int16,      5),
                new OracleParameter(":C_ID",         OracleDbType.Varchar2, 100)
            };
            parameters[0].Value  = model.C_STA_ID;
            parameters[1].Value  = model.D_START_TIME;
            parameters[2].Value  = model.D_END_TIME;
            parameters[3].Value  = model.C_PLAN_TYPE;
            parameters[4].Value  = model.C_REMARK;
            parameters[5].Value  = model.N_STATUS;
            parameters[6].Value  = model.C_EMP_ID;
            parameters[7].Value  = model.D_MOD_DT;
            parameters[8].Value  = model.C_SH_EMP_ID;
            parameters[9].Value  = model.D_SH_MOD_DT;
            parameters[10].Value = model.C_TYPE;
            parameters[11].Value = model.C_STA_CODE;
            parameters[12].Value = model.C_PRO_CODE;
            parameters[13].Value = model.N_TIEM;
            parameters[14].Value = model.C_ID;

            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPP_TURNAROUND_PLAN DataRowToModel(DataRow row)
        {
            Mod_TPP_TURNAROUND_PLAN model = new Mod_TPP_TURNAROUND_PLAN();

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_STA_ID"] != null)
                {
                    model.C_STA_ID = row["C_STA_ID"].ToString();
                }
                if (row["D_START_TIME"] != null && row["D_START_TIME"].ToString() != "")
                {
                    model.D_START_TIME = DateTime.Parse(row["D_START_TIME"].ToString());
                }
                if (row["D_END_TIME"] != null && row["D_END_TIME"].ToString() != "")
                {
                    model.D_END_TIME = DateTime.Parse(row["D_END_TIME"].ToString());
                }
                if (row["C_PLAN_TYPE"] != null)
                {
                    model.C_PLAN_TYPE = row["C_PLAN_TYPE"].ToString();
                }
                if (row["C_REMARK"] != null)
                {
                    model.C_REMARK = row["C_REMARK"].ToString();
                }
                if (row["N_STATUS"] != null && row["N_STATUS"].ToString() != "")
                {
                    model.N_STATUS = decimal.Parse(row["N_STATUS"].ToString());
                }
                if (row["C_EMP_ID"] != null)
                {
                    model.C_EMP_ID = row["C_EMP_ID"].ToString();
                }
                if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "")
                {
                    model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString());
                }
                if (row["C_SH_EMP_ID"] != null)
                {
                    model.C_SH_EMP_ID = row["C_SH_EMP_ID"].ToString();
                }
                if (row["D_SH_MOD_DT"] != null && row["D_SH_MOD_DT"].ToString() != "")
                {
                    model.D_SH_MOD_DT = DateTime.Parse(row["D_SH_MOD_DT"].ToString());
                }
                if (row["C_TYPE"] != null)
                {
                    model.C_TYPE = row["C_TYPE"].ToString();
                }
                if (row["C_STA_CODE"] != null)
                {
                    model.C_STA_CODE = row["C_STA_CODE"].ToString();
                }
                if (row["C_PRO_CODE"] != null)
                {
                    model.C_PRO_CODE = row["C_PRO_CODE"].ToString();
                }
                if (row["N_TIEM"] != null && row["N_TIEM"].ToString() != "")
                {
                    model.N_TIEM = decimal.Parse(row["N_TIEM"].ToString());
                }
            }
            return(model);
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TPP_TURNAROUND_PLAN model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TPP_TURNAROUND_PLAN model)
 {
     return(dal.Add(model));
 }