public Boolean insertFinancialYear(financialyear fyrec) { Boolean status = true; string utString = ""; try { string updateSQL = "insert into FinancialYear (FYID,startdate,enddate,status,documentstatus,CreateTime,CreateUser) values (" + "'" + fyrec.fyID + "'," + "'" + (fyrec.startDate.ToString("yyyyMMdd HH:mm:ss")) + "'," + "'" + (fyrec.endDate.ToString("yyyyMMdd HH:mm:ss")) + "'," + fyrec.status + "," + fyrec.documentStatus + "," + "GETDATE()" + "," + "'" + Login.userLoggedIn + "'" + ")"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("insert", "FinancialYear", "", updateSQL) + Main.QueryDelimiter; if (!UpdateTable.UT(utString)) { status = false; } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); status = false; } return(status); }
public static List <financialyear> getFinancialYear() { financialyear fyrec; List <financialyear> FYears = new List <financialyear>(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "Select fyid,startdate,enddate,status,documentstatus,createuser,createtime,IsCurrentFY from Financialyear order by fyid"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { fyrec = new financialyear(); fyrec.fyID = reader.GetString(0); fyrec.startDate = reader.GetDateTime(1); fyrec.endDate = reader.GetDateTime(2); fyrec.status = reader.GetInt32(3); fyrec.documentStatus = reader.GetInt32(4); fyrec.IsCurrentFY = reader.GetInt32(7); FYears.Add(fyrec); } conn.Close(); } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(FYears); }
public Boolean updateFinancialYear(financialyear fyrec) { Boolean status = true; string utString = ""; try { string updateSQL = "update FinancialYear set startDate='" + (fyrec.startDate.ToString("yyyyMMdd HH:mm:ss")) + "',EndDate='" + (fyrec.endDate.ToString("yyyyMMdd HH:mm:ss")) + "',Status=" + fyrec.status + ", IsCurrentFY = " + fyrec.IsCurrentFY + " where FYID='" + fyrec.fyID + "'"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("update", "FinancialYear", "", updateSQL) + Main.QueryDelimiter; if (!UpdateTable.UT(utString)) { status = false; } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); status = false; } return(status); }
public Boolean validateFinancialYear(financialyear fyrec) { Boolean status = true; try { if (fyrec.fyID.Trim().Length == 0 || fyrec.fyID == null) { return(false); } if (fyrec.startDate >= fyrec.endDate || fyrec.startDate.Day != 1 || fyrec.endDate.Day != 31 || fyrec.startDate.Month != 4 || fyrec.endDate.Month != 3 || (fyrec.endDate.Year - fyrec.startDate.Year) != 1) { return(false); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(status); }