public Boolean updateBankBranch(bankbranch branch) { Boolean status = true; string utString = ""; try { string updateSQL = "update BankBranch set BankID='" + branch.BankID + "', BranchName='" + branch.BranchName + "', Address1='" + branch.Address1 + "', Address2='" + branch.Address2 + "', Address3='" + branch.Address3 + "', IFSCCode='" + branch.IFSCCode + "', SWIFTCode='" + branch.SWIFTCode + "', MICRCode='" + branch.MICRCode + "', BSRCode='" + branch.BSRCode + "',Status=" + branch.status + " where rowID=" + branch.BranchID; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("update", "BankBranch", "", 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 List <bankbranch> getBankBranches() { bankbranch branch; List <bankbranch> BankBranches = new List <bankbranch>(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select a.RowID, a.BankID, b.Description BankName,a.BranchName,a.Address1,a.Address2,a.Address3,a.IFSCCOde,a.SWIFTCode,a.MICRCode,a.BSRCode,a.status " + " from BankBranch a, CatalogueValue b" + " where a.BankID=b.CatalogueValueID and b.CatalogueID='Bank' " + " order by a.BankID,a.BranchName"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { branch = new bankbranch(); branch.BranchID = reader.GetInt32(0); branch.BankID = reader.GetString(1); branch.BankName = reader.GetString(2); branch.BranchName = reader.GetString(3); branch.Address1 = reader.GetString(4); branch.Address2 = reader.GetString(5); branch.Address3 = reader.GetString(6); branch.IFSCCode = reader.GetString(7); branch.SWIFTCode = reader.IsDBNull(8)?"": reader.GetString(8); branch.MICRCode = reader.GetString(9); branch.BSRCode = reader.GetString(10); branch.status = reader.GetInt32(11); BankBranches.Add(branch); } conn.Close(); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(BankBranches); }
public Boolean validateBankBranch(bankbranch branch) { Boolean status = true; try { if (branch.BankID.Trim().Length == 0 || branch.BankID == null) { return(false); } if (branch.BranchName.Trim().Length == 0 || branch.BranchName == null) { return(false); } //////if (branch.IFSCCode.Trim().Length >11) //////{ ////// return false; //////} //////if (branch.MICRCode.Trim().Length > 11) //////{ ////// return false; //////} //////if (branch.BSRCode.Trim().Length > 7) //////{ ////// return false; //////} //////if(branch.SWIFTCode.Trim().Length <8 || branch.SWIFTCode.Trim().Length>11) //////{ ////// return false; //////} } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); return(false); } return(status); }
public bankbranch getBankBrancheDetails(string bankID, string branchName) { bankbranch branch = new bankbranch(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select a.RowID, a.BankID, b.Description BankName,a.BranchName,a.Address1,a.Address2,a.Address3,a.IFSCCOde,a.MICRCode,a.BSRCode,a.status " + " from BankBranch a, CatalogueValue b" + " where a.BankID=b.CatalogueValueID and b.CatalogueID='Bank' " + " and a.BankID='" + bankID + "' and a.BranchName='" + branchName + "'"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { branch = new bankbranch(); branch.BranchID = reader.GetInt32(0); branch.BankID = reader.GetString(1); branch.BankName = reader.GetString(2); branch.BranchName = reader.GetString(3); branch.Address1 = reader.GetString(4); branch.Address2 = reader.GetString(5); branch.Address3 = reader.GetString(6); branch.IFSCCode = reader.GetString(7); branch.MICRCode = reader.GetString(8); branch.BSRCode = reader.GetString(9); branch.status = reader.GetInt32(10); } conn.Close(); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(branch); }
public Boolean insertBankBranch(bankbranch branch) { Boolean status = true; string utString = ""; try { string updateSQL = "insert into BankBranch (BankID,BranchName,Address1,Address2,Address3,IFSCCode,SWIFTCode,MICRCOde,BSRCode,Status,CreateTime,CreateUser)" + "values (" + "'" + branch.BankID + "'," + "'" + branch.BranchName + "'," + "'" + branch.Address1 + "'," + "'" + branch.Address2 + "'," + "'" + branch.Address3 + "'," + "'" + branch.IFSCCode + "'," + "'" + branch.SWIFTCode + "'," + "'" + branch.MICRCode + "'," + "'" + branch.BSRCode + "'," + branch.status + "," + "GETDATE()" + "," + "'" + Login.userLoggedIn + "'" + ")"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("insert", "BankBranch", "", 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); }