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; } }
internal void UpdateByUser(CompanyDetailsSetup objCompanyDetailsSetup, BusinessType objBusinessType, OwnershipType objOwnershipType, DistrictSetup objDistrictSetup) { try { var storedProcedureComandText = "UPDATE [comCompanySetup] " + " SET [CompanyShortName] = ISNULL('" + objCompanyDetailsSetup.CompanyShortName + "',[CompanyShortName]) " + " ,[CompanySlogun] = ISNULL('" + objCompanyDetailsSetup.CompanySlogun + "',[CompanySlogun]) " + " ,[House] = ISNULL('" + objCompanyDetailsSetup.House + "',[House]) " + " ,[Road] = ISNULL('" + objCompanyDetailsSetup.Road + "',[Road]) " + " ,[Sector] = ISNULL('" + objCompanyDetailsSetup.Sector + "',[Sector]) " + " ,[Landmark] = ISNULL('" + objCompanyDetailsSetup.Landmark + "',[Landmark]) " + " ,[ContactPersonName] = ISNULL('" + objCompanyDetailsSetup.ContactPersonName + "',[ContactPersonName]) " + " ,[ContactPersonDesignation] = ISNULL('" + objCompanyDetailsSetup.ContactPersonDesignation + "',[ContactPersonDesignation]) " + " ,[ContactPersonContactNumber] = ISNULL('" + objCompanyDetailsSetup.ContactPersonContactNumber + "',[ContactPersonContactNumber]) " + " ,[AlternateContactPersonName] = ISNULL('" + objCompanyDetailsSetup.AlternateContactPersonName + "',[AlternateContactPersonName]) " + " ,[AlternateContactPersonDesignation] = ISNULL('" + objCompanyDetailsSetup.AlternateContactPersonDesignation + "',[AlternateContactPersonDesignation]) " + " ,[AlternateContactPersonContactNumber] = ISNULL('" + objCompanyDetailsSetup.AlternateContactPersonContactNumber + "',[AlternateContactPersonContactNumber]) " + " ,[CompanyPhones] = ISNULL('" + objCompanyDetailsSetup.CompanyPhones + "',[CompanyPhones]) " + " ,[CompanyFax] = ISNULL('" + objCompanyDetailsSetup.CompanyFax + "',[CompanyFax]) " + " ,[CompanyURL] = ISNULL('" + objCompanyDetailsSetup.CompanyURL + "',[CompanyURL]) " + " ,[LicenceID] = ISNULL(" + objCompanyDetailsSetup.LicenceID + ",[LicenceID]) " + " ,[FaceBookID] = ISNULL('" + objCompanyDetailsSetup.FaceBookID + "',[FaceBookID]) " + " ,[LinkedInID] = ISNULL('" + objCompanyDetailsSetup.LinkedInID + "',[LinkedInID]) " + " ,[TwitterID] = ISNULL('" + objCompanyDetailsSetup.TwitterID + "',[TwitterID]) " + " ,[YouTubeID] = ISNULL('" + objCompanyDetailsSetup.YouTubeID + "',[YouTubeID]) " + " ,[BusinessTypeID] = ISNULL(" + objBusinessType.BusinessTypeID + ",[BusinessTypeID]) " + " ,[OwnershipTypeID] = ISNULL(" + objOwnershipType.OwnershipTypeID + ",[OwnershipTypeID]) " + " ,[DistrictID] = ISNULL(" + objDistrictSetup.DistrictID + ",[DistrictID]) " + " ,[LastUpdateDate] = CAST(GETDATE() AS DateTime) " + " ,[LastUpdateUserID] = '160ea939-7633-46a8-ae49-f661d12abfd5' " + " WHERE [CompanyID] = " + objCompanyDetailsSetup.CompanyID + ""; clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandText); this.UpdateCompanyChart(objCompanyDetailsSetup); } catch (Exception msgException) { throw msgException; } }