Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Lebi_Order_ProPerty model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + TableName + " set ");
            List <string> cols = new List <string>();

            if (("," + model.UpdateCols + ",").IndexOf(",Order_Code,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("Order_Code") + "= @Order_Code");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",Order_id,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("Order_id") + "= @Order_id");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",ProPertyid,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("ProPertyid") + "= @ProPertyid");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",ProPertyName,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("ProPertyName") + "= @ProPertyName");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",ProPertyParentid,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("ProPertyParentid") + "= @ProPertyParentid");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",ProPertyValue,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("ProPertyValue") + "= @ProPertyValue");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",Time_Add,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("Time_Add") + "= @Time_Add");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",User_id,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("User_id") + "= @User_id");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",User_UserName,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("User_UserName") + "= @User_UserName");
            }
            strSql.Append(string.Join(",", cols));
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",               model.id),
                new SqlParameter("@Order_Code",       model.Order_Code),
                new SqlParameter("@Order_id",         model.Order_id),
                new SqlParameter("@ProPertyid",       model.ProPertyid),
                new SqlParameter("@ProPertyName",     model.ProPertyName),
                new SqlParameter("@ProPertyParentid", model.ProPertyParentid),
                new SqlParameter("@ProPertyValue",    model.ProPertyValue),
                new SqlParameter("@Time_Add",         model.Time_Add),
                new SqlParameter("@User_id",          model.User_id),
                new SqlParameter("@User_UserName",    model.User_UserName)
            };
            LB.DataAccess.DB.Instance.TextExecuteNonQuery(strSql.ToString().Replace(", where id=@id", " where id=@id"), parameters);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Lebi_Order_ProPerty model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into " + TableName + " (");
            strSql.Append(LB.DataAccess.DB.BaseUtilsInstance.ColName("Order_Code") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("Order_id") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("ProPertyid") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("ProPertyName") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("ProPertyParentid") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("ProPertyValue") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("Time_Add") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("User_id") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("User_UserName") + ")");
            strSql.Append(" values (");
            strSql.Append("@Order_Code,@Order_id,@ProPertyid,@ProPertyName,@ProPertyParentid,@ProPertyValue,@Time_Add,@User_id,@User_UserName);select @@identity;");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Order_Code",       model.Order_Code),
                new SqlParameter("@Order_id",         model.Order_id),
                new SqlParameter("@ProPertyid",       model.ProPertyid),
                new SqlParameter("@ProPertyName",     model.ProPertyName),
                new SqlParameter("@ProPertyParentid", model.ProPertyParentid),
                new SqlParameter("@ProPertyValue",    model.ProPertyValue),
                new SqlParameter("@Time_Add",         model.Time_Add),
                new SqlParameter("@User_id",          model.User_id),
                new SqlParameter("@User_UserName",    model.User_UserName)
            };

            object obj = LB.DataAccess.DB.Instance.TextExecute(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体 by where条件
        /// </summary>
        public Lebi_Order_ProPerty GetModel(string strWhere, int seconds = 0)
        {
            if (strWhere.IndexOf("lbsql{") > 0)
            {
                SQLPara para = new SQLPara(strWhere, "", "");
                return(GetModel(para, seconds));
            }
            string strTableName = TableName;
            string strFieldShow = "*";
            string cachekey     = "";
            string cachestr     = "";

            if (BaseUtils.BaseUtilsInstance.MemcacheInstance != null && seconds > 0)
            {
                cachestr = "select * " + TableName + " where " + strWhere + "|" + seconds;
                cachekey = LB.Tools.Utils.MD5(cachestr);
                var obj = LB.DataAccess.DB.Instance.GetMemchche(cachekey);
                if (obj != null)
                {
                    return(obj as Lebi_Order_ProPerty);
                }
            }
            Lebi_Order_ProPerty model = null;

            using (IDataReader dataReader = LB.DataAccess.DB.Instance.TextExecuteReaderOne(strTableName, strFieldShow, strWhere, null))
            {
                if (dataReader == null)
                {
                    return(null);
                }
                while (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                    if (cachekey != "")
                    {
                        LB.DataAccess.DB.Instance.SetMemchche(cachekey, model, "Lebi_Order_ProPerty", model.id, cachestr, seconds);
                    }
                    return(model);
                }
            }
            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public Lebi_Order_ProPerty ReaderBind(IDataReader dataReader)
        {
            Lebi_Order_ProPerty model = new Lebi_Order_ProPerty();
            object ojb;

            ojb = dataReader["id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.id = Convert.ToInt32(ojb);
            }
            model.Order_Code = dataReader["Order_Code"].ToString();
            ojb = dataReader["Order_id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Order_id = Convert.ToInt32(ojb);
            }
            ojb = dataReader["ProPertyid"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ProPertyid = Convert.ToInt32(ojb);
            }
            model.ProPertyName = dataReader["ProPertyName"].ToString();
            ojb = dataReader["ProPertyParentid"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ProPertyParentid = Convert.ToInt32(ojb);
            }
            model.ProPertyValue = dataReader["ProPertyValue"].ToString();
            ojb = dataReader["Time_Add"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Time_Add = (DateTime)ojb;
            }
            ojb = dataReader["User_id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.User_id = Convert.ToInt32(ojb);
            }
            model.User_UserName = dataReader["User_UserName"].ToString();
            return(model);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Order_ProPerty SafeBindForm(Lebi_Order_ProPerty model)
 {
     if (HttpContext.Current.Request["Order_Code"] != null)
     {
         model.Order_Code = LB.Tools.RequestTool.RequestSafeString("Order_Code");
     }
     if (HttpContext.Current.Request["Order_id"] != null)
     {
         model.Order_id = LB.Tools.RequestTool.RequestInt("Order_id", 0);
     }
     if (HttpContext.Current.Request["ProPertyid"] != null)
     {
         model.ProPertyid = LB.Tools.RequestTool.RequestInt("ProPertyid", 0);
     }
     if (HttpContext.Current.Request["ProPertyName"] != null)
     {
         model.ProPertyName = LB.Tools.RequestTool.RequestSafeString("ProPertyName");
     }
     if (HttpContext.Current.Request["ProPertyParentid"] != null)
     {
         model.ProPertyParentid = LB.Tools.RequestTool.RequestInt("ProPertyParentid", 0);
     }
     if (HttpContext.Current.Request["ProPertyValue"] != null)
     {
         model.ProPertyValue = LB.Tools.RequestTool.RequestSafeString("ProPertyValue");
     }
     if (HttpContext.Current.Request["Time_Add"] != null)
     {
         model.Time_Add = LB.Tools.RequestTool.RequestTime("Time_Add", System.DateTime.Now);
     }
     if (HttpContext.Current.Request["User_id"] != null)
     {
         model.User_id = LB.Tools.RequestTool.RequestInt("User_id", 0);
     }
     if (HttpContext.Current.Request["User_UserName"] != null)
     {
         model.User_UserName = LB.Tools.RequestTool.RequestSafeString("User_UserName");
     }
     return(model);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Order_ProPerty model)
 {
     D_Lebi_Order_ProPerty.Instance.Update(model);
 }
Exemplo n.º 7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Order_ProPerty model)
 {
     return(D_Lebi_Order_ProPerty.Instance.Add(model));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Order_ProPerty SafeBindForm(Lebi_Order_ProPerty model)
 {
     return(D_Lebi_Order_ProPerty.Instance.SafeBindForm(model));
 }