/// <summary> /// Changing company's financial year /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSelect_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Are you sure you want to change the financial year?", "OpenMiracle", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearBll bllFinancialYear = new FinancialYearBll(); decimal decFinacialId = Convert.ToDecimal(dgvChangeFinancialYear.CurrentRow.Cells["dgvtxtfinancialYearId"].Value); DateTime dtmFromDate = Convert.ToDateTime(dgvChangeFinancialYear.CurrentRow.Cells["dgvtxtFromDate"].Value); DateTime dtmToDate = Convert.ToDateTime(dgvChangeFinancialYear.CurrentRow.Cells["dgvtxtToDate"].Value); PublicVariables._decCurrentFinancialYearId = decFinacialId; PublicVariables._dtFromDate = dtmFromDate; PublicVariables._dtToDate = dtmToDate; DateTime dtGetCurrentdate = DateTime.Now; //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); bllCompanyCreation.CompanyCurrentDateEdit(dtmFromDate); if (dtGetCurrentdate < dtmFromDate) { PublicVariables._dtCurrentDate = dtmFromDate; bllCompanyCreation.CompanyCurrentDateEdit(dtmFromDate); formMDI.MDIObj.ShowCurrentDate(); } else { PublicVariables._dtCurrentDate = dtGetCurrentdate; bllCompanyCreation.CompanyCurrentDateEdit(dtmFromDate); formMDI.MDIObj.ShowCurrentDate(); } CompanyInfo infoCompany = new CompanyInfo(); infoCompany = bllCompanyCreation.CompanyView(1); formMDI.MDIObj.Text = "OpenMiracle " + infoCompany.CompanyName + " [ " + PublicVariables._dtFromDate.ToString("dd-MMM-yyyy") + " To " + PublicVariables._dtToDate.ToString("dd-MMM-yyyy") + " ]"; this.Close(); } } catch (Exception ex) { MessageBox.Show("CHGFINYR:5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }