예제 #1
0
 private void AddCompanyValues()
 {
     try
     {
         _objCompanyDetailsSetup               = new CompanyDetailsSetup();
         _objCompanyDetailsSetup.CountryID     = Convert.ToInt32(ddlCountry.SelectedValue);
         _objCompanyDetailsSetup.CompanyName   = txtCompanyName.Text == string.Empty ? null : txtCompanyName.Text;
         _objCompanyDetailsSetup.CompanyEmail  = txtEmail.Text == string.Empty ? null : txtEmail.Text;
         _objCompanyDetailsSetup.CompanyMobile = txtMobile.Text == string.Empty ? null : txtMobile.Text;
         _objCompanyDetailsSetup.CompanyLogo   = (byte[])ViewState["profileImage"];
         _objCompanySetupController            = new CompanySetupController();
         if (btnSave.Text == "Update")
         {
             _objCompanyDetailsSetup.CompanyID = Convert.ToInt32(Session["selectedCompanyID"].ToString());
             _objCompanySetupController.Update(_objCompanyDetailsSetup);
         }
         else
         {
             _objCompanySetupController.Save(_objCompanyDetailsSetup);
         }
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
        private void AddCompanyValues()
        {
            try
            {
                _objCompanyDetailsSetup               = new CompanyDetailsSetup();
                _objCompanyDetailsSetup.CountryID     = Convert.ToInt32(ddlCountry.SelectedValue);
                _objCompanyDetailsSetup.CompanyName   = txtCompanyName.Text == string.Empty ? null : txtCompanyName.Text;
                _objCompanyDetailsSetup.CompanyEmail  = txtEmail.Text == string.Empty ? null : txtEmail.Text;
                _objCompanyDetailsSetup.CompanyMobile = txtMobile.Text == string.Empty ? null : txtMobile.Text;
                _objCompanyDetailsSetup.CompanyLogo   = (byte[])ViewState["profileImage"];

                _objCompanyDetailsSetup.CompanyShortName                    = txtShortName.Text == string.Empty ? null : txtShortName.Text;
                _objCompanyDetailsSetup.CompanySlogun                       = txtSlogun.Text == string.Empty ? null : txtSlogun.Text;
                _objCompanyDetailsSetup.House                               = txtHouse.Text == string.Empty ? null : txtHouse.Text;
                _objCompanyDetailsSetup.Road                                = txtRoad.Text == string.Empty ? null : txtRoad.Text;
                _objCompanyDetailsSetup.Sector                              = txtSector.Text == string.Empty ? null : txtSector.Text;
                _objCompanyDetailsSetup.Landmark                            = txtLandmark.Text == string.Empty ? null : txtLandmark.Text;
                _objCompanyDetailsSetup.ContactPersonName                   = txtContactPersonName.Text == string.Empty ? null : txtContactPersonName.Text;
                _objCompanyDetailsSetup.ContactPersonDesignation            = ddlContactPersonDesignation.SelectedValue == "-1" ? null : ddlContactPersonDesignation.SelectedValue;
                _objCompanyDetailsSetup.ContactPersonContactNumber          = txtContactNumber.Text == string.Empty ? null : txtContactNumber.Text;
                _objCompanyDetailsSetup.AlternateContactPersonName          = txtAltContName.Text == string.Empty ? null : txtAltContName.Text;
                _objCompanyDetailsSetup.AlternateContactPersonDesignation   = ddlAltContDesignation.SelectedValue == "-1" ? null : ddlAltContDesignation.SelectedValue;
                _objCompanyDetailsSetup.AlternateContactPersonContactNumber = txtAltContactNumber.Text == string.Empty ? null : txtAltContactNumber.Text;
                _objCompanyDetailsSetup.CompanyPhones                       = txtPhone.Text == string.Empty ? null : txtPhone.Text;
                _objCompanyDetailsSetup.CompanyFax                          = txtFax.Text == string.Empty ? null : txtFax.Text;
                _objCompanyDetailsSetup.CompanyURL                          = txtURL.Text == string.Empty ? null : txtURL.Text;

                _objCompanyDetailsSetup.LicenceID  = Convert.ToInt32(txtLicence.Text == string.Empty ? null : txtLicence.Text);
                _objCompanyDetailsSetup.FaceBookID = txtFaceBook.Text == string.Empty ? null : txtFaceBook.Text;
                _objCompanyDetailsSetup.LinkedInID = txtLinkedInID.Text == string.Empty ? null : txtLinkedInID.Text;
                _objCompanyDetailsSetup.TwitterID  = txtTwitterID.Text == string.Empty ? null : txtTwitterID.Text;
                _objCompanyDetailsSetup.YouTubeID  = txtYouTubeID.Text == string.Empty ? null : txtYouTubeID.Text;
                _objBusinessType = new BusinessType();
                _objBusinessType.BusinessTypeID = ddlBusinessType.SelectedValue == "-1" ? Convert.ToInt32(null) : Convert.ToInt32(ddlBusinessType.SelectedValue);
                _objOwnershipType = new OwnershipType();
                _objOwnershipType.OwnershipTypeID = ddlOwnershipType.SelectedValue == "-1" ? Convert.ToInt32(null) : Convert.ToInt32(ddlOwnershipType.SelectedValue);
                _objDistrictSetup            = new DistrictSetup();
                _objDistrictSetup.DistrictID = ddlDistrict.SelectedValue == "-1" ? Convert.ToInt32(null) : Convert.ToInt32(ddlDistrict.SelectedValue);

                _objCompanySetupController = new CompanySetupController();
                if (btnSave.Text == "Update")
                {
                    _objCompanyDetailsSetup.CompanyID = Convert.ToInt32(Session["selectedCompanyID"].ToString());
                    _objCompanySetupController.Update(_objCompanyDetailsSetup);
                    _objCompanySetupController.UpdateByUser(_objCompanyDetailsSetup, _objBusinessType, _objOwnershipType, _objDistrictSetup);
                }
            }
            catch (Exception msgException)
            {
                throw msgException;
            }
        }