private static string AttachParams(string q, Deliveredto v) { q = q.Replace("@" + DELIVEREDTO.DELIVEREDTO_ID + "@", "" + ConvertTO.SqlString(v.Deliveredto_id) + ""); q = q.Replace("@" + DELIVEREDTO.DELIVEREDTO_NAME + "@", "" + ConvertTO.SqlString(v.Deliveredto_name) + ""); q = q.Replace("@" + DELIVEREDTO.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + ""); q = q.Replace("@" + DELIVEREDTO.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + ""); q = q.Replace("@" + DELIVEREDTO.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + ""); return(q); }
private static void InsertData(Deliveredto obj, string newDB) { if (CheckData(obj, newDB) == false) { obj.Deliveredto_name = ChangeCase.UpperFirst(obj.Deliveredto_name); CDeliveredto.Insert(obj, new DAL()); } ; }
public static string GetId_Name(string _pName) { Deliveredto obj = SearchName(_pName, new DAL()); if (obj != null) { return(obj.Deliveredto_id); } return(""); }
public static string GetName_Id(string _pId) { Deliveredto obj = PKId(_pId, new DAL()); if (obj != null) { return(obj.Deliveredto_name); } return(""); }
public static void Update(Deliveredto v, DAL dalsession) { string q = "UPDATE " + DELIVEREDTO.DELIVEREDTO_TBL + " SET"; q += " " + DELIVEREDTO.DELIVEREDTO_NAME + " = @" + DELIVEREDTO.DELIVEREDTO_NAME + "@ \r\n "; q += "," + DELIVEREDTO.NOTES + " = @" + DELIVEREDTO.NOTES + "@ \r\n "; q += "," + DELIVEREDTO.ACTIVE_ID + " = @" + DELIVEREDTO.ACTIVE_ID + "@ \r\n "; q += "," + DELIVEREDTO.USER_ID + " = @" + DELIVEREDTO.USER_ID + "@ \r\n "; q += " WHERE " + DELIVEREDTO.DELIVEREDTO_ID + " = @" + DELIVEREDTO.DELIVEREDTO_ID + "@ "; q = AttachParams(q, v); dalsession.Execute(q); }
private Deliveredto CollectData() { Deliveredto fobj = new Deliveredto() { Deliveredto_id = vId, Deliveredto_name = ChangeCase.UpperFirst(txt_deliveredto_name.Text), Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; return(fobj); }
public static void Insert(Deliveredto v, DAL dalsession) { string q = " INSERT INTO " + DELIVEREDTO.DELIVEREDTO_TBL + " ( "; q += " " + DELIVEREDTO.DELIVEREDTO_NAME + " \r\n "; q += "," + DELIVEREDTO.NOTES + " \r\n "; q += "," + DELIVEREDTO.ACTIVE_ID + " \r\n "; q += "," + DELIVEREDTO.USER_ID + " \r\n "; q += " ) VALUES ( "; q += " @" + DELIVEREDTO.DELIVEREDTO_NAME + "@ \r\n "; q += ", @" + DELIVEREDTO.NOTES + "@ \r\n "; q += ", @" + DELIVEREDTO.ACTIVE_ID + "@ \r\n "; q += ", @" + DELIVEREDTO.USER_ID + "@ \r\n "; q += " ) \r\n "; q = AttachParams(q, v); dalsession.Execute(q); }
private static bool CheckData(Deliveredto obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + DELIVEREDTO.DELIVEREDTO_TBL + " WHERE " + DELIVEREDTO.DELIVEREDTO_NAME + " = '" + obj.Deliveredto_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Deliveredto_id = redr[DELIVEREDTO.DELIVEREDTO_ID].ToString(); obj.Deliveredto_name = ChangeCase.UpperFirst(obj.Deliveredto_name); CDeliveredto.Update(obj, new DAL()); return(true); } return(false); } }
private static Deliveredto EntityData(string q) { using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Deliveredto obj = new Deliveredto() { Deliveredto_id = redr[DELIVEREDTO.DELIVEREDTO_ID].ToString(), Deliveredto_name = redr[DELIVEREDTO.DELIVEREDTO_NAME].ToString(), Notes = redr[DELIVEREDTO.NOTES].ToString(), Active_id = redr[DELIVEREDTO.ACTIVE_ID].ToString(), User_id = redr[USER.USER_NAME].ToString() }; return(obj); } redr.Close(); return(new Deliveredto()); } }
public void SetAction(BtnEvent pAction, string pPkValue) { fAction = pAction; switch (fAction) { case BtnEvent.Open: btn_save.Text = "&CLOSE"; obj = CDeliveredto_exten.PKId(pPkValue, new DAL()); this.EnableControls(false); break; case BtnEvent.New: btn_save.Text = "&SAVE"; obj = CDeliveredto.GetNew; this.EnableControls(true); break; case BtnEvent.Edit: btn_save.Text = "&UPDATE"; obj = CDeliveredto_exten.PKId(pPkValue, new DAL()); this.EnableControls(true); break; case BtnEvent.Delete: btn_save.Text = "CONFIRM\r\n&DELETE"; obj = CDeliveredto_exten.PKId(pPkValue, new DAL()); this.EnableControls(false); break; case BtnEvent.Print: btn_save.Text = "&PRINT"; obj = CDeliveredto_exten.PKId(pPkValue, new DAL()); this.EnableControls(false); break; } this.LoadData(); }
private static Deliveredto GetOldData(int id, string OldDB) { string q = "USE " + OldDB + "; "; q += "SELECT * FROM DELIVERYTO_TBL WHERE DELIVERYTO_ID = '" + id + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Deliveredto obj = new Deliveredto { Deliveredto_name = redr["DELIVERYTO_NAME"].ToString(), Notes = redr[DELIVEREDTO.NOTES].ToString(), Active_id = redr[DELIVEREDTO.ACTIVE_ID].ToString(), User_id = "1" }; return(obj); } return(null); } }
private static List <Deliveredto> EntityList(string q) { List <Deliveredto> list = new List <Deliveredto>(); using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Deliveredto obj = new Deliveredto() { Deliveredto_id = redr[DELIVEREDTO.DELIVEREDTO_ID].ToString(), Deliveredto_name = redr[DELIVEREDTO.DELIVEREDTO_NAME].ToString(), Notes = redr[DELIVEREDTO.NOTES].ToString(), Active_id = redr[DELIVEREDTO.ACTIVE_ID].ToString(), User_id = redr[USER.USER_NAME].ToString() }; list.Add(obj); } redr.Close(); } return(list); }