Beispiel #1
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (checkValideSubmit() == false)
                {
                    return;
                }
                FormAddCustomerObj formObj = tranfersInput();
                CustomerLogic      logic   = new CustomerLogic();
                LogicResult        result;
                if (StringUtils.isBlank(selectedId))
                {
                    result = logic.addCustommerLogic(formObj);
                }
                else
                {
                    result = logic.updateCustommerLogic(formObj);
                }

                if (result.severity == Contanst.MSG_ERROR)
                {
                    MessageBox.Show(result.msg);
                }
                else
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception: " + ex.Message);
            }
        }
Beispiel #2
0
        private FormAddCustomerObj tranfersInput()
        {
            FormAddCustomerObj destObj = new FormAddCustomerObj();

            destObj.idKhachHang  = StringUtils.Trim(this.idKhachHang.Text);
            destObj.tenKhachHang = StringUtils.Trim(this.tenKH.Text);
            destObj.diaChi       = StringUtils.Trim(this.diachi.Text);
            destObj.email        = StringUtils.Trim(this.email.Text);
            destObj.accFtp       = StringUtils.Trim(this.accFtp.Text);
            destObj.sales        = StringUtils.Trim(this.salesName.Text);

            destObj.salesPercent = (Decimal)this.salesPercent.Value;
            destObj.giamGia      = this.giamGia.Value.ToString();

            destObj.vanChuyen = StringUtils.Trim(this.vanChuyen.Text);
            destObj.startDate = this.ngayHopTac.Value;
            destObj.notes     = StringUtils.Trim(this.notes.Text);
            if (this.listLienHe.Count > 0)
            {
                destObj.listContracts = this.listLienHe;
                foreach (LienHeDto lienHe in destObj.listContracts)
                {
                    lienHe.idKhacHang = this.idKhachHang.Text;
                }
            }
            else
            {
                if (StringUtils.isNotBlank(this.cbbContact.Text) || StringUtils.isNotBlank(this.phoneContact.Text))
                {
                    destObj.listContracts.Add(new LienHeDto(cbbContact.Text.Trim(), phoneContact.Text.Trim(), destObj.idKhachHang));
                }
            }

            destObj.user = "******";

            return(destObj);
        }