private static Cxversion GetOldData(int id, string OldDB) { string q = "USE " + OldDB + "; "; q += "SELECT * FROM " + CXVERSION.CXVERSION_TBL + " WHERE " + CXVERSION.CXVERSION_ID + " = '" + id + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Cxversion obj = new Cxversion { Cxversion_name = redr[CXVERSION.CXVERSION_NAME].ToString(), Created_on = redr[CXVERSION.CREATED_ON].ToString(), Changes = redr[CXVERSION.CHANGES].ToString(), Notes = redr[CXVERSION.NOTES].ToString(), Active_id = redr[CXVERSION.ACTIVE_ID].ToString(), User_id = "1" }; return(obj); } return(null); } }
private static List <Cxversion> EntityList(string q) { List <Cxversion> list = new List <Cxversion>(); using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Cxversion obj = new Cxversion() { Cxversion_id = redr[CXVERSION.CXVERSION_ID].ToString(), Cxversion_name = redr[CXVERSION.CXVERSION_NAME].ToString(), Created_on = redr[CXVERSION.CREATED_ON].ToString(), Changes = redr[CXVERSION.CHANGES].ToString(), Notes = redr[CXVERSION.NOTES].ToString(), Active_id = redr[CXVERSION.ACTIVE_ID].ToString(), User_id = redr[USER.USER_NAME].ToString() }; list.Add(obj); } redr.Close(); } return(list); }
private static void InsertData(Cxversion obj, string newDB) { if (CheckData(obj, newDB) == false) { CCxversion.Insert(obj, new DAL()); } ; }
public static string GetId_Name(string v) { Cxversion obj = SearchName(v); if (obj != null) { return(obj.Cxversion_id); } return(""); }
public static string GetName_Id(string v) { Cxversion obj = PKId(v); if (obj != null) { return(obj.Cxversion_name); } return(""); }
private static string AttachParams(string q, Cxversion v) { q = q.Replace("@" + CXVERSION.CXVERSION_ID + "@", "" + ConvertTO.SqlString(v.Cxversion_id) + ""); q = q.Replace("@" + CXVERSION.CXVERSION_NAME + "@", "" + ConvertTO.SqlString(v.Cxversion_name) + ""); q = q.Replace("@" + CXVERSION.CREATED_ON + "@", "" + ConvertTO.SqlDate(v.Created_on) + ""); q = q.Replace("@" + CXVERSION.CHANGES + "@", "" + ConvertTO.SqlString(v.Changes) + ""); q = q.Replace("@" + CXVERSION.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + ""); q = q.Replace("@" + CXVERSION.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + ""); q = q.Replace("@" + CXVERSION.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + ""); return(q); }
public static void Update(Cxversion v, DAL dalsession) { string q = "UPDATE " + CXVERSION.CXVERSION_TBL + " SET"; q += " " + CXVERSION.CXVERSION_NAME + " = @" + CXVERSION.CXVERSION_NAME + "@ \r\n "; q += "," + CXVERSION.CREATED_ON + " = @" + CXVERSION.CREATED_ON + "@ \r\n "; q += "," + CXVERSION.CHANGES + " = @" + CXVERSION.CHANGES + "@ \r\n "; q += "," + CXVERSION.NOTES + " = @" + CXVERSION.NOTES + "@ \r\n "; q += "," + CXVERSION.ACTIVE_ID + " = @" + CXVERSION.ACTIVE_ID + "@ \r\n "; q += "," + CXVERSION.USER_ID + " = @" + CXVERSION.USER_ID + "@ \r\n "; q += " WHERE " + CXVERSION.CXVERSION_ID + " = @" + CXVERSION.CXVERSION_ID + "@ "; q = AttachParams(q, v); dalsession.Execute(q); }
private Cxversion CollectData() { Cxversion fobj = new Cxversion() { Cxversion_id = vId, Cxversion_name = txt_cxversion_name.Text, Created_on = txt_created_on.Text, Changes = txt_changes.Text, Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; return(fobj); }
private static bool CheckData(Cxversion obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + CXVERSION.CXVERSION_TBL + " WHERE " + CXVERSION.CXVERSION_NAME + " = '" + obj.Cxversion_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Cxversion_id = redr[CXVERSION.CXVERSION_ID].ToString(); CCxversion.Update(obj, new DAL()); return(true); } return(false); } }
public static void Insert(Cxversion v, DAL dalsession) { string q = " INSERT INTO " + CXVERSION.CXVERSION_TBL + " ( "; q += " " + CXVERSION.CXVERSION_NAME + " \r\n "; q += "," + CXVERSION.CREATED_ON + " \r\n "; q += "," + CXVERSION.CHANGES + " \r\n "; q += "," + CXVERSION.NOTES + " \r\n "; q += "," + CXVERSION.ACTIVE_ID + " \r\n "; q += "," + CXVERSION.USER_ID + " \r\n "; q += " ) VALUES ( "; q += " @" + CXVERSION.CXVERSION_NAME + "@ \r\n "; q += ", @" + CXVERSION.CREATED_ON + "@ \r\n "; q += ", @" + CXVERSION.CHANGES + "@ \r\n "; q += ", @" + CXVERSION.NOTES + "@ \r\n "; q += ", @" + CXVERSION.ACTIVE_ID + "@ \r\n "; q += ", @" + CXVERSION.USER_ID + "@ \r\n "; q += " ) \r\n "; q = AttachParams(q, v); dalsession.Execute(q); }
public void SetAction(BtnEvent action, string pk) { fAction = action; switch (fAction) { case BtnEvent.Open: btn_save.Text = "&CLOSE"; obj = CCxversion_exten.PKId(pk); this.EnableControls(false); break; case BtnEvent.New: btn_save.Text = "&SAVE"; obj = CCxversion.GetNew; this.EnableControls(true); break; case BtnEvent.Edit: btn_save.Text = "&UPDATE"; obj = CCxversion_exten.PKId(pk); this.EnableControls(true); break; case BtnEvent.Delete: btn_save.Text = "CONFIRM\r\n&DELETE"; obj = CCxversion_exten.PKId(pk); this.EnableControls(false); break; case BtnEvent.Print: btn_save.Text = "&PRINT"; obj = CCxversion_exten.PKId(pk); this.EnableControls(false); break; } this.LoadData(); }