public DefectiveTypePopupForm(string employee, bool IsUpdate, DefectiveTypeVO vo)
 {
     InitializeComponent();
     this.IsUpdate = IsUpdate;
     this.vo       = vo;
     this.employee = employee;
 }
        public DefectiveTypeAdd(EditMode mode, DefectiveTypeVO 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.DefecExplain;
                txtID.Text         = item.DefecID;
                txtName.Text       = item.DefecName;
                pbxTitle.Image     = Properties.Resources.Edit_32x32;
                break;

            default:
                break;
            }
            this.ActiveControl = txtName;
        }
Пример #3
0
        private void OpenPopup(bool IsUpdate, DefectiveTypeVO vo = null)
        {
            DefectiveTypePopupForm frm = new DefectiveTypePopupForm(emp.Employee_name, IsUpdate, vo);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                ReviewDGV();
            }
        }
Пример #4
0
        private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            // VO를 보내줘야 함, 수정할 것

            DefectiveTypeVO updateVO = new DefectiveTypeVO
            {
                Defective_Type_ID   = dgv[1, e.RowIndex].Value.ToInt(),
                Defective_Type_Use  = dgv[3, e.RowIndex].Value.ToString(),
                Defective_Type_Name = dgv[2, e.RowIndex].Value.ToString(),
                Defective_Type_Seq  = dgv[4, e.RowIndex].Value.ToInt()
            };

            OpenPopup(true, updateVO);
        }
Пример #5
0
 public override void Modify(object sender, EventArgs e)
 {
     if (dgvDefectiveType.SelectedRows.Count > 0)
     {
         DefectiveTypeVO vo = new DefectiveTypeVO {
             DefecID = dgvDefectiveType.SelectedRows[0].Cells[0].Value.ToString(), DefecName = dgvDefectiveType.SelectedRows[0].Cells[1].Value.ToString(), DefecExplain = dgvDefectiveType.SelectedRows[0].Cells[2].Value.ToString()
         };
         DefectiveTypeAdd dfrm = new DefectiveTypeAdd(DefectiveTypeAdd.EditMode.Update, vo);
         if (dfrm.ShowDialog() == DialogResult.OK)
         {
             RefreshClicked();
         }
     }
     else
     {
         frm.NoticeMessage = Resources.ModDefectiveTypeError;
     }
 }
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (txtExplain.Text.Trim().Length > 0 && txtName.Text.Trim().Length > 0)
     {
         try
         {
             DefectiveTypeVO vo = new DefectiveTypeVO {
                 DefecID = txtID.Text, DefecName = txtName.Text.Trim(), DefecExplain = txtExplain.Text.Trim()
             };
             DefectiveTypeService service = new DefectiveTypeService();
             if (service.UpdateDefectiveType(vo))
             {
                 if (vo.DefecID != "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.DefecID != "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);
     }
 }
Пример #7
0
        public bool DefectiveTypeUpsert(DefectiveTypeVO typeVO)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(this.ConnectionString))
                {
                    conn.Open();

                    string sql = @"SP_DEFECTIVE_TYPE_UPSERT";

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

                        cmd.Parameters.AddWithValue("@P_Num", typeVO.Defective_Type_ID);
                        cmd.Parameters.AddWithValue("@P_Type_Name", typeVO.Defective_Type_Name);
                        cmd.Parameters.AddWithValue("@P_Type_Use", typeVO.Defective_Type_Use);
                        cmd.Parameters.AddWithValue("@P_Regist_Time", typeVO.Final_Regist_Time);
                        cmd.Parameters.AddWithValue("@P_Regist_Employee", typeVO.Final_Regist_Employee);
                        cmd.Parameters.AddWithValue("@P_CATEGORY", typeVO.P_Category);
                        cmd.Parameters.AddWithValue("@P_SEQ", typeVO.Defective_Type_Seq);

                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return(true);
                        }

                        else
                        {
                            return(false);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        private void DefectiveUpsertMethod(string UseCheck, string Status, char Category, int DefectiveID)
        {
            if (MessageBox.Show($"불량 유형을 {Status}하시겠습니까?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                DefectiveTypeVO typeVO = new DefectiveTypeVO
                {
                    Defective_Type_ID     = DefectiveID,
                    Defective_Type_Name   = txtDefectiveString.Text,
                    Defective_Type_Use    = UseCheck,
                    Final_Regist_Time     = DateTime.Now,
                    Final_Regist_Employee = employee,
                    P_Category            = Category,
                    Defective_Type_Seq    = numericUpDown1.Value.ToInt()
                };

                if (service.DefectiveTypeUpsert(typeVO))
                {
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
        }
        /// <summary>
        /// 불량유형 신규 또는 수정 메서드
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool UpdateDefectiveType(DefectiveTypeVO item)
        {
            try
            {
                string sql = "KJH_UpdateDefectiveType";

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

                    cmd.Parameters.AddWithValue("@DefecID", item.DefecID);
                    cmd.Parameters.AddWithValue("@DefecName", item.DefecName);
                    cmd.Parameters.AddWithValue("@DefecExplain", item.DefecExplain);
                    conn.Open();
                    int result = cmd.ExecuteNonQuery();
                    conn.Close();
                    return(result > 0);
                }
            }
            catch
            {
                throw;
            }
        }
Пример #10
0
 public bool DefectiveTypeUpsert(DefectiveTypeVO typeVO)
 {
     return(dac.DefectiveTypeUpsert(typeVO));
 }
        public bool UpdateDefectiveType(DefectiveTypeVO item)
        {
            DefectiveTypeDAC dac = new DefectiveTypeDAC();

            return(dac.UpdateDefectiveType(item));
        }