Пример #1
0
 /// <summary>
 /// 由申请单进行初始化
 /// </summary>
 /// <param name="_Maintain"></param>
 public frm_Equipment_Maintenance(Maticsoft.Model.Equipment_Maintain _Maintain)
 {
     InitializeComponent();
     cmb_ResultCode.ItemsSource = MCP_CS._M_Equipment_TypeList.GetStringList("Type = 'Ma_验收结果'");
     btn_Apply.IsEnabled        = false;
     Maintain = _Maintain;
     grd_Maintain.DataContext = Maintain;
 }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public decimal Add(Maticsoft.Model.Equipment_Maintain model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_Equipment_Maintain(");
            strSql.Append("FormNum,Ass_Num,Ass_Name,Ass_MakeNum,Ass_Type,Apply_Date,Apply_Describe,Apply_User,Maintain_Cause,Maintain_Describe,maintain_User,Maintain_Date,Check_Deseribe,Check_Result,Check_Date,Check_User,Remarks)");
            strSql.Append(" values (");
            strSql.Append("@FormNum,@Ass_Num,@Ass_Name,@Ass_MakeNum,@Ass_Type,@Apply_Date,@Apply_Describe,@Apply_User,@Maintain_Cause,@Maintain_Describe,@maintain_User,@Maintain_Date,@Check_Deseribe,@Check_Result,@Check_Date,@Check_User,@Remarks)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FormNum",           SqlDbType.VarChar, 50),
                new SqlParameter("@Ass_Num",           SqlDbType.VarChar, 50),
                new SqlParameter("@Ass_Name",          SqlDbType.VarChar, 50),
                new SqlParameter("@Ass_MakeNum",       SqlDbType.VarChar, 50),
                new SqlParameter("@Ass_Type",          SqlDbType.VarChar, 50),
                new SqlParameter("@Apply_Date",        SqlDbType.VarChar, 50),
                new SqlParameter("@Apply_Describe",    SqlDbType.Text),
                new SqlParameter("@Apply_User",        SqlDbType.VarChar, 50),
                new SqlParameter("@Maintain_Cause",    SqlDbType.Text),
                new SqlParameter("@Maintain_Describe", SqlDbType.Text),
                new SqlParameter("@maintain_User",     SqlDbType.VarChar, 50),
                new SqlParameter("@Maintain_Date",     SqlDbType.VarChar, 50),
                new SqlParameter("@Check_Deseribe",    SqlDbType.Text),
                new SqlParameter("@Check_Result",      SqlDbType.VarChar, 50),
                new SqlParameter("@Check_Date",        SqlDbType.VarChar, 50),
                new SqlParameter("@Check_User",        SqlDbType.VarChar, 50),
                new SqlParameter("@Remarks",           SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.FormNum;
            parameters[1].Value  = model.Ass_Num;
            parameters[2].Value  = model.Ass_Name;
            parameters[3].Value  = model.Ass_MakeNum;
            parameters[4].Value  = model.Ass_Type;
            parameters[5].Value  = model.Apply_Date;
            parameters[6].Value  = model.Apply_Describe;
            parameters[7].Value  = model.Apply_User;
            parameters[8].Value  = model.Maintain_Cause;
            parameters[9].Value  = model.Maintain_Describe;
            parameters[10].Value = model.maintain_User;
            parameters[11].Value = model.Maintain_Date;
            parameters[12].Value = model.Check_Deseribe;
            parameters[13].Value = model.Check_Result;
            parameters[14].Value = model.Check_Date;
            parameters[15].Value = model.Check_User;
            parameters[16].Value = model.Remarks;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(obj));
            }
        }
Пример #3
0
 //
 //选择维修记录
 //
 private void dgv_Maintain_MouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (dgv_Maintain.SelectedItem != null)
         {
             Maticsoft.Model.Equipment_Maintain _tem = (Maticsoft.Model.Equipment_Maintain)dgv_Maintain.SelectedItem;
             frm_Equipment_Maintenance          f    = new frm_Equipment_Maintenance(_tem);
             f.Show();
         }
     }
     catch { }
 }
Пример #4
0
 private void ShowInfo(decimal Mat_ID)
 {
     Maticsoft.BLL.Equipment_Maintain   bll   = new Maticsoft.BLL.Equipment_Maintain();
     Maticsoft.Model.Equipment_Maintain model = bll.GetModel(Mat_ID);
     this.lblMat_ID.Text            = model.Mat_ID.ToString();
     this.txtFormNum.Text           = model.FormNum;
     this.txtAss_Num.Text           = model.Ass_Num;
     this.txtAss_Name.Text          = model.Ass_Name;
     this.txtAss_MakeNum.Text       = model.Ass_MakeNum;
     this.txtAss_Type.Text          = model.Ass_Type;
     this.txtApply_Date.Text        = model.Apply_Date;
     this.txtApply_Describe.Text    = model.Apply_Describe;
     this.txtApply_User.Text        = model.Apply_User;
     this.txtMaintain_Cause.Text    = model.Maintain_Cause;
     this.txtMaintain_Describe.Text = model.Maintain_Describe;
     this.txtmaintain_User.Text     = model.maintain_User;
     this.txtMaintain_Date.Text     = model.Maintain_Date;
     this.txtCheck_Deseribe.Text    = model.Check_Deseribe;
     this.txtCheck_Result.Text      = model.Check_Result;
     this.txtCheck_Date.Text        = model.Check_Date;
     this.txtCheck_User.Text        = model.Check_User;
     this.txtRemarks.Text           = model.Remarks;
 }
Пример #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Equipment_Maintain GetModel(decimal Mat_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Mat_ID,FormNum,Ass_Num,Ass_Name,Ass_MakeNum,Ass_Type,Apply_Date,Apply_Describe,Apply_User,Maintain_Cause,Maintain_Describe,maintain_User,Maintain_Date,Check_Deseribe,Check_Result,Check_Date,Check_User,Remarks from tb_Equipment_Maintain ");
            strSql.Append(" where Mat_ID=@Mat_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Mat_ID", SqlDbType.Decimal)
            };
            parameters[0].Value = Mat_ID;

            Maticsoft.Model.Equipment_Maintain model = new Maticsoft.Model.Equipment_Maintain();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Equipment_Maintain DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Equipment_Maintain model = new Maticsoft.Model.Equipment_Maintain();
     if (row != null)
     {
         if (row["Mat_ID"] != null && row["Mat_ID"].ToString() != "")
         {
             model.Mat_ID = decimal.Parse(row["Mat_ID"].ToString());
         }
         if (row["FormNum"] != null)
         {
             model.FormNum = row["FormNum"].ToString();
         }
         if (row["Ass_Num"] != null)
         {
             model.Ass_Num = row["Ass_Num"].ToString();
         }
         if (row["Ass_Name"] != null)
         {
             model.Ass_Name = row["Ass_Name"].ToString();
         }
         if (row["Ass_MakeNum"] != null)
         {
             model.Ass_MakeNum = row["Ass_MakeNum"].ToString();
         }
         if (row["Ass_Type"] != null)
         {
             model.Ass_Type = row["Ass_Type"].ToString();
         }
         if (row["Apply_Date"] != null)
         {
             model.Apply_Date = row["Apply_Date"].ToString();
         }
         if (row["Apply_Describe"] != null)
         {
             model.Apply_Describe = row["Apply_Describe"].ToString();
         }
         if (row["Apply_User"] != null)
         {
             model.Apply_User = row["Apply_User"].ToString();
         }
         if (row["Maintain_Cause"] != null)
         {
             model.Maintain_Cause = row["Maintain_Cause"].ToString();
         }
         if (row["Maintain_Describe"] != null)
         {
             model.Maintain_Describe = row["Maintain_Describe"].ToString();
         }
         if (row["maintain_User"] != null)
         {
             model.maintain_User = row["maintain_User"].ToString();
         }
         if (row["Maintain_Date"] != null)
         {
             model.Maintain_Date = row["Maintain_Date"].ToString();
         }
         if (row["Check_Deseribe"] != null)
         {
             model.Check_Deseribe = row["Check_Deseribe"].ToString();
         }
         if (row["Check_Result"] != null)
         {
             model.Check_Result = row["Check_Result"].ToString();
         }
         if (row["Check_Date"] != null)
         {
             model.Check_Date = row["Check_Date"].ToString();
         }
         if (row["Check_User"] != null)
         {
             model.Check_User = row["Check_User"].ToString();
         }
         if (row["Remarks"] != null)
         {
             model.Remarks = row["Remarks"].ToString();
         }
     }
     return(model);
 }
Пример #7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Equipment_Maintain model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_Equipment_Maintain set ");
            strSql.Append("FormNum=@FormNum,");
            strSql.Append("Ass_Num=@Ass_Num,");
            strSql.Append("Ass_Name=@Ass_Name,");
            strSql.Append("Ass_MakeNum=@Ass_MakeNum,");
            strSql.Append("Ass_Type=@Ass_Type,");
            strSql.Append("Apply_Date=@Apply_Date,");
            strSql.Append("Apply_Describe=@Apply_Describe,");
            strSql.Append("Apply_User=@Apply_User,");
            strSql.Append("Maintain_Cause=@Maintain_Cause,");
            strSql.Append("Maintain_Describe=@Maintain_Describe,");
            strSql.Append("maintain_User=@maintain_User,");
            strSql.Append("Maintain_Date=@Maintain_Date,");
            strSql.Append("Check_Deseribe=@Check_Deseribe,");
            strSql.Append("Check_Result=@Check_Result,");
            strSql.Append("Check_Date=@Check_Date,");
            strSql.Append("Check_User=@Check_User,");
            strSql.Append("Remarks=@Remarks");
            strSql.Append(" where Mat_ID=@Mat_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FormNum",           SqlDbType.VarChar, 50),
                new SqlParameter("@Ass_Num",           SqlDbType.VarChar, 50),
                new SqlParameter("@Ass_Name",          SqlDbType.VarChar, 50),
                new SqlParameter("@Ass_MakeNum",       SqlDbType.VarChar, 50),
                new SqlParameter("@Ass_Type",          SqlDbType.VarChar, 50),
                new SqlParameter("@Apply_Date",        SqlDbType.VarChar, 50),
                new SqlParameter("@Apply_Describe",    SqlDbType.Text),
                new SqlParameter("@Apply_User",        SqlDbType.VarChar, 50),
                new SqlParameter("@Maintain_Cause",    SqlDbType.Text),
                new SqlParameter("@Maintain_Describe", SqlDbType.Text),
                new SqlParameter("@maintain_User",     SqlDbType.VarChar, 50),
                new SqlParameter("@Maintain_Date",     SqlDbType.VarChar, 50),
                new SqlParameter("@Check_Deseribe",    SqlDbType.Text),
                new SqlParameter("@Check_Result",      SqlDbType.VarChar, 50),
                new SqlParameter("@Check_Date",        SqlDbType.VarChar, 50),
                new SqlParameter("@Check_User",        SqlDbType.VarChar, 50),
                new SqlParameter("@Remarks",           SqlDbType.VarChar, 50),
                new SqlParameter("@Mat_ID",            SqlDbType.Decimal, 9)
            };
            parameters[0].Value  = model.FormNum;
            parameters[1].Value  = model.Ass_Num;
            parameters[2].Value  = model.Ass_Name;
            parameters[3].Value  = model.Ass_MakeNum;
            parameters[4].Value  = model.Ass_Type;
            parameters[5].Value  = model.Apply_Date;
            parameters[6].Value  = model.Apply_Describe;
            parameters[7].Value  = model.Apply_User;
            parameters[8].Value  = model.Maintain_Cause;
            parameters[9].Value  = model.Maintain_Describe;
            parameters[10].Value = model.maintain_User;
            parameters[11].Value = model.Maintain_Date;
            parameters[12].Value = model.Check_Deseribe;
            parameters[13].Value = model.Check_Result;
            parameters[14].Value = model.Check_Date;
            parameters[15].Value = model.Check_User;
            parameters[16].Value = model.Remarks;
            parameters[17].Value = model.Mat_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #8
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtFormNum.Text.Trim().Length == 0)
            {
                strErr += "FormNum不能为空!\\n";
            }
            if (this.txtAss_Num.Text.Trim().Length == 0)
            {
                strErr += "Ass_Num不能为空!\\n";
            }
            if (this.txtAss_Name.Text.Trim().Length == 0)
            {
                strErr += "Ass_Name不能为空!\\n";
            }
            if (this.txtAss_MakeNum.Text.Trim().Length == 0)
            {
                strErr += "Ass_MakeNum不能为空!\\n";
            }
            if (this.txtAss_Type.Text.Trim().Length == 0)
            {
                strErr += "Ass_Type不能为空!\\n";
            }
            if (this.txtApply_Date.Text.Trim().Length == 0)
            {
                strErr += "Apply_Date不能为空!\\n";
            }
            if (this.txtApply_Describe.Text.Trim().Length == 0)
            {
                strErr += "Apply_Describe不能为空!\\n";
            }
            if (this.txtApply_User.Text.Trim().Length == 0)
            {
                strErr += "Apply_User不能为空!\\n";
            }
            if (this.txtMaintain_Cause.Text.Trim().Length == 0)
            {
                strErr += "Maintain_Cause不能为空!\\n";
            }
            if (this.txtMaintain_Describe.Text.Trim().Length == 0)
            {
                strErr += "Maintain_Describe不能为空!\\n";
            }
            if (this.txtmaintain_User.Text.Trim().Length == 0)
            {
                strErr += "maintain_User不能为空!\\n";
            }
            if (this.txtMaintain_Date.Text.Trim().Length == 0)
            {
                strErr += "Maintain_Date不能为空!\\n";
            }
            if (this.txtCheck_Deseribe.Text.Trim().Length == 0)
            {
                strErr += "Check_Deseribe不能为空!\\n";
            }
            if (this.txtCheck_Result.Text.Trim().Length == 0)
            {
                strErr += "Check_Result不能为空!\\n";
            }
            if (this.txtCheck_Date.Text.Trim().Length == 0)
            {
                strErr += "Check_Date不能为空!\\n";
            }
            if (this.txtCheck_User.Text.Trim().Length == 0)
            {
                strErr += "Check_User不能为空!\\n";
            }
            if (this.txtRemarks.Text.Trim().Length == 0)
            {
                strErr += "Remarks不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            decimal Mat_ID            = decimal.Parse(this.lblMat_ID.Text);
            string  FormNum           = this.txtFormNum.Text;
            string  Ass_Num           = this.txtAss_Num.Text;
            string  Ass_Name          = this.txtAss_Name.Text;
            string  Ass_MakeNum       = this.txtAss_MakeNum.Text;
            string  Ass_Type          = this.txtAss_Type.Text;
            string  Apply_Date        = this.txtApply_Date.Text;
            string  Apply_Describe    = this.txtApply_Describe.Text;
            string  Apply_User        = this.txtApply_User.Text;
            string  Maintain_Cause    = this.txtMaintain_Cause.Text;
            string  Maintain_Describe = this.txtMaintain_Describe.Text;
            string  maintain_User     = this.txtmaintain_User.Text;
            string  Maintain_Date     = this.txtMaintain_Date.Text;
            string  Check_Deseribe    = this.txtCheck_Deseribe.Text;
            string  Check_Result      = this.txtCheck_Result.Text;
            string  Check_Date        = this.txtCheck_Date.Text;
            string  Check_User        = this.txtCheck_User.Text;
            string  Remarks           = this.txtRemarks.Text;


            Maticsoft.Model.Equipment_Maintain model = new Maticsoft.Model.Equipment_Maintain();
            model.Mat_ID            = Mat_ID;
            model.FormNum           = FormNum;
            model.Ass_Num           = Ass_Num;
            model.Ass_Name          = Ass_Name;
            model.Ass_MakeNum       = Ass_MakeNum;
            model.Ass_Type          = Ass_Type;
            model.Apply_Date        = Apply_Date;
            model.Apply_Describe    = Apply_Describe;
            model.Apply_User        = Apply_User;
            model.Maintain_Cause    = Maintain_Cause;
            model.Maintain_Describe = Maintain_Describe;
            model.maintain_User     = maintain_User;
            model.Maintain_Date     = Maintain_Date;
            model.Check_Deseribe    = Check_Deseribe;
            model.Check_Result      = Check_Result;
            model.Check_Date        = Check_Date;
            model.Check_User        = Check_User;
            model.Remarks           = Remarks;

            Maticsoft.BLL.Equipment_Maintain bll = new Maticsoft.BLL.Equipment_Maintain();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }