コード例 #1
0
ファイル: CSFields.cs プロジェクト: CODEXSUN/codexdotnet
 public static void Insert(List <SFields> list, SQLITE_DAL dalsession)
 {
     for (int i = 0; i < list.Count; i++)
     {
         SFields obj = new SFields()
         {
             //Sfields_id = list[i].Sfields_id,
             Stables_id  = list[i].Stables_id,
             Fieldsname  = list[i].Fieldsname,
             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,
             Alignto     = list[i].Alignto,
             Validate    = list[i].Validate,
             Isdefault   = list[i].Isdefault,
             Placement   = list[i].Placement,
             Readonly    = list[i].Readonly
         };
         InsertSub(obj, dalsession);
     }
 }
コード例 #2
0
        private List <SFields> CollectItems(string tableId)
        {
            List <SFields> _table_item_list = new List <SFields>();

            for (int r = 0; r < editgrid.RowCount; r++)
            {
                SFields items = new SFields();
                //
                if (
                    (editgrid[SFIELDS.DATATYPE, r].Value + "") == "" &&
                    //(editgrid[SFIELDS.LENGTHS, r].Value + "") == "" &&
                    //(editgrid[SFIELDS.PKEYS, r].Value + "") == "" &&
                    //(editgrid[SFIELDS.IFNULL, r].Value + "") == "" &&
                    (editgrid[SFIELDS.INPUTTYPE, r].Value + "") == "" &&
                    (editgrid[SFIELDS.WIDTH, r].Value + "") == "" &&
                    (editgrid[SFIELDS.HEIGHT, r].Value + "") == ""
                    )
                {
                    //==LEAVE IT(the empty row).
                }
                else
                {
                    items.Sfields_id  = "";
                    items.Stables_id  = tableId;
                    items.Fieldsname  = editgrid[SFIELDS.FIELDSNAME, r].Value + "".ToUpper().Trim();
                    items.Displayname = (editgrid[SFIELDS.DISPLAY_NAME, r].Value + "").ToUpper().Trim();
                    items.Datatype    = (editgrid[SFIELDS.DATATYPE, r].Value + "").Trim();
                    items.Inputtype   = (editgrid[SFIELDS.INPUTTYPE, r].Value + "");
                    items.Width       = (editgrid[SFIELDS.WIDTH, r].Value + "");
                    items.Height      = (editgrid[SFIELDS.HEIGHT, r].Value + "");
                    items.Cposition   = (editgrid[SFIELDS.CPOSITION, r].Value + "");
                    items.Rposition   = (editgrid[SFIELDS.RPOSITION, r].Value + "");
                    items.Alignto     = (editgrid[SFIELDS.ALIGNTO, r].Value + "");
                    items.Validate    = (editgrid[SFIELDS.VALIDATE, r].Value + "");
                    items.Isdefault   = (editgrid[SFIELDS.ISDEFAULT, r].Value + "");
                    items.Placement   = (editgrid[SFIELDS.PLACEMENT, r].Value + "");
                    items.Readonly    = (editgrid[SFIELDS.READONLY, r].Value + "");

                    _table_item_list.Add(items);
                }
            }
            if (_table_item_list.Count != 0)
            {
                return(_table_item_list);
            }
            return(null);
        }
コード例 #3
0
ファイル: CSFields.cs プロジェクト: CODEXSUN/codexdotnet
 private static string AttachParams(string q, SFields v)
 {
     //q = q.Replace("@" + SFIELDS.SFIELDS_ID + "@", "" + ConvertTO.SqlString(v.Sfields_id) + "");
     q = q.Replace("@" + SFIELDS.STABLES_ID + "@", "" + ConvertTO.SqlString(v.Stables_id) + "");
     q = q.Replace("@" + SFIELDS.FIELDSNAME + "@", "" + ConvertTO.SqlString(v.Fieldsname) + "");
     q = q.Replace("@" + SFIELDS.DISPLAY_NAME + "@", "" + ConvertTO.SqlString(v.Displayname) + "");
     q = q.Replace("@" + SFIELDS.DATATYPE + "@", "" + ConvertTO.SqlString(v.Datatype + "") + "");
     q = q.Replace("@" + SFIELDS.INPUTTYPE + "@", "" + ConvertTO.SqlString(v.Inputtype) + "");
     q = q.Replace("@" + SFIELDS.WIDTH + "@", "" + ConvertTO.SqlString(v.Width) + "");
     q = q.Replace("@" + SFIELDS.HEIGHT + "@", "" + ConvertTO.SqlString(v.Height) + "");
     q = q.Replace("@" + SFIELDS.CPOSITION + "@", "" + ConvertTO.SqlString(v.Cposition) + "");
     q = q.Replace("@" + SFIELDS.RPOSITION + "@", "" + ConvertTO.SqlString(v.Rposition) + "");
     q = q.Replace("@" + SFIELDS.ALIGNTO + "@", "" + ConvertTO.SqlString(v.Alignto) + "");
     q = q.Replace("@" + SFIELDS.VALIDATE + "@", "" + ConvertTO.SqlString(v.Validate) + "");
     q = q.Replace("@" + SFIELDS.ISDEFAULT + "@", "" + ConvertTO.SqlString(v.Isdefault) + "");
     q = q.Replace("@" + SFIELDS.PLACEMENT + "@", "" + ConvertTO.SqlString(v.Placement) + "");
     q = q.Replace("@" + SFIELDS.READONLY + "@", "" + ConvertTO.SqlString(v.Readonly) + "");
     return(q);
 }
コード例 #4
0
ファイル: CSFields.cs プロジェクト: CODEXSUN/codexdotnet
        public static void InsertSub(SFields v, SQLITE_DAL dalsession)
        {
            string q = " INSERT INTO " + SFIELDS.SFIELDS_TBL + " ( ";

            //q += " " + SFIELDS.SFIELDS_ID + " \r\n ";
            q += "" + SFIELDS.STABLES_ID + " \r\n ";
            q += "," + SFIELDS.FIELDSNAME + " \r\n ";
            q += "," + SFIELDS.DISPLAY_NAME + " \r\n ";
            q += "," + SFIELDS.DATATYPE + " \r\n ";
            q += "," + SFIELDS.INPUTTYPE + " \r\n ";
            q += "," + SFIELDS.WIDTH + " \r\n ";
            q += "," + SFIELDS.HEIGHT + " \r\n ";
            q += "," + SFIELDS.CPOSITION + " \r\n ";
            q += "," + SFIELDS.RPOSITION + " \r\n ";
            q += "," + SFIELDS.ALIGNTO + " \r\n ";
            q += "," + SFIELDS.VALIDATE + " \r\n ";
            q += "," + SFIELDS.ISDEFAULT + " \r\n ";
            q += "," + SFIELDS.PLACEMENT + " \r\n ";
            q += "," + SFIELDS.READONLY + " \r\n ";
            q += " ) VALUES ( ";
            //q += "  @" + SFIELDS.SFIELDS_ID + "@ \r\n ";
            q += " @" + SFIELDS.STABLES_ID + "@ \r\n ";
            q += ", @" + SFIELDS.FIELDSNAME + "@ \r\n ";
            q += ", @" + SFIELDS.DISPLAY_NAME + "@ \r\n ";
            q += ", @" + SFIELDS.DATATYPE + "@ \r\n ";
            q += ", @" + SFIELDS.INPUTTYPE + "@ \r\n ";
            q += ", @" + SFIELDS.WIDTH + "@ \r\n ";
            q += ", @" + SFIELDS.HEIGHT + "@ \r\n ";
            q += ", @" + SFIELDS.CPOSITION + "@ \r\n ";
            q += ", @" + SFIELDS.RPOSITION + "@ \r\n ";
            q += ", @" + SFIELDS.ALIGNTO + "@ \r\n ";
            q += ", @" + SFIELDS.VALIDATE + "@ \r\n ";
            q += ", @" + SFIELDS.ISDEFAULT + "@ \r\n ";
            q += ", @" + SFIELDS.PLACEMENT + "@ \r\n ";
            q += ", @" + SFIELDS.READONLY + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
コード例 #5
0
        private static List <SFields> EntityList(string q)
        {
            List <SFields> list = new List <SFields>();

            using (IDataReader redr = new SQLITE_DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    SFields obj = new SFields()
                    {
                        Sfields_id  = redr[SFIELDS.SFIELDS_ID].ToString(),
                        Stables_id  = redr[SFIELDS.STABLES_ID].ToString(),
                        Fieldsname  = redr[SFIELDS.FIELDSNAME].ToString(),
                        Displayname = redr[SFIELDS.DISPLAY_NAME].ToString(),
                        Datatype    = redr[SFIELDS.DATATYPE].ToString(),
                        //Lengths = redr[SFIELDS.LENGTHS].ToString(),
                        //Pkeys = redr[SFIELDS.PKEYS].ToString(),
                        //Ifnull = redr[SFIELDS.IFNULL].ToString(),
                        //Refered_tbl = redr[SFIELDS.REFEREDTBL].ToString(),
                        Inputtype = redr[SFIELDS.INPUTTYPE].ToString(),
                        Width     = redr[SFIELDS.WIDTH].ToString(),
                        Height    = redr[SFIELDS.HEIGHT].ToString(),
                        Cposition = redr[SFIELDS.CPOSITION].ToString(),
                        Rposition = redr[SFIELDS.RPOSITION].ToString(),
                        Alignto   = redr[SFIELDS.ALIGNTO].ToString(),
                        Validate  = redr[SFIELDS.VALIDATE].ToString(),
                        Isdefault = redr[SFIELDS.ISDEFAULT].ToString(),
                        Placement = redr[SFIELDS.PLACEMENT].ToString(),
                        Readonly  = redr[SFIELDS.READONLY].ToString(),
                    };

                    list.Add(obj);
                }
            }
            return(list);
        }