Esempio n. 1
0
        private void btnG_Update_Click(object sender, EventArgs e)
        {
            try
            {
                MachineGradeVO VO = new MachineGradeVO();
                VO.mgrade_id      = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);
                VO.mgrade_code    = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                VO.mgrade_name    = dataGridView1.CurrentRow.Cells[2].Value.ToString();
                VO.mgrade_yn      = dataGridView1.CurrentRow.Cells[3].Value.ToString();
                VO.mgrade_uadmin  = dataGridView1.CurrentRow.Cells[4].Value.ToString();
                VO.mgrade_udate   = dataGridView1.CurrentRow.Cells[5].Value.ToString();
                VO.mgrade_comment = dataGridView1.CurrentRow.Cells[6].Value.ToString();
                FacilitiesPop frm = new FacilitiesPop(FacilitiesPop.EditMode.Update, VO);

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    LoadData();
                    SetBottomStatusLabel("설비군 수정 성공");
                }
                txtCode.Text    = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                txtName.Text    = dataGridView1.CurrentRow.Cells[2].Value.ToString();
                txtAdmin.Text   = dataGridView1.CurrentRow.Cells[4].Value.ToString();
                txtDate.Text    = dataGridView1.CurrentRow.Cells[5].Value.ToString();
                txtComment.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString();
            }
            catch (Exception err)
            {
                LoggingUtility.GetLoggingUtility(err.Message, Level.Error);
            }
        }
Esempio n. 2
0
 public FacilitiesPop(EditMode editMode, MachineGradeVO VO)
 {
     InitializeComponent();
     if (editMode == EditMode.Update)
     {
         mode                   = EditMode.Update;
         this.Text              = "설비군 수정";
         lblID.Text             = VO.mgrade_id.ToString();
         txtMgrade_name.Text    = VO.mgrade_name;
         txtMgrade_code.Text    = VO.mgrade_code;
         txtMgrade_uadmin.Text  = VO.mgrade_uadmin;
         txtMgrade_udate.Text   = txtMgrade_udate.Text;
         txtMgrade_comment.Text = VO.mgrade_comment;
         cboYN.Text             = VO.mgrade_yn;
     }
     if (editMode == EditMode.Input)
     {
         this.Text = "설비군 추가";
         mode      = EditMode.Input;
     }
 }
Esempio n. 3
0
        public bool UpdateMachineGr(MachineGradeVO VO)
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.Connection  = new SqlConnection(this.ConnectionString);
                cmd.CommandText = "UpdateMachineGr";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@mgrade_id", VO.mgrade_id);
                cmd.Parameters.AddWithValue("@mgrade_code", VO.mgrade_code);
                cmd.Parameters.AddWithValue("@mgrade_name", VO.mgrade_name);
                cmd.Parameters.AddWithValue("@mgrade_yn", VO.mgrade_yn);
                cmd.Parameters.AddWithValue("@mgrade_uadmin", VO.mgrade_uadmin);
                cmd.Parameters.AddWithValue("@mgrade_udate", VO.mgrade_udate);
                cmd.Parameters.AddWithValue("@mgrade_comment", VO.mgrade_comment);
                cmd.Connection.Open();

                var successRow = cmd.ExecuteNonQuery();
                cmd.Connection.Close();
                return(successRow > 0);
            }
        }
Esempio n. 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ResourceService R_Service = new ResourceService();
                MachineGradeVO  VO        = new MachineGradeVO();
                try
                {
                    VO.mgrade_name    = txtMgrade_name.Text;
                    VO.mgrade_code    = txtMgrade_code.Text;
                    VO.mgrade_yn      = cboYN.SelectedValue.ToString();
                    VO.mgrade_udate   = txtMgrade_udate.Text;
                    VO.mgrade_uadmin  = txtMgrade_uadmin.Text;
                    VO.mgrade_comment = txtMgrade_comment.Text;

                    if (mode == EditMode.Input)
                    {
                        bool bResult = R_Service.InsertMachineGr(VO);
                        if (bResult)
                        {
                            MessageBox.Show("등록성공");
                            this.DialogResult = DialogResult.OK;
                        }
                        else if (!bResult)
                        {
                            MessageBox.Show("등록실패");
                            this.DialogResult = DialogResult.None;
                            return;
                        }
                    }
                    else if (mode == EditMode.Update)
                    {
                        VO.mgrade_id = Convert.ToInt32(lblID.Text);
                        bool bResult = R_Service.UpdateMachineGr(VO);
                        if (bResult)
                        {
                            MessageBox.Show("수정성공");
                            this.DialogResult = DialogResult.OK;
                        }
                        else if (!bResult)
                        {
                            MessageBox.Show("수정실패");
                            this.DialogResult = DialogResult.None;
                            return;
                        }
                    }
                }
                catch (NullReferenceException err)
                {
                    MessageBox.Show("입력되지 않은값이 있습니다, 다시 확인해주세요", "입력확인", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.DialogResult = DialogResult.None;
                    return;
                }
                catch (Exception err)
                {
                    string str = err.Message;
                    return;
                }
            }
            catch (NullReferenceException err)
            {
                MessageBox.Show("입력되지 않은값이 있습니다, 다시 확인해주세요", "입력확인", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                return;
            }
            catch (Exception err)
            {
                string str = err.Message;
            }
        }
Esempio n. 5
0
 public bool UpdateMachineGr(MachineGradeVO VO)
 {
     return(dac.UpdateMachineGr(VO));
 }
Esempio n. 6
0
 public bool InsertMachineGr(MachineGradeVO VO)
 {
     return(dac.InsertMachineGr(VO));
 }