private static List <SFieldsItems> EntityList(string q) { List <SFieldsItems> list = new List <SFieldsItems>(); using (IDataReader redr = new SQLITE_DAL().Listreader(q)) { while (redr.Read() == true) { SFieldsItems obj = new SFieldsItems() { Sfields_id = redr[SFIELDSITEMS.SFIELDSITEMS_ID].ToString(), Stables_id = redr[SFIELDSITEMS.STABLES_ID].ToString(), Fieldsname = redr[SFIELDSITEMS.FIELDSNAME].ToString(), Displayname = redr[SFIELDSITEMS.DISPLAY_NAME].ToString(), Datatype = redr[SFIELDSITEMS.DATATYPE].ToString(), //Lengths = redr[SFIELDSITEMS.LENGTHS].ToString(), //Pkeys = redr[SFIELDSITEMS.PKEYS].ToString(), //Ifnull = redr[SFIELDSITEMS.IFNULL].ToString(), //Refered_tbl = redr[SFIELDSITEMS.REFEREDTBL].ToString(), Inputtype = redr[SFIELDSITEMS.INPUTTYPE].ToString(), Width = redr[SFIELDSITEMS.WIDTH].ToString() }; list.Add(obj); } } return(list); }
public static void InsertSub(SFieldsItems v, SQLITE_DAL dalsession) { string q = " INSERT INTO " + SFIELDSITEMS.SFIELDSITEMS_TBL + " ( "; //q += " " + SFIELDSITEMS.SFIELDS_ID + " \r\n "; q += "" + SFIELDSITEMS.STABLES_ID + " \r\n "; q += "," + SFIELDSITEMS.FIELDSNAME + " \r\n "; q += "," + SFIELDSITEMS.DISPLAY_NAME + " \r\n "; q += "," + SFIELDSITEMS.DATATYPE + " \r\n "; //q += "," + SFIELDSITEMS.LENGTHS + " \r\n "; //q += "," + SFIELDSITEMS.PKEYS + " \r\n "; //q += "," + SFIELDSITEMS.IFNULL + " \r\n "; //q += "," + SFIELDSITEMS.REFEREDTBL + " \r\n "; q += "," + SFIELDSITEMS.INPUTTYPE + " \r\n "; q += "," + SFIELDSITEMS.WIDTH + " \r\n "; q += " ) VALUES ( "; //q += " @" + SFIELDSITEMS.SFIELDS_ID + "@ \r\n "; q += " @" + SFIELDSITEMS.STABLES_ID + "@ \r\n "; q += ", @" + SFIELDSITEMS.FIELDSNAME + "@ \r\n "; q += ", @" + SFIELDSITEMS.DISPLAY_NAME + "@ \r\n "; q += ", @" + SFIELDSITEMS.DATATYPE + "@ \r\n "; //q += ", @" + SFIELDSITEMS.LENGTHS + "@ \r\n "; //q += ", @" + SFIELDSITEMS.PKEYS + "@ \r\n "; //q += ", @" + SFIELDSITEMS.IFNULL + "@ \r\n "; //q += ", @" + SFIELDSITEMS.REFEREDTBL + "@ \r\n "; q += ", @" + SFIELDSITEMS.INPUTTYPE + "@ \r\n "; q += ", @" + SFIELDSITEMS.WIDTH + "@ \r\n "; q += " ) \r\n "; q = AttachParams(q, v); dalsession.Execute(q); }
private List <SFieldsItems> CollectItems_2(string tableId) { List <SFieldsItems> _table_item_list = new List <SFieldsItems>(); for (int r = 0; r < editgrid_2.RowCount; r++) { SFieldsItems items = new SFieldsItems(); // if ( (editgrid_2[SFIELDSITEMS.DATATYPE, r].Value + "") == "" && //(editgrid_2[SFIELDSITEMS.LENGTHS, r].Value + "") == "" && //(editgrid_2[SFIELDSITEMS.PKEYS, r].Value + "") == "" && //(editgrid_2[SFIELDSITEMS.IFNULL, r].Value + "") == "" && (editgrid_2[SFIELDSITEMS.INPUTTYPE, r].Value + "") == "" && (editgrid_2[SFIELDSITEMS.WIDTH, r].Value + "") == "" ) { //==LEAVE IT(the empty row). } else { items.Sfieldsitems_id = ""; items.Stables_id = tableId; items.Fieldsname = editgrid_2[SFIELDSITEMS.FIELDSNAME, r].Value + "".ToUpper().Trim(); items.Displayname = (editgrid_2[SFIELDSITEMS.DISPLAY_NAME, r].Value + "").ToUpper().Trim(); items.Datatype = (editgrid_2[SFIELDSITEMS.DATATYPE, r].Value + "").Trim(); //items.Lengths = (editgrid_2[SFIELDSITEMS.LENGTHS, r].Value + "").Trim(); //items.Pkeys = (editgrid_2[SFIELDSITEMS.PKEYS, r].Value + "").Trim(); //items.Ifnull = (editgrid_2[SFIELDSITEMS.IFNULL, r].Value + "").Trim(); //items.Refered_tbl = (editgrid_2[SFIELDSITEMS.REFEREDTBL, r].Value + ""); items.Inputtype = (editgrid_2[SFIELDSITEMS.INPUTTYPE, r].Value + ""); items.Width = (editgrid_2[SFIELDSITEMS.WIDTH, r].Value + ""); //if (editgrid_2[SFIELDSITEMS.ALIGNTO, r].Value + "" != "") //{ // items.Alignto = (editgrid_2[SFIELDSITEMS.ALIGNTO, r].Value + ""); //} //else //{ // items.Alignto = AutoCode.Center; //} _table_item_list.Add(items); } } if (_table_item_list.Count != 0) { return(_table_item_list); } return(null); }
private static string AttachParams(string q, SFieldsItems v) { //q = q.Replace("@" + SFIELDSITEMS.SFIELDS_ID + "@", "" + ConvertTO.SqlString(v.Sfields_id) + ""); q = q.Replace("@" + SFIELDSITEMS.STABLES_ID + "@", "" + ConvertTO.SqlString(v.Stables_id) + ""); q = q.Replace("@" + SFIELDSITEMS.FIELDSNAME + "@", "" + ConvertTO.SqlString(v.Fieldsname) + ""); q = q.Replace("@" + SFIELDSITEMS.DISPLAY_NAME + "@", "" + ConvertTO.SqlString(v.Displayname) + ""); q = q.Replace("@" + SFIELDSITEMS.DATATYPE + "@", "" + ConvertTO.SqlString(v.Datatype + "") + ""); //q = q.Replace("@" + SFIELDSITEMS.LENGTHS + "@", "" + ConvertTO.SqlString(v.Lengths) + ""); //q = q.Replace("@" + SFIELDSITEMS.PKEYS + "@", "" + ConvertTO.SqlString(v.Pkeys) + ""); //q = q.Replace("@" + SFIELDSITEMS.IFNULL + "@", "" + ConvertTO.SqlString(v.Ifnull) + ""); //q = q.Replace("@" + SFIELDSITEMS.REFEREDTBL + "@", "" + ConvertTO.SqlString(v.Refered_tbl) + ""); q = q.Replace("@" + SFIELDSITEMS.INPUTTYPE + "@", "" + ConvertTO.SqlString(v.Inputtype) + ""); q = q.Replace("@" + SFIELDSITEMS.WIDTH + "@", "" + ConvertTO.SqlString(v.Width) + ""); return(q); }
public static void Insert(List <SFieldsItems> list, SQLITE_DAL dalsession) { for (int i = 0; i < list.Count; i++) { SFieldsItems obj = new SFieldsItems() { //Sfields_id = list[i].Sfields_id, Stables_id = list[i].Stables_id, Fieldsname = list[i].Fieldsname, Displayname = list[i].Displayname, Datatype = list[i].Datatype, //Lengths = list[i].Lengths, //Pkeys = list[i].Pkeys, //Ifnull = list[i].Ifnull, //Refered_tbl = list[i].Refered_tbl, Inputtype = list[i].Inputtype, Width = list[i].Width, }; InsertSub(obj, dalsession); } }