public static int AddAccountingYear(tAccountingYear tAccountingYear) { int rowsAdded; try { using (IDbConnection connection = DbConnectionHelper.GetConnection()) { var query = new StringBuilder( "INSERT INTO tAccountingYear(CompanyId, AccountYearId,StartMonth,EndMonth,StartVoucherNo,EndVoucherNo,StartPostingDate,EndPostingDate,SetDateTime,EntryUser)"); query.Append("VALUES( @CompanyId, @AccountYearId,@StartMonth,@EndMonth,@StartVoucherNo,@EndVoucherNo,@StartPostingDate,@EndPostingDate,@SetDateTime,@EntryUser)"); rowsAdded = connection.Execute(query.ToString(), tAccountingYear); } } catch (SqlException ex) { //LoggerHelper.Write(TraceEventType.Error, "Error in AddAccountingYear. " + ex, // new[] { Constants.LOGGING_CATEGORY_EXCEPTION }); throw ex; } return rowsAdded; }
public static int AddAccountingYear(tAccountingYear tAccountingYear) { try { return AccountingDataProvider.AddAccountingYear(tAccountingYear); } catch (SqlException ex) { throw new BusinessApplicationException("Error in busines logic of AddAccountingYear", ex); } //catch (Exception exception) //{ // throw new Exception(exception.Message); //} }
public static int UpdateAccountingYear(tAccountingYear tAccountingYear) { int rowsUpdated; try { using (IDbConnection connection = DbConnectionHelper.GetConnection()) { var query = new StringBuilder("UPDATE tAccountingYear SET AccountYearId = @AccountYearId,StartMonth=@StartMonth,EndMonth=@EndMonth,StartVoucherNo=@StartVoucherNo, EndVoucherNo=@EndVoucherNo"); query.Append(" , StartPostingDate= @StartPostingDate,EndPostingDate=@EndPostingDate,SetDateTime=@SetDateTime,EntryUser=@EntryUser"); query.Append(" WHERE CompanyId=@CompanyId and AccountYearId = @AccountYearId"); rowsUpdated = connection.Execute(query.ToString(), tAccountingYear); } } catch (SqlException ex) { throw ex ; } return rowsUpdated; }
public static int DeleteAccountingYear(tAccountingYear tAccountingYear) { int rowsDeleted; using (IDbConnection connection = DbConnectionHelper.GetConnection()) { var query = new StringBuilder("DELETE FROM tAccountingYear WHERE CompanyId=@CompanyId and AccountYearId = @AccountYearId"); rowsDeleted = connection.Execute(query.ToString(), tAccountingYear); } return rowsDeleted; }
public static int UpdateAccountingYear(tAccountingYear tAccountingYear) { try { return AccountingDataProvider.UpdateAccountingYear(tAccountingYear); } catch (SqlException ex) { throw new BusinessApplicationException("Error in busines logic of UpdateAccountingYear", ex); } }
public static int DeleteAccountingYear(tAccountingYear tAccountingYear) { try { return AccountingDataProvider.DeleteAccountingYear(tAccountingYear); } catch (Exception exception) { throw new Exception(exception.Message); } }
private void UpdateFields(tAccountingYear tAccountingYear) { _selectedYeareId =tAccountingYear.AccountYearId; txtAccountingYear.Text = tAccountingYear.AccountYearId.ToString(); cboStartFromMonth.SelectedIndex = tAccountingYear.StartMonth-1; cboEndFromMonth.SelectedIndex = tAccountingYear.EndMonth - 1; txtFirstVoucherNo.Text = tAccountingYear.StartVoucherNo.ToString(); txtLastVoucherNo.Text = tAccountingYear.EndVoucherNo.ToString(); dpkFirstPostingDate.Text = tAccountingYear.StartPostingDate.ToShortDateString(); dpkLastPostingDate.Text = tAccountingYear.EndPostingDate.ToShortDateString(); chkLocked.IsChecked = tAccountingYear.IsLocked; }
private tAccountingYear AccountingYearBuilder() { var chartOfAccount = new tAccountingYear { CompanyId = ShatedData.ApplicationState.SelectedCompanyId, AccountYearId = Convert.ToInt64(txtAccountingYear.Text), StartMonth = cboStartFromMonth.SelectedIndex + 1, EndMonth = cboEndFromMonth.SelectedIndex + 1, StartVoucherNo = Convert.ToInt64(txtFirstVoucherNo.Text), EndVoucherNo = Convert.ToInt64(txtLastVoucherNo.Text), StartPostingDate = DateTime.Parse(dpkFirstPostingDate.Text), EndPostingDate = DateTime.Parse(dpkLastPostingDate.Text), IsLocked = chkLocked.IsChecked == true, EntryUser = ShatedData.ApplicationState.LoginUserName, SetDateTime = DateTime.Now, UpdateDateTime = DateTime.Now }; return chartOfAccount; }