예제 #1
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_ImageSize model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_ImageSize](");
                strSql.Append("Width,Height,Time_Add)");
                strSql.Append(" values (");
                strSql.Append("@Width,@Height,@Time_Add)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Width",    model.Width),
                    new SqlParameter("@Height",   model.Height),
                    new SqlParameter("@Time_Add", model.Time_Add)
                };

                object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
예제 #2
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_ImageSize ReaderBind(IDataReader dataReader)
            {
                Lebi_ImageSize model = new Lebi_ImageSize();
                object         ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                ojb = dataReader["Width"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Width = (int)ojb;
                }
                ojb = dataReader["Height"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Height = (int)ojb;
                }
                ojb = dataReader["Time_Add"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Time_Add = (DateTime)ojb;
                }
                return(model);
            }
예제 #3
0
        public int Count(Lebi_ImageSize m)
        {
            string where = "[TableName]='Product' and [Size] not like '%" + m.Width + "$" + m.Height + "%'";
            //string where = "TableName='Product' and Time_Update<'" + m.Time_Add + "'";
            int c = B_Lebi_Image.Counts(where);

            return(c);
        }
예제 #4
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_ImageSize SafeBindForm(Lebi_ImageSize model)
 {
     if (HttpContext.Current.Request["Width"] != null)
     {
         model.Width = Shop.Tools.RequestTool.RequestInt("Width", 0);
     }
     if (HttpContext.Current.Request["Height"] != null)
     {
         model.Height = Shop.Tools.RequestTool.RequestInt("Height", 0);
     }
     if (HttpContext.Current.Request["Time_Add"] != null)
     {
         model.Time_Add = Shop.Tools.RequestTool.RequestTime("Time_Add", System.DateTime.Now);
     }
     return(model);
 }
예제 #5
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_ImageSize model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_ImageSize] set ");
                strSql.Append("[Width]=@Width,");
                strSql.Append("[Height]=@Height,");
                strSql.Append("[Time_Add]=@Time_Add");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Width",    model.Width),
                    new OleDbParameter("@Height",   model.Height),
                    new OleDbParameter("@Time_Add", model.Time_Add.ToString("yyyy-MM-dd HH:mm:ss"))
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
예제 #6
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_ImageSize model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_ImageSize](");
                strSql.Append("[Width],[Height],[Time_Add])");
                strSql.Append(" values (");
                strSql.Append("@Width,@Height,@Time_Add)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Width",    model.Width),
                    new OleDbParameter("@Height",   model.Height),
                    new OleDbParameter("@Time_Add", model.Time_Add.ToString("yyyy-MM-dd HH:mm:ss"))
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
예제 #7
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_ImageSize GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_ImageSize] ");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id", SqlDbType.Int, 4)
                };
                parameters[0].Value = id;

                Lebi_ImageSize model = new Lebi_ImageSize();
                DataSet        ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Width"].ToString() != "")
                    {
                        model.Width = int.Parse(ds.Tables[0].Rows[0]["Width"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Height"].ToString() != "")
                    {
                        model.Height = int.Parse(ds.Tables[0].Rows[0]["Height"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Time_Add"].ToString() != "")
                    {
                        model.Time_Add = DateTime.Parse(ds.Tables[0].Rows[0]["Time_Add"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
예제 #8
0
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_ImageSize GetModel(string strWhere)
            {
                if (strWhere.IndexOf("lbsql{") > 0)
                {
                    SQLPara para = new SQLPara(strWhere, "", "");
                    return(GetModel(para));
                }
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_ImageSize] ");
                strSql.Append(" where " + strWhere + "");
                Lebi_ImageSize model = new Lebi_ImageSize();
                DataSet        ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString());

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Width"].ToString() != "")
                    {
                        model.Width = int.Parse(ds.Tables[0].Rows[0]["Width"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Height"].ToString() != "")
                    {
                        model.Height = int.Parse(ds.Tables[0].Rows[0]["Height"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Time_Add"].ToString() != "")
                    {
                        model.Time_Add = DateTime.Parse(ds.Tables[0].Rows[0]["Time_Add"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
예제 #9
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_ImageSize model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_ImageSize] set ");
                strSql.Append("Width= @Width,");
                strSql.Append("Height= @Height,");
                strSql.Append("Time_Add= @Time_Add");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",       SqlDbType.Int, 4),
                    new SqlParameter("@Width",    SqlDbType.Int, 4),
                    new SqlParameter("@Height",   SqlDbType.Int, 4),
                    new SqlParameter("@Time_Add", SqlDbType.DateTime)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Width;
                parameters[2].Value = model.Height;
                parameters[3].Value = model.Time_Add;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
예제 #10
0
        /// <summary>
        /// 根据主题重新设置系统图片尺寸
        /// </summary>
        public static void UpdteImageSize()
        {
            BaseConfig           mx    = ShopCache.GetBaseConfig();
            List <Lebi_Language> langs = B_Lebi_Language.GetList("", "");
            Lebi_ImageSize       model;

            string ids = "0";

            //检查系统默认的规格
            model = B_Lebi_ImageSize.GetModel("Width=" + mx.ImageBigWidth + " and Height=" + mx.ImageBigHeight + "");
            if (model == null)
            {
                model        = new Lebi_ImageSize();
                model.Width  = mx.ImageBigWidth;
                model.Height = mx.ImageBigHeight;
                B_Lebi_ImageSize.Add(model);
                ids += "," + B_Lebi_ImageSize.GetMaxId();
            }
            else
            {
                ids += "," + model.id;
            }
            model = B_Lebi_ImageSize.GetModel("Width=" + mx.ImageMediumWidth + " and Height=" + mx.ImageMediumHeight + "");
            if (model == null)
            {
                model        = new Lebi_ImageSize();
                model.Width  = mx.ImageMediumWidth;
                model.Height = mx.ImageMediumHeight;
                B_Lebi_ImageSize.Add(model);
                ids += "," + B_Lebi_ImageSize.GetMaxId();
            }
            else
            {
                ids += "," + model.id;
            }
            model = B_Lebi_ImageSize.GetModel("Width=" + mx.ImageSmallWidth + " and Height=" + mx.ImageSmallHeight + "");
            if (model == null)
            {
                model        = new Lebi_ImageSize();
                model.Width  = mx.ImageSmallWidth;
                model.Height = mx.ImageSmallHeight;
                B_Lebi_ImageSize.Add(model);
                ids += "," + B_Lebi_ImageSize.GetMaxId();
            }
            else
            {
                ids += "," + model.id;
            }
            foreach (Lebi_Language lang in langs)
            {
                Lebi_Theme theme = B_Lebi_Theme.GetModel(lang.Theme_id);
                if (theme == null)
                {
                    continue;
                }
                //model = B_Lebi_ImageSize.GetModel("Width=" + theme.ImageBig_Width + " and Height=" + theme.ImageBig_Height + "");
                //if (model == null)
                //{
                //    model = new Lebi_ImageSize();
                //    model.Width = theme.ImageBig_Width;
                //    model.Height = theme.ImageBig_Height;
                //    B_Lebi_ImageSize.Add(model);
                //    ids += "," + B_Lebi_ImageSize.GetMaxId();
                //}
                //else
                //{
                //    ids += "," + model.id;
                //}
                model = B_Lebi_ImageSize.GetModel("Width=" + theme.ImageMedium_Width + " and Height=" + theme.ImageMedium_Height + "");
                if (model == null)
                {
                    model        = new Lebi_ImageSize();
                    model.Width  = theme.ImageMedium_Width;
                    model.Height = theme.ImageMedium_Height;
                    B_Lebi_ImageSize.Add(model);
                    ids += "," + B_Lebi_ImageSize.GetMaxId();
                }
                else
                {
                    ids += "," + model.id;
                }
                //model = B_Lebi_ImageSize.GetModel("Width=" + theme.ImageSmall_Width + " and Height=" + theme.ImageSmall_Height + "");
                //if (model == null)
                //{
                //    model = new Lebi_ImageSize();
                //    model.Width = theme.ImageSmall_Width;
                //    model.Height = theme.ImageSmall_Height;
                //    B_Lebi_ImageSize.Add(model);
                //    ids += "," + B_Lebi_ImageSize.GetMaxId();
                //}
                //else
                //{
                //    ids += "," + model.id;
                //}
            }
            B_Lebi_ImageSize.Delete("id not in (" + ids + ")");
        }
예제 #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_ImageSize model)
 {
     D_Lebi_ImageSize.Instance.Update(model);
 }
예제 #12
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_ImageSize model)
 {
     return(D_Lebi_ImageSize.Instance.Add(model));
 }
예제 #13
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_ImageSize SafeBindForm(Lebi_ImageSize model)
 {
     return(D_Lebi_ImageSize.Instance.SafeBindForm(model));
 }