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

                strSql.Append("update [Lebi_Notice] set ");
                strSql.Append("[NtitleCN]=@NtitleCN,");
                strSql.Append("[NtitleEN]=@NtitleEN,");
                strSql.Append("[NcontentCN]=@NcontentCN,");
                strSql.Append("[NcontentEN]=@NcontentEN,");
                strSql.Append("[Nsort]=@Nsort,");
                strSql.Append("[Typeid]=@Typeid,");
                strSql.Append("[Nsubmittime]=@Nsubmittime");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@NtitleCN",    model.NtitleCN),
                    new OleDbParameter("@NtitleEN",    model.NtitleEN),
                    new OleDbParameter("@NcontentCN",  model.NcontentCN),
                    new OleDbParameter("@NcontentEN",  model.NcontentEN),
                    new OleDbParameter("@Nsort",       model.Nsort),
                    new OleDbParameter("@Typeid",      model.Typeid),
                    new OleDbParameter("@Nsubmittime", model.Nsubmittime.ToString("yyyy-MM-dd HH:mm:ss"))
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Ejemplo n.º 2
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_Notice ReaderBind(IDataReader dataReader)
            {
                Lebi_Notice model = new Lebi_Notice();
                object      ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                model.NtitleCN   = dataReader["NtitleCN"].ToString();
                model.NtitleEN   = dataReader["NtitleEN"].ToString();
                model.NcontentCN = dataReader["NcontentCN"].ToString();
                model.NcontentEN = dataReader["NcontentEN"].ToString();
                ojb = dataReader["Nsort"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Nsort = (int)ojb;
                }
                ojb = dataReader["Typeid"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Typeid = (int)ojb;
                }
                ojb = dataReader["Nsubmittime"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Nsubmittime = (DateTime)ojb;
                }
                return(model);
            }
Ejemplo n.º 3
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Notice SafeBindForm(Lebi_Notice model)
 {
     if (HttpContext.Current.Request["NtitleCN"] != null)
     {
         model.NtitleCN = Shop.Tools.RequestTool.RequestSafeString("NtitleCN");
     }
     if (HttpContext.Current.Request["NtitleEN"] != null)
     {
         model.NtitleEN = Shop.Tools.RequestTool.RequestSafeString("NtitleEN");
     }
     if (HttpContext.Current.Request["NcontentCN"] != null)
     {
         model.NcontentCN = Shop.Tools.RequestTool.RequestSafeString("NcontentCN");
     }
     if (HttpContext.Current.Request["NcontentEN"] != null)
     {
         model.NcontentEN = Shop.Tools.RequestTool.RequestSafeString("NcontentEN");
     }
     if (HttpContext.Current.Request["Nsort"] != null)
     {
         model.Nsort = Shop.Tools.RequestTool.RequestInt("Nsort", 0);
     }
     if (HttpContext.Current.Request["Typeid"] != null)
     {
         model.Typeid = Shop.Tools.RequestTool.RequestInt("Typeid", 0);
     }
     if (HttpContext.Current.Request["Nsubmittime"] != null)
     {
         model.Nsubmittime = Shop.Tools.RequestTool.RequestTime("Nsubmittime", System.DateTime.Now);
     }
     return(model);
 }
Ejemplo n.º 4
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Notice model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Notice] set ");
                strSql.Append("NtitleCN= @NtitleCN,");
                strSql.Append("NtitleEN= @NtitleEN,");
                strSql.Append("NcontentCN= @NcontentCN,");
                strSql.Append("NcontentEN= @NcontentEN,");
                strSql.Append("Nsort= @Nsort,");
                strSql.Append("Typeid= @Typeid,");
                strSql.Append("Nsubmittime= @Nsubmittime");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",          SqlDbType.Int,       4),
                    new SqlParameter("@NtitleCN",    SqlDbType.VarChar, 100),
                    new SqlParameter("@NtitleEN",    SqlDbType.VarChar, 100),
                    new SqlParameter("@NcontentCN",  SqlDbType.Text),
                    new SqlParameter("@NcontentEN",  SqlDbType.Text),
                    new SqlParameter("@Nsort",       SqlDbType.Int,       4),
                    new SqlParameter("@Typeid",      SqlDbType.Int,       4),
                    new SqlParameter("@Nsubmittime", SqlDbType.DateTime)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.NtitleCN;
                parameters[2].Value = model.NtitleEN;
                parameters[3].Value = model.NcontentCN;
                parameters[4].Value = model.NcontentEN;
                parameters[5].Value = model.Nsort;
                parameters[6].Value = model.Typeid;
                parameters[7].Value = model.Nsubmittime;

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

                strSql.Append("insert into [Lebi_Notice](");
                strSql.Append("NtitleCN,NtitleEN,NcontentCN,NcontentEN,Nsort,Typeid,Nsubmittime)");
                strSql.Append(" values (");
                strSql.Append("@NtitleCN,@NtitleEN,@NcontentCN,@NcontentEN,@Nsort,@Typeid,@Nsubmittime)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@NtitleCN",    model.NtitleCN),
                    new SqlParameter("@NtitleEN",    model.NtitleEN),
                    new SqlParameter("@NcontentCN",  model.NcontentCN),
                    new SqlParameter("@NcontentEN",  model.NcontentEN),
                    new SqlParameter("@Nsort",       model.Nsort),
                    new SqlParameter("@Typeid",      model.Typeid),
                    new SqlParameter("@Nsubmittime", model.Nsubmittime)
                };

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

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
Ejemplo n.º 6
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_Notice GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

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

                Lebi_Notice model = new Lebi_Notice();
                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.NtitleCN   = ds.Tables[0].Rows[0]["NtitleCN"].ToString();
                    model.NtitleEN   = ds.Tables[0].Rows[0]["NtitleEN"].ToString();
                    model.NcontentCN = ds.Tables[0].Rows[0]["NcontentCN"].ToString();
                    model.NcontentEN = ds.Tables[0].Rows[0]["NcontentEN"].ToString();
                    if (ds.Tables[0].Rows[0]["Nsort"].ToString() != "")
                    {
                        model.Nsort = int.Parse(ds.Tables[0].Rows[0]["Nsort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Typeid"].ToString() != "")
                    {
                        model.Typeid = int.Parse(ds.Tables[0].Rows[0]["Typeid"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Nsubmittime"].ToString() != "")
                    {
                        model.Nsubmittime = DateTime.Parse(ds.Tables[0].Rows[0]["Nsubmittime"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 7
0
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_Notice 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_Notice] ");
                strSql.Append(" where " + strWhere + "");
                Lebi_Notice model = new Lebi_Notice();
                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.NtitleCN   = ds.Tables[0].Rows[0]["NtitleCN"].ToString();
                    model.NtitleEN   = ds.Tables[0].Rows[0]["NtitleEN"].ToString();
                    model.NcontentCN = ds.Tables[0].Rows[0]["NcontentCN"].ToString();
                    model.NcontentEN = ds.Tables[0].Rows[0]["NcontentEN"].ToString();
                    if (ds.Tables[0].Rows[0]["Nsort"].ToString() != "")
                    {
                        model.Nsort = int.Parse(ds.Tables[0].Rows[0]["Nsort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Typeid"].ToString() != "")
                    {
                        model.Typeid = int.Parse(ds.Tables[0].Rows[0]["Typeid"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Nsubmittime"].ToString() != "")
                    {
                        model.Nsubmittime = DateTime.Parse(ds.Tables[0].Rows[0]["Nsubmittime"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 8
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Notice model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Notice](");
                strSql.Append("[NtitleCN],[NtitleEN],[NcontentCN],[NcontentEN],[Nsort],[Typeid],[Nsubmittime])");
                strSql.Append(" values (");
                strSql.Append("@NtitleCN,@NtitleEN,@NcontentCN,@NcontentEN,@Nsort,@Typeid,@Nsubmittime)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@NtitleCN",    model.NtitleCN),
                    new OleDbParameter("@NtitleEN",    model.NtitleEN),
                    new OleDbParameter("@NcontentCN",  model.NcontentCN),
                    new OleDbParameter("@NcontentEN",  model.NcontentEN),
                    new OleDbParameter("@Nsort",       model.Nsort),
                    new OleDbParameter("@Typeid",      model.Typeid),
                    new OleDbParameter("@Nsubmittime", model.Nsubmittime.ToString("yyyy-MM-dd HH:mm:ss"))
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Ejemplo n.º 9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Notice model)
 {
     D_Lebi_Notice.Instance.Update(model);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Notice model)
 {
     return(D_Lebi_Notice.Instance.Add(model));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Notice SafeBindForm(Lebi_Notice model)
 {
     return(D_Lebi_Notice.Instance.SafeBindForm(model));
 }