internal void Save(YearSetup objYearSetup) { try { objYearSetup.UseChartOfAccNo = this.GetChartOfAccNo(); objYearSetup.YearOpen = 1; objYearSetup.YearOpeningID = Convert.ToInt32(objYearSetup.CompanyID.ToString() + objYearSetup.BranchID.ToString() + Convert.ToDateTime(objYearSetup.BeginningYear).ToString("yy") + objYearSetup.UseChartOfAccNo.ToString("00")); var storedProcedureComandText = "INSERT INTO [xSysYearSetup] ([YearOpeningID],[CompanyID],[BranchID],[BeginningYear],[EndingYear],[YearOpenBy],[YearOpen] " + " ,[UseChartOfAccNo],[EntryDate],[EntryUserID],[Dataused]) VALUES ( " + " " + objYearSetup.YearOpeningID + "," + " " + objYearSetup.CompanyID + "," + "" + objYearSetup.BranchID + "," + "CONVERT(DATETIME,'" + objYearSetup.BeginningYear + "',103)," + "CONVERT(DATETIME,'" + objYearSetup.EndingYear + "',103)," + "'" + objYearSetup.YearOpenBy + "'," + "" + objYearSetup.YearOpen + "," + "" + objYearSetup.UseChartOfAccNo + "," + "CAST(GETDATE() AS DateTime)," + "'" + objYearSetup.EntryUserName + "'," + "'A');"; clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandText); } catch (Exception msgException) { throw msgException; } }
private void AddValuesOfYear() { try { _objYearSetup = new YearSetup(); _objYearSetup.CompanyID = LoginUserInformation.CompanyID; //_objYearSetup.BranchID = LoginUserInformation.BranchID; if (txtNewYearStartDate.Text == string.Empty) { _objYearSetup.BeginningYear = null; } else { _objYearSetup.BeginningYear = Convert.ToDateTime(txtNewYearStartDate.Text); } if (txtNewYearEndDate.Text == string.Empty) { _objYearSetup.EndingYear = null; } else { _objYearSetup.EndingYear = Convert.ToDateTime(txtNewYearEndDate.Text); } _objYearSetup.EntryUserName = LoginUserInformation.UserID; _objYearSetup.YearOpenBy = txtOpenBy.Text == string.Empty ? null : txtOpenBy.Text; _objYearSetup.Remarks = txtRemarks.Text == string.Empty ? null : txtRemarks.Text; _YearSetupController = new YearSetupController(); _YearSetupController.Save(_objYearSetup); } catch (Exception msgException) { throw msgException; } }