public static void InsertSub(MasterTablesItems v, SQLITE_DAL dalsession) { string q = " INSERT INTO " + MASTERTABLESITEMS.MASTERTABLESITEMS_TBL + " ( "; q += " " + MASTERTABLESITEMS.FIELDSNAME + " \r\n "; q += "," + MASTERTABLESITEMS.MASTERTABLES_ID + " \r\n "; q += "," + MASTERTABLESITEMS.DISPLAYNAME + " \r\n "; q += "," + MASTERTABLESITEMS.DATATYPE + " \r\n "; q += "," + MASTERTABLESITEMS.INPUTTYPE + " \r\n "; q += "," + MASTERTABLESITEMS.WIDTH + " \r\n "; q += "," + MASTERTABLESITEMS.HEIGHT + " \r\n "; q += "," + MASTERTABLESITEMS.CPOSITION + " \r\n "; q += "," + MASTERTABLESITEMS.RPOSITION + " \r\n "; q += "," + MASTERTABLESITEMS.VALIDATE + " \r\n "; q += "," + MASTERTABLESITEMS.ISDEFAULT + " \r\n "; q += "," + MASTERTABLESITEMS.PLACEMENT + " \r\n "; q += "," + MASTERTABLESITEMS.ALIGNTO + " \r\n "; q += " ) VALUES ( "; q += " @" + MASTERTABLESITEMS.FIELDSNAME + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.MASTERTABLES_ID + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.DISPLAYNAME + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.DATATYPE + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.INPUTTYPE + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.WIDTH + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.HEIGHT + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.CPOSITION + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.RPOSITION + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.VALIDATE + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.ISDEFAULT + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.PLACEMENT + "@ \r\n "; q += ", @" + MASTERTABLESITEMS.ALIGNTO + "@ \r\n "; q += " ) \r\n "; q = AttachParams(q, v); dalsession.Execute(q); }
private static List <MasterTablesItems> GetFields(int table_id) { string q = "SELECT * FROM " + MASTERTABLESITEMS.MASTERTABLESITEMS_TBL + " WHERE " + MASTERTABLES.MASTERTABLES_ID + " =" + table_id; List <MasterTablesItems> list = new List <MasterTablesItems>(); using (IDataReader redr = new SQLITE_DAL().Listreader(q)) { while (redr.Read() == true) { MasterTablesItems obj = new MasterTablesItems() { Mtablesitems_id = redr[MASTERTABLESITEMS.MASTERTABLESITEMS_ID].ToString(), Mtables_id = redr[MASTERTABLESITEMS.MASTERTABLES_ID].ToString(), Fieldsname = redr[MASTERTABLESITEMS.FIELDSNAME].ToString(), Displayname = redr[MASTERTABLESITEMS.DISPLAYNAME].ToString(), Datatype = redr[MASTERTABLESITEMS.DATATYPE].ToString(), Inputtype = redr[MASTERTABLESITEMS.INPUTTYPE].ToString(), Width = redr[MASTERTABLESITEMS.WIDTH].ToString(), Height = redr[MASTERTABLESITEMS.HEIGHT].ToString(), Cposition = redr[MASTERTABLESITEMS.CPOSITION].ToString(), Rposition = redr[MASTERTABLESITEMS.RPOSITION].ToString(), Validate = redr[MASTERTABLESITEMS.VALIDATE].ToString(), Isdefault = redr[MASTERTABLESITEMS.ISDEFAULT].ToString(), Placement = redr[MASTERTABLESITEMS.PLACEMENT].ToString(), Alignto = redr[MASTERTABLESITEMS.ALIGNTO].ToString(), }; list.Add(obj); } } return(list); }
private static string AttachParams(string q, MasterTablesItems v) { q = q.Replace("@" + MASTERTABLESITEMS.FIELDSNAME + "@", "" + ConvertTO.SqlString(v.Fieldsname) + ""); q = q.Replace("@" + MASTERTABLESITEMS.MASTERTABLES_ID + "@", "" + ConvertTO.SqlString(v.Mtables_id) + ""); q = q.Replace("@" + MASTERTABLESITEMS.DISPLAYNAME + "@", "" + ConvertTO.SqlString(v.Displayname) + ""); q = q.Replace("@" + MASTERTABLESITEMS.DATATYPE + "@", "" + ConvertTO.SqlString(v.Datatype) + ""); q = q.Replace("@" + MASTERTABLESITEMS.INPUTTYPE + "@", "" + ConvertTO.SqlString(v.Inputtype) + ""); q = q.Replace("@" + MASTERTABLESITEMS.WIDTH + "@", "" + ConvertTO.SqlString(v.Width) + ""); q = q.Replace("@" + MASTERTABLESITEMS.HEIGHT + "@", "" + ConvertTO.SqlString(v.Height) + ""); q = q.Replace("@" + MASTERTABLESITEMS.CPOSITION + "@", "" + ConvertTO.SqlString(v.Cposition) + ""); q = q.Replace("@" + MASTERTABLESITEMS.RPOSITION + "@", "" + ConvertTO.SqlString(v.Rposition) + ""); q = q.Replace("@" + MASTERTABLESITEMS.VALIDATE + "@", "" + ConvertTO.SqlString(v.Validate) + ""); q = q.Replace("@" + MASTERTABLESITEMS.ISDEFAULT + "@", "" + ConvertTO.SqlString(v.Isdefault) + ""); q = q.Replace("@" + MASTERTABLESITEMS.PLACEMENT + "@", "" + ConvertTO.SqlString(v.Placement) + ""); q = q.Replace("@" + MASTERTABLESITEMS.ALIGNTO + "@", "" + ConvertTO.SqlString(v.Alignto) + ""); return(q); }
List <MasterTablesItems> CollectItems(string tableId) { List <MasterTablesItems> _table_item_list = new List <MasterTablesItems>(); for (int r = 0; r < editgrid.RowCount; r++) { MasterTablesItems items = new MasterTablesItems(); // if ( (editgrid[MASTERTABLESITEMS.DATATYPE, r].Value + "") == "" && (editgrid[MASTERTABLESITEMS.INPUTTYPE, r].Value + "") == "" && (editgrid[MASTERTABLESITEMS.WIDTH, r].Value + "") == "" && (editgrid[MASTERTABLESITEMS.HEIGHT, r].Value + "") == "" ) { //==LEAVE IT(the empty row). } else { items.Mtablesitems_id = ""; items.Mtables_id = tableId; items.Fieldsname = editgrid[MASTERTABLESITEMS.FIELDSNAME, r].Value + "".ToUpper().Trim(); items.Displayname = (editgrid[MASTERTABLESITEMS.DISPLAYNAME, r].Value + "").ToUpper().Trim(); items.Datatype = (editgrid[MASTERTABLESITEMS.DATATYPE, r].Value + "").Trim(); items.Inputtype = (editgrid[MASTERTABLESITEMS.INPUTTYPE, r].Value + ""); items.Width = (editgrid[MASTERTABLESITEMS.WIDTH, r].Value + ""); items.Height = (editgrid[MASTERTABLESITEMS.HEIGHT, r].Value + ""); items.Cposition = (editgrid[MASTERTABLESITEMS.CPOSITION, r].Value + ""); items.Rposition = (editgrid[MASTERTABLESITEMS.RPOSITION, r].Value + ""); items.Validate = (editgrid[MASTERTABLESITEMS.VALIDATE, r].Value + ""); items.Isdefault = (editgrid[MASTERTABLESITEMS.ISDEFAULT, r].Value + ""); items.Placement = (editgrid[MASTERTABLESITEMS.PLACEMENT, r].Value + ""); items.Alignto = (editgrid[MASTERTABLESITEMS.ALIGNTO, r].Value + ""); _table_item_list.Add(items); } } if (_table_item_list.Count != 0) { return(_table_item_list); } return(null); }
public static void Insert(List <MasterTablesItems> list, SQLITE_DAL dalsession) { for (int i = 0; i < list.Count; i++) { MasterTablesItems obj = new MasterTablesItems() { Fieldsname = list[i].Fieldsname, Mtables_id = list[i].Mtables_id, Displayname = list[i].Displayname, Datatype = list[i].Datatype, Inputtype = list[i].Inputtype, Width = list[i].Width, Height = list[i].Height, Cposition = list[i].Cposition, Rposition = list[i].Rposition, Validate = list[i].Validate, Isdefault = list[i].Isdefault, Placement = list[i].Placement, Alignto = list[i].Alignto }; InsertSub(obj, dalsession); } }