public Boolean insertCatalogueValue(cataloguevalue catval) { Boolean status = true; string utString = ""; try { string updateSQL = "insert into CatalogueValue (catalogueValueID,Description,CatalogueID,Status,CreateTime,CreateUser)" + "values (" + "'" + catval.catalogueValueID + "'," + "'" + catval.description + "'," + "'" + catval.catalogueID + "'," + catval.status + "," + "GETDATE()" + "," + "'" + Login.userLoggedIn + "'" + ")"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("insert", "CatalogueValue", "", 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 <cataloguevalue> getCatalogueValues() { cataloguevalue catval; List <cataloguevalue> CatalogueValues = new List <cataloguevalue>(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select a.CatalogueValueID, a.Description,a.CatalogueID,b.Description,a.status " + "from CatalogueValue a, Catalogue b where a.CatalogueID=b.CatalogueID order by a.CatalogueID,a.Description"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { catval = new cataloguevalue(); catval.catalogueValueID = reader.GetString(0); catval.description = reader.GetString(1); catval.catalogueID = reader.GetString(2); catval.cataloguedescription = reader.GetString(3); catval.status = reader.GetInt32(4); CatalogueValues.Add(catval); } conn.Close(); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(CatalogueValues); }
public Boolean updateCatalogueValue(cataloguevalue catval) { Boolean status = true; string utString = ""; try { string updateSQL = "update CatalogueValue set Description='" + catval.description + "',CatalogueID='" + catval.catalogueID + "',Status=" + catval.status + " where CatalogueValueID='" + catval.catalogueValueID + "'"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("update", "CatalogueValue", "", 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 Boolean validateCatalogue(cataloguevalue catval) { Boolean status = true; try { if (catval.catalogueValueID.Trim().Length == 0 || catval.catalogueValueID == null || catval.catalogueValueID.IndexOf('-') >= 0) { return(false); } if (catval.description.Trim().Length == 0 || catval.description == null) { return(false); } if (catval.catalogueID.Trim().Length == 0 || catval.catalogueID == null) { return(false); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); return(false); } return(status); }