Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_small_link DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_small_link model=new MxWeiXinPF.Model.wx_small_link();
     if (row != null)
     {
         if(row["id"]!=null && row["id"].ToString()!="")
         {
             model.id=int.Parse(row["id"].ToString());
         }
         if(row["sName"]!=null)
         {
             model.sName=row["sName"].ToString();
         }
         if(row["url"]!=null)
         {
             model.url=row["url"].ToString();
         }
         if(row["sType"]!=null)
         {
             model.sType=row["sType"].ToString();
         }
         if(row["sortId"]!=null && row["sortId"].ToString()!="")
         {
             model.sortId=int.Parse(row["sortId"].ToString());
         }
         if(row["isGlobal"]!=null && row["isGlobal"].ToString()!="")
         {
             if((row["isGlobal"].ToString()=="1")||(row["isGlobal"].ToString().ToLower()=="true"))
             {
                 model.isGlobal=true;
             }
             else
             {
                 model.isGlobal=false;
             }
         }
         if(row["companyName"]!=null)
         {
             model.companyName=row["companyName"].ToString();
         }
         if(row["comTel"]!=null)
         {
             model.comTel=row["comTel"].ToString();
         }
         if(row["remark"]!=null)
         {
             model.remark=row["remark"].ToString();
         }
     }
     return model;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_small_link DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_small_link model = new MxWeiXinPF.Model.wx_small_link();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["sName"] != null)
         {
             model.sName = row["sName"].ToString();
         }
         if (row["url"] != null)
         {
             model.url = row["url"].ToString();
         }
         if (row["sType"] != null)
         {
             model.sType = row["sType"].ToString();
         }
         if (row["sortId"] != null && row["sortId"].ToString() != "")
         {
             model.sortId = int.Parse(row["sortId"].ToString());
         }
         if (row["isGlobal"] != null && row["isGlobal"].ToString() != "")
         {
             if ((row["isGlobal"].ToString() == "1") || (row["isGlobal"].ToString().ToLower() == "true"))
             {
                 model.isGlobal = true;
             }
             else
             {
                 model.isGlobal = false;
             }
         }
         if (row["companyName"] != null)
         {
             model.companyName = row["companyName"].ToString();
         }
         if (row["comTel"] != null)
         {
             model.comTel = row["comTel"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MxWeiXinPF.Model.wx_small_link model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_small_link set ");
            strSql.Append("sName=@sName,");
            strSql.Append("url=@url,");
            strSql.Append("sType=@sType,");
            strSql.Append("sortId=@sortId,");
            strSql.Append("isGlobal=@isGlobal,");
            strSql.Append("companyName=@companyName,");
            strSql.Append("comTel=@comTel,");
            strSql.Append("remark=@remark");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sName",       SqlDbType.VarChar,  100),
                new SqlParameter("@url",         SqlDbType.VarChar, 1000),
                new SqlParameter("@sType",       SqlDbType.VarChar,   50),
                new SqlParameter("@sortId",      SqlDbType.Int,        4),
                new SqlParameter("@isGlobal",    SqlDbType.Bit,        1),
                new SqlParameter("@companyName", SqlDbType.VarChar,  100),
                new SqlParameter("@comTel",      SqlDbType.VarChar,   50),
                new SqlParameter("@remark",      SqlDbType.VarChar, 1000),
                new SqlParameter("@id",          SqlDbType.Int, 4)
            };
            parameters[0].Value = model.sName;
            parameters[1].Value = model.url;
            parameters[2].Value = model.sType;
            parameters[3].Value = model.sortId;
            parameters[4].Value = model.isGlobal;
            parameters[5].Value = model.companyName;
            parameters[6].Value = model.comTel;
            parameters[7].Value = model.remark;
            parameters[8].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MxWeiXinPF.Model.wx_small_link model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_small_link(");
            strSql.Append("sName,url,sType,sortId,isGlobal,companyName,comTel,remark)");
            strSql.Append(" values (");
            strSql.Append("@sName,@url,@sType,@sortId,@isGlobal,@companyName,@comTel,@remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sName",       SqlDbType.VarChar,  100),
                new SqlParameter("@url",         SqlDbType.VarChar, 1000),
                new SqlParameter("@sType",       SqlDbType.VarChar,   50),
                new SqlParameter("@sortId",      SqlDbType.Int,        4),
                new SqlParameter("@isGlobal",    SqlDbType.Bit,        1),
                new SqlParameter("@companyName", SqlDbType.VarChar,  100),
                new SqlParameter("@comTel",      SqlDbType.VarChar,   50),
                new SqlParameter("@remark",      SqlDbType.VarChar, 1000)
            };
            parameters[0].Value = model.sName;
            parameters[1].Value = model.url;
            parameters[2].Value = model.sType;
            parameters[3].Value = model.sortId;
            parameters[4].Value = model.isGlobal;
            parameters[5].Value = model.companyName;
            parameters[6].Value = model.comTel;
            parameters[7].Value = model.remark;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

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

            strSql.Append("select  top 1 id,sName,url,sType,sortId,isGlobal,companyName,comTel,remark from wx_small_link ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            MxWeiXinPF.Model.wx_small_link model = new MxWeiXinPF.Model.wx_small_link();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_small_link GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,sName,url,sType,sortId,isGlobal,companyName,comTel,remark from wx_small_link ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            MxWeiXinPF.Model.wx_small_link model=new MxWeiXinPF.Model.wx_small_link();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }