コード例 #1
0
        private void Save(string strLink = "")
        {
            try
            {
                var Company = _CompanyRepo.GetById(id);
                if (id > 0 && Company != null)
                {
                    Company.NAME = txtName.Text;
                    //Company.TAX_CODE = txtTaxCode.Text;
                    Company.EMAIL   = txtEmail.Text;
                    Company.PHONE   = txtPhone.Text;
                    Company.ADDRESS = txtAddress.Text;

                    _CompanyRepo.Update(Company);

                    strLink = string.IsNullOrEmpty(strLink) ? "chi-tiet-cong-ty.aspx?id=" + id : strLink;
                }
                else
                {
                    Company      = new COMPANY();
                    Company.NAME = txtName.Text;
                    //Customer.TAX_CODE = txtTaxCode.Text;
                    Company.EMAIL        = txtEmail.Text;
                    Company.PHONE        = txtPhone.Text;
                    Company.ADDRESS      = txtAddress.Text;
                    Company.CREATOR_ID   = Utils.CIntDef(Session["Userid"]);
                    Company.CREATED_DATE = DateTime.Now;

                    _CompanyRepo.Create(Company);

                    strLink = string.IsNullOrEmpty(strLink) ? "chi-tiet-cong-ty.aspx?id=" + Company.ID : strLink;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }