コード例 #1
0
ファイル: dbContext.cs プロジェクト: lixiangyi/FoolFrame
        private String createSerialNo(IObjectProxy proxy, Property property)
        {
            var    str        = property.Format;
            var    nostrs     = str.Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries);
            string Fomate     = "";
            int    len        = 0;
            var    dataFormat = "";
            int    prelen     = 0;

            foreach (var item in nostrs)
            {
                if (item == "S")
                {
                }
                else if (item[0] == 'S')
                {
                    //时间
                    var strs = item.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                    len = System.Convert.ToInt32(strs[0].Substring(1));
                    if (strs.Length > 1)
                    {
                        prelen = System.Convert.ToInt32(strs[1]);
                    }
                }
                else if (item[0] == 'D')
                {
                    var date = new Soway.DB.DBContext(GetSqlCon(proxy.Model).ToString()).GetServerDateTime().ToString(item.Substring(1));
                    Fomate += date;
                }
                else if (item[0] == 's')
                {
                    Fomate += item.Substring(1);
                }
                else
                {
                    Fomate += item.Trim();
                }
            }
            string getPreStr = Fomate;

            if (prelen == 0)
            {
                prelen = Fomate.Length;
            }
            if (string.IsNullOrEmpty(Fomate) == false)
            {
                getPreStr = Fomate.Substring(0, prelen);
            }
            //   //// // System.Diagnostics.Trace.WriteLine("preLen:" + getPreStr);
            var s = new Soway.DB.DBContext(GetSqlCon(proxy.Model).ToString()).GetSerialNo(getPreStr, len, "");

            return(s.Insert(prelen, Fomate.Substring(prelen, Fomate.Length - prelen)));
        }
コード例 #2
0
        public Model GetModel(Type type)
        {
            String sql = String.Format(@"
            SELECT   [MODEL_ID]
          FROM [SW_SYS_MODEL]
          where[MODEL_CLASS] = '{0}' ", type.FullName);

            var dbtable = new Soway.DB.DBContext(this.Con.ToString()).GetDataTable(sql);

            if (dbtable.Rows.Count == 0)
            {
                return(null);
            }
            return(new Soway.Model.SqlServer.ObjectContext <Model>(this.Con, this.ConFac).GetDetail(dbtable.Rows[0][0]));
        }
コード例 #3
0
ファイル: AppFac.cs プロジェクト: lixiangyi/FoolFrame
        public List <Application> GetApps()
        {
            var db = new Soway.DB.DBContext(this.SqlCon.ToString());

            return(db.Get <Application>());
        }