protected void btnSaveActualPersonAccount_Click(object sender, EventArgs e)
        {
            try
            {
                Common.DomainAccount domainAccount = new Common.DomainAccount();
                domainAccount.Type         = (int)Business.DomainAccountType.NicAccount;
                domainAccount.FirstName    = txtFirstName.Text;
                domainAccount.LastName     = txtLastName.Text;
                domainAccount.NationalCode = txtNationalID.Text;
                domainAccount.CompanyName  = txtCompanyName.Text;
                domainAccount.Address      = txtAddress.Text;
                domainAccount.City         = txtCity.Text;
                domainAccount.Province     = txtProvince.Text;
                domainAccount.Country      = txtCountry.Text;
                domainAccount.PostalCode   = txtPostalCode.Text;
                domainAccount.Telephone    = txtPhoneNumber.Text;
                domainAccount.FaxNumber    = txtFaxNo.Text;
                domainAccount.Email        = txtEmail.Text;
                domainAccount.NICType      = (int)Business.NicDomainType.ActualPerson;
                domainAccount.CreateDate   = DateTime.Now;
                domainAccount.UserGuid     = UserGuid;

                if (domainAccount.HasError)
                {
                    throw new Exception(domainAccount.ErrorMessage);
                }

                if (Facade.DomainAccount.InsertNicAccountActualPerson(domainAccount))
                {
                    ShowMessageBox(Language.GetString("InsertRecord"));
                }
                else
                {
                    throw new Exception(Language.GetString("ErrorRecord"));
                }
            }
            catch (Exception ex)
            {
                ShowMessageBox(ex.Message);
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Common.DomainAccount domainAccount = new Common.DomainAccount();
                domainAccount.Type        = (int)Business.DomainAccountType.DirectAccount;
                domainAccount.UserName    = txtuserName.Text;
                domainAccount.Password    = txtPassword.Text;
                domainAccount.FirstName   = txtFirstName.Text;
                domainAccount.CompanyName = txtCompanyName.Text;
                domainAccount.Address     = txtAddress.Text;
                domainAccount.City        = txtCity.Text;
                domainAccount.Province    = txtProvince.Text;
                domainAccount.Country     = txtCountry.Text;
                domainAccount.PostalCode  = txtPostalCode.Text;
                domainAccount.Telephone   = txtPhoneNumber.Text;
                domainAccount.CreateDate  = DateTime.Now;
                domainAccount.UserGuid    = UserGuid;
                if (domainAccount.HasError)
                {
                    throw new Exception(domainAccount.ErrorMessage);
                }

                if (Facade.DomainAccount.InsertDirectAccount(domainAccount))
                {
                    ShowMessageBox(Language.GetString("InsertRecord"));
                }
                else
                {
                    throw new Exception(Language.GetString("ErrorRecord"));
                }
            }
            catch (Exception ex)
            {
                ShowMessageBox(ex.Message);
            }
        }
        protected void btnSaveCivilPersonAccount_Click(object sender, EventArgs e)
        {
            try
            {
                Common.DomainAccount domainAccount = new Common.DomainAccount();
                domainAccount.Type        = (int)Business.DomainAccountType.NicAccount;
                domainAccount.FirstName   = txtFirstNameCivil.Text;
                domainAccount.LastName    = txtLastNameCivil.Text;
                domainAccount.CompanyName = txtCompanyNameCivil.Text;
                domainAccount.Address     = txtAddressCivil.Text;
                domainAccount.City        = txtCityCivil.Text;
                domainAccount.Province    = txtProvinceCivil.Text;
                domainAccount.Country     = txtCountryCivil.Text;
                domainAccount.PostalCode  = txtPostalCodeCivil.Text;
                domainAccount.Telephone   = txtTelephoneCivil.Text;
                domainAccount.FaxNumber   = txtFaxNumber.Text;
                domainAccount.Email       = txtEmailCivil.Text;
                domainAccount.NICType     = (int)Business.NicDomainType.CivilPerson;
                domainAccount.CivilType   = Helper.GetInt(drpNicCivilPersonType.SelectedValue);
                domainAccount.CreateDate  = DateTime.Now;
                domainAccount.UserGuid    = UserGuid;

                switch (Helper.GetInt(drpNicCivilPersonType.SelectedValue))
                {
                case (int)Business.NicCivilPersonType.NonGovernment:
                    domainAccount.CountryOfCompany      = txtNonGovernmentRegisteredCountry.Text;
                    domainAccount.CityOfCompany         = txtNonGovernmentRegisteredCity.Text;
                    domainAccount.RegisteredCompanyName = txtNonGovernmentNameOfRegisteredUnit.Text;
                    domainAccount.CompanyID             = txtNonGovernmentCompanyCode.Text;
                    domainAccount.NationalCode          = txtNonGovernmentCompanyNationalCode.Text;
                    domainAccount.CompanyType           = Helper.GetInt(drpNonGovernmentType.SelectedValue);
                    break;

                case (int)Business.NicCivilPersonType.Government:
                    domainAccount.CountryOfCompany  = txtGovernmentCountryName.Text;
                    domainAccount.ProvinceOfCompany = txtGovernmentProvinceName.Text;
                    domainAccount.CityOfCompany     = txtGovernmentCityName.Text;
                    domainAccount.CompanyType       = Helper.GetInt(drpGovernmentType.SelectedValue);
                    break;

                case (int)Business.NicCivilPersonType.ResearchCenter:
                    domainAccount.CountryOfCompany  = txtResearchCenterCountryName.Text;
                    domainAccount.ProvinceOfCompany = txtResearchCenterProvinceName.Text;
                    domainAccount.CityOfCompany     = txtResearchCenterCityName.Text;
                    domainAccount.CompanyType       = Helper.GetInt(drpResearchCenterType.SelectedValue);
                    break;
                }

                if (domainAccount.HasError)
                {
                    throw new Exception(domainAccount.ErrorMessage);
                }

                if (Facade.DomainAccount.InsertNicAccountCivilPerson(domainAccount))
                {
                    ShowMessageBox(Language.GetString("InsertRecord"));
                }
                else
                {
                    throw new Exception(Language.GetString("ErrorRecord"));
                }
            }
            catch (Exception ex)
            {
                ShowMessageBox(ex.Message);
            }
        }
예제 #4
0
 public static bool InsertDirectAccount(Common.DomainAccount domainAccount)
 {
     Business.DomainAccount DomainAccountController = new Business.DomainAccount();
     return(DomainAccountController.InsertDirectAccount(domainAccount) != Guid.Empty ? true : false);
 }