/// <summary> /// Function for Edit /// </summary> public void EditFunction() { try { CompanyInfo infoCompany = new CompanyInfo(); CompanyCreationBll BllCompanyCreation = new CompanyCreationBll(); CompanyPathInfo infoCompanyPath = new CompanyPathInfo(); CompanyPathBll BllCompanyPath = new CompanyPathBll(); UserInfo infoUser = new UserInfo(); UserBll bllUser = new UserBll(); infoCompany.CompanyName = txtCompanyName.Text.Trim(); infoCompany.MailingName = txtMailingName.Text.Trim(); infoCompany.Address = txtAddress.Text.Trim(); infoCompany.Phone = txtPhoneNo.Text.Trim(); infoCompany.Mobile = txtMobile.Text.Trim(); infoCompany.EmailId = txtEmail.Text.Trim(); infoCompany.Web = txtWeb.Text.Trim(); infoCompany.Country = txtCountry.Text.Trim(); infoCompany.State = txtState.Text.Trim(); infoCompany.Pin = txtPincode.Text.Trim(); infoCompany.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()); infoCompany.FinancialYearFrom = Convert.ToDateTime(txtFinancialYearFrom.Text.Trim().ToString()); infoCompany.BooksBeginingFrom = Convert.ToDateTime(txtBooksBegining.Text.Trim().ToString()); infoCompany.Tin = txtTinNo.Text.Trim(); infoCompany.Cst = txtCstNo.Text.Trim(); infoCompany.Pan = txtPanNo.Text.Trim(); infoCompany.CurrentDate = DateTime.Now; infoCompany.Logo = logo; infoCompany.Extra1 = string.Empty; infoCompany.Extra2 = string.Empty; infoCompanyPath.CompanyName = txtCompanyName.Text.Trim(); infoCompanyPath.IsDefault = cbxSetAsDefault.Checked; strPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId; infoCompanyPath.CompanyPath = strPath; infoCompanyPath.Extra1 = string.Empty; infoCompanyPath.Extra2 = string.Empty; infoCompanyPath.ExtraDate = DateTime.Now; infoCompanyPath.CompanyId = 1; infoCompany.CompanyId = 1; BllCompanyCreation.CompanyEdit(infoCompany); BllCompanyPath.CompanyPathEdit(infoCompanyPath); Messages.UpdatedMessage(); // To set default currencyId...........In exchangeRate..// ExchangeRateBll BllExchangeRate = new ExchangeRateBll(); ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo(); infoExchangeRate.ExchangeRateId = 1; infoExchangeRate.Date = PublicVariables._dtCurrentDate; infoExchangeRate.CurrencyId = infoCompany.CurrencyId; infoExchangeRate.ExtraDate = PublicVariables._dtCurrentDate; infoExchangeRate.Narration = string.Empty; infoExchangeRate.Rate = 1; infoExchangeRate.Extra1 = string.Empty; infoExchangeRate.Extra2 = string.Empty; BllExchangeRate.ExchangeRateEdit(infoExchangeRate); FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearBll BllFinancialYear = new FinancialYearBll(); decimal decIdentity; infoFinancialYear.FromDate = PublicVariables._dtFromDate; infoFinancialYear.ToDate = PublicVariables._dtToDate; infoFinancialYear.ExtraDate = DateTime.Now; infoFinancialYear.Extra1 = string.Empty; infoFinancialYear.Extra2 = string.Empty; bool isExist = BllFinancialYear.FinancialYearExistenceCheck(PublicVariables._dtFromDate, PublicVariables._dtToDate); if (!isExist) { decIdentity = BllFinancialYear.FinancialYearAddWithReturnIdentity(infoFinancialYear); } //===========Add companyDetails in ExternalDb =====================// decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId; PublicVariables._decCurrentCompanyId = 0; CompanyCreationBll bllExCompanyCreation = new CompanyCreationBll(); CompanyPathBll bllExCompanyPath = new CompanyPathBll(); CompanyInfo infoExCompany = new CompanyInfo(); CompanyPathInfo infoExCompanyPath = new CompanyPathInfo(); infoExCompany = infoCompany; infoExCompanyPath = infoCompanyPath; infoExCompany.CompanyId = decCompanyIdForTemp; infoExCompanyPath.CompanyId = decCompanyIdForTemp; bllExCompanyCreation.CompanyEdit(infoExCompany); bllExCompanyPath.CompanyPathEdit(infoExCompanyPath); PublicVariables._decCurrentCompanyId = decCompanyIdForTemp; this.Close(); } catch (Exception ex) { MessageBox.Show("CR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Save or edit function to check the references and invalid entries /// </summary> public void SaveOrEditFunction() { try { FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearBll bllFinancialYear = new FinancialYearBll(); if (PublicVariables.isMessageAdd) { if (Messages.SaveMessage()) { if (bllFinancialYear.FinancialYearExistenceCheck(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text))) { SaveFunction(); } else { Messages.InformationMessage("Financial year already exist."); txtFromDate.Focus(); } } } else { SaveFunction(); } } catch (Exception ex) { MessageBox.Show("NFY 3 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }