Ejemplo n.º 1
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Shop.Model.Lebi_Mail_tpl SafeBindForm(Shop.Model.Lebi_Mail_tpl model)
 {
     if (HttpContext.Current.Request["Mail_zc_Title"] != null)
     {
         model.Mail_zc_Title = Shop.Tools.RequestTool.RequestSafeString("Mail_zc_Title");
     }
     if (HttpContext.Current.Request["Mail_zc_Content"] != null)
     {
         model.Mail_zc_Content = Shop.Tools.RequestTool.RequestSafeString("Mail_zc_Content");
     }
     if (HttpContext.Current.Request["Mail_dd_Title"] != null)
     {
         model.Mail_dd_Title = Shop.Tools.RequestTool.RequestSafeString("Mail_dd_Title");
     }
     if (HttpContext.Current.Request["Mail_dd_Content"] != null)
     {
         model.Mail_dd_Content = Shop.Tools.RequestTool.RequestSafeString("Mail_dd_Content");
     }
     if (HttpContext.Current.Request["Mail_ddqrfh_Title"] != null)
     {
         model.Mail_ddqrfh_Title = Shop.Tools.RequestTool.RequestSafeString("Mail_ddqrfh_Title");
     }
     if (HttpContext.Current.Request["Mail_ddqrfh_content"] != null)
     {
         model.Mail_ddqrfh_content = Shop.Tools.RequestTool.RequestSafeString("Mail_ddqrfh_content");
     }
     return(model);
 }
Ejemplo n.º 2
0
            /// <summary>
            /// 得到一个对象实体 by SQLpara
            /// </summary>
            public Shop.Model.Lebi_Mail_tpl GetModel(SQLPara para)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select top 1 * from [Lebi_Mail_tpl] ");
                if (para.Where != "")
                {
                    strSql.Append(" where " + para.Where + "");
                }
                Shop.Model.Lebi_Mail_tpl model = new Shop.Model.Lebi_Mail_tpl();
                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.Mail_zc_Title       = ds.Tables[0].Rows[0]["Mail_zc_Title"].ToString();
                    model.Mail_zc_Content     = ds.Tables[0].Rows[0]["Mail_zc_Content"].ToString();
                    model.Mail_dd_Title       = ds.Tables[0].Rows[0]["Mail_dd_Title"].ToString();
                    model.Mail_dd_Content     = ds.Tables[0].Rows[0]["Mail_dd_Content"].ToString();
                    model.Mail_ddqrfh_Title   = ds.Tables[0].Rows[0]["Mail_ddqrfh_Title"].ToString();
                    model.Mail_ddqrfh_content = ds.Tables[0].Rows[0]["Mail_ddqrfh_content"].ToString();
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 3
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Shop.Model.Lebi_Mail_tpl GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

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

                Shop.Model.Lebi_Mail_tpl model = new Shop.Model.Lebi_Mail_tpl();
                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.Mail_zc_Title       = ds.Tables[0].Rows[0]["Mail_zc_Title"].ToString();
                    model.Mail_zc_Content     = ds.Tables[0].Rows[0]["Mail_zc_Content"].ToString();
                    model.Mail_dd_Title       = ds.Tables[0].Rows[0]["Mail_dd_Title"].ToString();
                    model.Mail_dd_Content     = ds.Tables[0].Rows[0]["Mail_dd_Content"].ToString();
                    model.Mail_ddqrfh_Title   = ds.Tables[0].Rows[0]["Mail_ddqrfh_Title"].ToString();
                    model.Mail_ddqrfh_content = ds.Tables[0].Rows[0]["Mail_ddqrfh_content"].ToString();
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 4
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Shop.Model.Lebi_Mail_tpl model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Mail_tpl] set ");
                strSql.Append("Mail_zc_Title= @Mail_zc_Title,");
                strSql.Append("Mail_zc_Content= @Mail_zc_Content,");
                strSql.Append("Mail_dd_Title= @Mail_dd_Title,");
                strSql.Append("Mail_dd_Content= @Mail_dd_Content,");
                strSql.Append("Mail_ddqrfh_Title= @Mail_ddqrfh_Title,");
                strSql.Append("Mail_ddqrfh_content= @Mail_ddqrfh_content");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",                  SqlDbType.Int,         4),
                    new SqlParameter("@Mail_zc_Title",       SqlDbType.NVarChar,  200),
                    new SqlParameter("@Mail_zc_Content",     SqlDbType.NVarChar, 2000),
                    new SqlParameter("@Mail_dd_Title",       SqlDbType.NVarChar,  200),
                    new SqlParameter("@Mail_dd_Content",     SqlDbType.NVarChar, 2000),
                    new SqlParameter("@Mail_ddqrfh_Title",   SqlDbType.NVarChar,  200),
                    new SqlParameter("@Mail_ddqrfh_content", SqlDbType.NVarChar, 2000)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Mail_zc_Title;
                parameters[2].Value = model.Mail_zc_Content;
                parameters[3].Value = model.Mail_dd_Title;
                parameters[4].Value = model.Mail_dd_Content;
                parameters[5].Value = model.Mail_ddqrfh_Title;
                parameters[6].Value = model.Mail_ddqrfh_content;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Ejemplo n.º 5
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Shop.Model.Lebi_Mail_tpl model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Mail_tpl](");
                strSql.Append("Mail_zc_Title,Mail_zc_Content,Mail_dd_Title,Mail_dd_Content,Mail_ddqrfh_Title,Mail_ddqrfh_content)");
                strSql.Append(" values (");
                strSql.Append("@Mail_zc_Title,@Mail_zc_Content,@Mail_dd_Title,@Mail_dd_Content,@Mail_ddqrfh_Title,@Mail_ddqrfh_content)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Mail_zc_Title",       model.Mail_zc_Title),
                    new SqlParameter("@Mail_zc_Content",     model.Mail_zc_Content),
                    new SqlParameter("@Mail_dd_Title",       model.Mail_dd_Title),
                    new SqlParameter("@Mail_dd_Content",     model.Mail_dd_Content),
                    new SqlParameter("@Mail_ddqrfh_Title",   model.Mail_ddqrfh_Title),
                    new SqlParameter("@Mail_ddqrfh_content", model.Mail_ddqrfh_content)
                };

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

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
Ejemplo n.º 6
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Shop.Model.Lebi_Mail_tpl ReaderBind(IDataReader dataReader)
            {
                Shop.Model.Lebi_Mail_tpl model = new Shop.Model.Lebi_Mail_tpl();
                object ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                model.Mail_zc_Title       = dataReader["Mail_zc_Title"].ToString();
                model.Mail_zc_Content     = dataReader["Mail_zc_Content"].ToString();
                model.Mail_dd_Title       = dataReader["Mail_dd_Title"].ToString();
                model.Mail_dd_Content     = dataReader["Mail_dd_Content"].ToString();
                model.Mail_ddqrfh_Title   = dataReader["Mail_ddqrfh_Title"].ToString();
                model.Mail_ddqrfh_content = dataReader["Mail_ddqrfh_content"].ToString();
                return(model);
            }
Ejemplo n.º 7
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Shop.Model.Lebi_Mail_tpl model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Mail_tpl](");
                strSql.Append("[Mail_zc_Title],[Mail_zc_Content],[Mail_dd_Title],[Mail_dd_Content],[Mail_ddqrfh_Title],[Mail_ddqrfh_content])");
                strSql.Append(" values (");
                strSql.Append("@Mail_zc_Title,@Mail_zc_Content,@Mail_dd_Title,@Mail_dd_Content,@Mail_ddqrfh_Title,@Mail_ddqrfh_content)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Mail_zc_Title",       model.Mail_zc_Title),
                    new OleDbParameter("@Mail_zc_Content",     model.Mail_zc_Content),
                    new OleDbParameter("@Mail_dd_Title",       model.Mail_dd_Title),
                    new OleDbParameter("@Mail_dd_Content",     model.Mail_dd_Content),
                    new OleDbParameter("@Mail_ddqrfh_Title",   model.Mail_ddqrfh_Title),
                    new OleDbParameter("@Mail_ddqrfh_content", model.Mail_ddqrfh_content)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Ejemplo n.º 8
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Shop.Model.Lebi_Mail_tpl model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Mail_tpl] set ");
                strSql.Append("[Mail_zc_Title]=@Mail_zc_Title,");
                strSql.Append("[Mail_zc_Content]=@Mail_zc_Content,");
                strSql.Append("[Mail_dd_Title]=@Mail_dd_Title,");
                strSql.Append("[Mail_dd_Content]=@Mail_dd_Content,");
                strSql.Append("[Mail_ddqrfh_Title]=@Mail_ddqrfh_Title,");
                strSql.Append("[Mail_ddqrfh_content]=@Mail_ddqrfh_content");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Mail_zc_Title",       model.Mail_zc_Title),
                    new OleDbParameter("@Mail_zc_Content",     model.Mail_zc_Content),
                    new OleDbParameter("@Mail_dd_Title",       model.Mail_dd_Title),
                    new OleDbParameter("@Mail_dd_Content",     model.Mail_dd_Content),
                    new OleDbParameter("@Mail_ddqrfh_Title",   model.Mail_ddqrfh_Title),
                    new OleDbParameter("@Mail_ddqrfh_content", model.Mail_ddqrfh_content)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }