Example #1
0
        private void btnUpdateNew_Click(object sender, EventArgs e)
        {
            if (txtBranchCode.Text.Length < 1 || txtBranchName.Text.Length < 1)
            {
                Class.App.InputNotAccess();
                return;
            }
            Class.DanhMuc_ChiNhanh dm = new Class.DanhMuc_ChiNhanh();
            dm.BranchCode    = txtBranchCode.Text;
            dm.BranchName    = txtBranchName.Text;
            dm.Address       = txtAddress.Text;
            dm.Phone         = txtPhone.Text;
            dm.Fax           = txtFax.Text;
            dm.MinimumSalary = txtMinimumSalary.Value;
            dm.PersonName    = txtPersonName.Text;
            dm.Quantity      = int.Parse(txtQuantity.Text);
            dm.FactQuantity  = int.Parse(txtFactQuantity.Text);
            dm.Description   = txtDescription.Text;

            if (txtBranchCode.Enabled == true)
            {
                if (dm.Insert())
                {
                    Class.App.SaveSuccessfully();
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }
            else
            {
                if (dm.Update())
                {
                    Class.App.SaveSuccessfully();
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }

            //if (_reCallFunction == "frmDanhSachChiNhanh")
            //{
            //    (this.Owner as frmDanhMuc_ChiNhanh).
            //}
            if (_reCallFunction == "frmDanhSachNhanVien")
            {
                (this.Owner as frmDanhSachNhanVien).loaddsCocautochuc();
            }
            txtBranchCode.Enabled = true;
            txtBranchCode.Text    = call_Code_New();
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtBranchCode.Text.Length < 1 || txtBranchName.Text.Length < 1)
            {
                Class.App.InputNotAccess();
                return;
            }
            Class.DanhMuc_ChiNhanh dm = new Class.DanhMuc_ChiNhanh();
            dm.BranchCode    = txtBranchCode.Text;
            dm.BranchName    = txtBranchName.Text;
            dm.Address       = txtAddress.Text;
            dm.Phone         = txtPhone.Text;
            dm.Fax           = txtFax.Text;
            dm.MinimumSalary = txtMinimumSalary.Value;
            dm.PersonName    = txtPersonName.Text;
            dm.Quantity      = int.Parse(txtQuantity.Text);
            dm.FactQuantity  = int.Parse(txtFactQuantity.Text);
            dm.Description   = txtDescription.Text;

            if (txtBranchCode.Enabled == true)
            {
                if (dm.Insert())
                {
                    Class.App.SaveSuccessfully();
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }
            else
            {
                if (dm.Update())
                {
                    Class.App.SaveSuccessfully();
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }
            Load_ChiNhanh();
            txtBranchCode.Text    = call_Code_New();
            txtBranchCode.Enabled = true;
        }