public DefectiveHandleAdd(EditMode mode, DefectiveHandleVO item)
        {
            InitializeComponent();
            switch (mode)
            {
            case EditMode.Insert:
                currentMode        = mode;
                lblName.Text       = "불량처리유형등록";
                btnOK.Text         = "등록";
                panel_Modi.Visible = false;
                txtID.Text         = "0";
                pbxTitle.Image     = Properties.Resources.AddFile_32x32;
                break;

            case EditMode.Update:
                currentMode        = mode;
                lblName.Text       = "불량처리유형수정";
                btnOK.Text         = "수정";
                panel_Modi.Visible = true;
                txtExplain.Text    = item.HandleExplain;
                txtID.Text         = item.HandleID;
                txtName.Text       = item.HandleName;
                pbxTitle.Image     = Properties.Resources.Edit_32x32;
                break;

            default:
                break;
            }
            this.ActiveControl = txtName;
        }
Пример #2
0
 public override void Modify(object sender, EventArgs e)
 {
     if (dgvDefectiveHandle.SelectedRows.Count > 0)
     {
         DefectiveHandleVO vo = new DefectiveHandleVO {
             HandleID = dgvDefectiveHandle.SelectedRows[0].Cells[0].Value.ToString(), HandleName = dgvDefectiveHandle.SelectedRows[0].Cells[1].Value.ToString(), HandleExplain = dgvDefectiveHandle.SelectedRows[0].Cells[2].Value.ToString()
         };
         DefectiveHandleAdd dfrm = new DefectiveHandleAdd(DefectiveHandleAdd.EditMode.Update, vo);
         if (dfrm.ShowDialog() == DialogResult.OK)
         {
             RefreshClicked();
         }
     }
     else
     {
         frm.NoticeMessage = Resources.ModDefectiveHandleError;
     }
 }
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (txtExplain.Text.Trim().Length > 0 && txtName.Text.Trim().Length > 0)
     {
         try
         {
             DefectiveHandleVO vo = new DefectiveHandleVO {
                 HandleID = txtID.Text, HandleName = txtName.Text.Trim(), HandleExplain = txtExplain.Text.Trim()
             };
             DefectiveHandleService service = new DefectiveHandleService();
             if (service.UpdateDefectiveHandle(vo))
             {
                 if (vo.HandleID != "0")
                 {
                     MessageBox.Show(Resources.ModDone, Resources.ModDone, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show(Resources.AddDone, Resources.AddDone, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             else
             {
                 if (vo.HandleID != "0")
                 {
                     MessageBox.Show(Resources.ModError, Resources.ModError, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show(Resources.AddError, Resources.AddError, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         catch (Exception err)
         {
             Log.WriteError(err.Message, err);
         }
     }
     else
     {
         MessageBox.Show(Resources.isEssential, Resources.MsgBoxTitleWarn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #4
0
        /// <summary>
        /// 불량처리유형을 수정하는 메서드
        /// </summary>
        /// <param name="item">불량처리유형VO</param>
        /// <returns></returns>
        public bool UpdateDefectiveHandle(DefectiveHandleVO item)
        {
            try
            {
                string sql = "KJH_UpdateDefectiveHandle";

                using (SqlCommand cmd = new SqlCommand(sql, conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@HandleID", item.HandleID);
                    cmd.Parameters.AddWithValue("@HandleName", item.HandleName);
                    cmd.Parameters.AddWithValue("@HandleExplain", item.HandleExplain);
                    conn.Open();
                    int result = cmd.ExecuteNonQuery();
                    conn.Close();
                    return(result > 0);
                }
            }
            catch
            {
                throw;
            }
        }
Пример #5
0
        public bool UpdateDefectiveHandle(DefectiveHandleVO item)
        {
            DefectiveHandleDAC dac = new DefectiveHandleDAC();

            return(dac.UpdateDefectiveHandle(item));
        }