コード例 #1
0
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_ProDesc 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_ProDesc] ");
                strSql.Append(" where " + strWhere + "");
                Lebi_ProDesc model = new Lebi_ProDesc();
                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());
                    }
                    model.Description = ds.Tables[0].Rows[0]["Description"].ToString();
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
コード例 #2
0
            /// <summary>
            /// 得到一个对象实体 by SQLpara
            /// </summary>
            public Lebi_ProDesc GetModel(SQLPara para)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select top 1 * from [Lebi_ProDesc] ");
                if (para.Where != "")
                {
                    strSql.Append(" where " + para.Where + "");
                }
                Lebi_ProDesc model = new Lebi_ProDesc();
                DataSet      ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), para.Para);

                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());
                    }
                    model.Description = ds.Tables[0].Rows[0]["Description"].ToString();
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
コード例 #3
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_ProDesc model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_ProDesc](");
                strSql.Append("Description)");
                strSql.Append(" values (");
                strSql.Append("@Description)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Description", model.Description)
                };

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

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
コード例 #4
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_ProDesc GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

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

                Lebi_ProDesc model = new Lebi_ProDesc();
                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());
                    }
                    model.Description = ds.Tables[0].Rows[0]["Description"].ToString();
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
コード例 #5
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_ProDesc SafeBindForm(Lebi_ProDesc model)
 {
     if (HttpContext.Current.Request["Description"] != null)
     {
         model.Description = Shop.Tools.RequestTool.RequestSafeString("Description");
     }
     return(model);
 }
コード例 #6
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_ProDesc ReaderBind(IDataReader dataReader)
            {
                Lebi_ProDesc model = new Lebi_ProDesc();
                object       ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                model.Description = dataReader["Description"].ToString();
                return(model);
            }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("prodesc_edit", "编辑商品通用描述"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            model = B_Lebi_ProDesc.GetList("", "").FirstOrDefault();
            if (model == null)
            {
                model = new Lebi_ProDesc();
            }
        }
コード例 #8
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_ProDesc model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_ProDesc] set ");
                strSql.Append("[Description]=@Description");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Description", model.Description)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
コード例 #9
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_ProDesc model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_ProDesc](");
                strSql.Append("[Description])");
                strSql.Append(" values (");
                strSql.Append("@Description)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Description", model.Description)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
コード例 #10
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_ProDesc model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_ProDesc] set ");
                strSql.Append("Description= @Description");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",          SqlDbType.Int, 4),
                    new SqlParameter("@Description", SqlDbType.NText)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Description;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
コード例 #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_ProDesc model)
 {
     D_Lebi_ProDesc.Instance.Update(model);
 }
コード例 #12
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_ProDesc model)
 {
     return(D_Lebi_ProDesc.Instance.Add(model));
 }
コード例 #13
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_ProDesc SafeBindForm(Lebi_ProDesc model)
 {
     return(D_Lebi_ProDesc.Instance.SafeBindForm(model));
 }