Exemplo n.º 1
0
        //Click nút Save
        private void BbiSave_ItemClick(object sender, ItemClickEventArgs e)
        {
            string Message  = "";
            string curr_TVC = cbx_TVC.SelectedIndex.ToString();
            string TVC;

            if (curr_TVC == "0")
            {
                TVC = "TVC1";
            }
            else
            {
                TVC = "TVC2";
            }
            string   curr_LineCode     = txt_LineCode.Text.Trim();
            string   curr_LineEN       = sLook_LineEN.Text.Trim();
            string   curr_LineVN       = txt_LineVN.Text.Trim();
            string   curr_LineJP       = txt_LineJP.Text.Trim();
            string   curr_ProcessCode  = sLook_ProcessCode.EditValue.ToString();
            string   curr_GroupLineACC = sLookUp_GroupLineACC.EditValue.ToString();
            string   curr_UsingDept    = sLookUp_UsingDept.EditValue.ToString();
            int      curr_Point        = Int32.Parse(txt_Point.Text.Trim());
            string   curr_ExpenseGroup = txt_ExpenseGroup.Text.Trim();
            DateTime curr_ApplyDate    = DateTime.Parse(date_ApplyDate.Text.Trim());
            int      curr_InActive     = cbx_InActive.SelectedIndex;
            string   curr_Memo         = txt_Memo.Text.Trim();

            //Trường hợp thêm mới
            if (IsNewValue)
            {
                Message = "Bạn muốn thêm mới tên: " + txt_LineCode.Text.ToString() + "?";
                if ((MessageBox.Show(Message, "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question
                                     , MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes))
                {
                    if (CheckError() == true)
                    {
                        if (M0003_Line_DAO.Insert(TVC, curr_LineCode, curr_LineEN, curr_LineVN, curr_LineJP, curr_ProcessCode, curr_GroupLineACC, curr_UsingDept, curr_Point, curr_ExpenseGroup, curr_ApplyDate, curr_InActive, curr_Memo, _systemDAL.userName.ToUpper()))
                        {
                            Message = "Lưu thành công tên: \"" + txt_LineCode.Text.ToString() + "\"!";
                            MessageBox.Show(Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
            //Trường hợp sửa
            else
            {
                Message = "Bạn muốn cập nhật tên: " + txt_LineCode.Text.ToString() + "?";
                if ((MessageBox.Show(Message, "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question
                                     , MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes))
                {
                    if (CheckError() == true)
                    {
                        if (M0003_Line_DAO.Update(curr_LineCode, curr_LineEN, curr_LineVN, curr_LineJP, curr_ProcessCode, curr_ApplyDate, curr_InActive, curr_Memo, _systemDAL.userName.ToUpper()))
                        {
                            Message = "Cập nhật thành công tên: \"" + txt_LineCode.Text.ToString() + "\"!";
                            MessageBox.Show(Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
        }