public Boolean validateCVINR(cvinr cvi) { Boolean status = true; try { if (cvi.CurrencyID.Trim().Length == 0 || cvi.CurrencyID == null) { return(false); } if (cvi.type == 0) { return(false); } if (cvi.ConversionDate > DateTime.Now || cvi.ConversionDate == null) { return(false); } if (cvi.INRValue <= 0) { return(false); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); status = false; } return(status); }
public Boolean reverseCVINR(cvinr prevcvi) { Boolean status = true; string utString = ""; try { string updateSQL = "update CurrencyVsINR set DocumentStatus=" + prevcvi.documentStatus + ", forwardUser='******'" + ", ForwarderList='" + prevcvi.ForwarderList + "'" + " where CurrencyDate='" + prevcvi.ConversionDate.ToString("yyyyMMdd") + "' and Type=" + prevcvi.type + " and CurrencyID='" + prevcvi.CurrencyID + "'"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("update", "CurrencyVsINR", "", 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 insertCVINR(cvinr cvi) { Boolean status = true; string utString = ""; try { string updateSQL = "insert into CurrencyVsINR " + " (CurrencyDate,CurrencyID,Type,INRValue,Status,DocumentStatus,CreateTime,CreateUser,ForwarderList)" + "values (" + "'" + cvi.ConversionDate.ToString("yyyyMMdd") + "'," + "'" + cvi.CurrencyID + "'," + cvi.type + "," + cvi.INRValue + "," + cvi.status + "," + cvi.documentStatus + "," + "GETDATE()" + "," + "'" + Login.userLoggedIn + "'," + "'" + cvi.ForwarderList + "'" + ")"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("insert", "CurrencyVsINR", "", updateSQL) + Main.QueryDelimiter; if (!UpdateTable.UT(utString)) { status = false; } } catch (Exception) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); status = false; } return(status); }
public List <cvinr> getFilteredCVINR(string userList, int opt) { cvinr cvi; List <cvinr> CVINRs = new List <cvinr>(); try { string query1 = "select a.rowid, a.CurrencyDate, a.CurrencyID,b.Name,a.Type,a.INRValue,a.Status,a.DocumentStatus,isnull(a.CreateUser,' '),isnull(a.ForwardUser,' '),isnull(a.ApproveUser,' '),ForwarderList " + " from CurrencyVsINR a, Currency b where a.CurrencyID=b.CurrencyID " + " and" + " ((a.forwarduser='******' and DocumentStatus between 2 and 98) " + " or (a.createuser='******' and DocumentStatus=1))" + " order by a.CurrencyDate,a.CurrencyID"; string query2 = "select a.rowid, a.CurrencyDate, a.CurrencyID,b.Name,a.Type,a.INRValue,a.Status,a.DocumentStatus,isnull(a.CreateUser,' '),isnull(a.ForwardUser,' '),isnull(a.ApproveUser,' '),ForwarderList " + " from CurrencyVsINR a, Currency b where a.CurrencyID=b.CurrencyID " + " and" + " ((a.createuser='******' and DocumentStatus between 2 and 98 ) " + " or (a.ForwarderList like '%" + userList + "%' and DocumentStatus between 2 and 98 and ForwardUser <> '" + Login.userLoggedIn + "'))" + " order by a.CurrencyDate,a.CurrencyID"; string query3 = "select a.rowid, a.CurrencyDate, a.CurrencyID,b.Name,a.Type,a.INRValue,a.Status,a.DocumentStatus,isnull(a.CreateUser,' '),isnull(a.ForwardUser,' '),isnull(a.ApproveUser,' '),ForwarderList " + " from CurrencyVsINR a, Currency b where a.CurrencyID=b.CurrencyID " + " and" + " ((a.createuser='******'" + " or a.ForwarderList like '%" + userList + "%'" + " or a.approveUser='******')" + " and a.DocumentStatus = 99) " + " order by a.CurrencyDate,a.CurrencyID"; string query6 = "select a.rowid, a.CurrencyDate, a.CurrencyID,b.Name,a.Type,a.INRValue,a.Status,a.DocumentStatus,isnull(a.CreateUser,' '),isnull(a.ForwardUser,' '),isnull(a.ApproveUser,' '),ForwarderList " + " from CurrencyVsINR a, Currency b where a.CurrencyID=b.CurrencyID " + " and " + " a.DocumentStatus = 99 and a.Status = 1" + " order by a.CurrencyDate,a.CurrencyID"; SqlConnection conn = new SqlConnection(Login.connString); ////string query = "select a.rowid, a.CurrencyDate, a.CurrencyID,b.Name,a.Type,a.INRValue,a.Status,a.DocumentStatus,isnull(a.CreateUser,' '),isnull(a.ForwardUser,' '),isnull(a.ApproveUser,' ') " + //// " from CurrencyVsINR a, Currency b where a.CurrencyID=b.CurrencyID " + //// " and a.Status=0 " + //// " and ((a.forwardUser in (" + userList + ") and documentstatus between 2 and 98) " + //// " or (a.createuser='******' and DocumentStatus=1))" + //// " order by a.CurrencyDate,a.CurrencyID"; string query = ""; switch (opt) { case 1: query = query1; break; case 2: query = query2; break; case 3: query = query3; break; case 6: query = query6; break; default: query = ""; break; } SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { cvi = new cvinr(); cvi.rowID = reader.GetInt32(0); cvi.ConversionDate = reader.GetDateTime(1); cvi.CurrencyID = reader.GetString(2); cvi.CurrencyName = reader.GetString(3); cvi.type = reader.GetInt32(4); cvi.INRValue = (float)reader.GetDouble(5); cvi.status = reader.GetInt32(6); cvi.documentStatus = reader.GetInt32(7); cvi.CreateUser = reader.GetString(8); cvi.ForwardUser = reader.GetString(9); cvi.ApproveUser = reader.GetString(10); if (!reader.IsDBNull(11)) { cvi.ForwarderList = reader.GetString(11); } else { cvi.ForwarderList = ""; } CVINRs.Add(cvi); } conn.Close(); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(CVINRs); }