Beispiel #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.project_group_model GetModel(int sid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 sid,deptid,group_name,ps_sid,show_column,remark,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,n1,n2,n3,show,show_name,status,create_person,create_date,update_person,update_date from project_group_model ");
            strSql.Append(" where sid=@sid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sid", SqlDbType.Int, 4)
            };
            parameters[0].Value = sid;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.project_group_model model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into project_group_model(");
            strSql.Append("deptid,group_name,ps_sid,show_column,remark,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,n1,n2,n3,show,show_name,status,create_person,create_date,update_person,update_date)");
            strSql.Append(" values (");
            strSql.Append("@deptid,@group_name,@ps_sid,@show_column,@remark,@v1,@v2,@v3,@v4,@v5,@v6,@v7,@v8,@v9,@v10,@n1,@n2,@n3,@show,@show_name,@status,@create_person,@create_date,@update_person,@update_date)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@deptid",        SqlDbType.Int,         4),
                new SqlParameter("@group_name",    SqlDbType.NVarChar,  100),
                new SqlParameter("@ps_sid",        SqlDbType.NVarChar,   50),
                new SqlParameter("@show_column",   SqlDbType.NVarChar,   50),
                new SqlParameter("@remark",        SqlDbType.Text),
                new SqlParameter("@v1",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v2",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v3",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v4",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v5",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v6",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v7",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v8",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v9",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v10",           SqlDbType.NVarChar,  255),
                new SqlParameter("@n1",            SqlDbType.Int,         4),
                new SqlParameter("@n2",            SqlDbType.Int,         4),
                new SqlParameter("@n3",            SqlDbType.Int,         4),
                new SqlParameter("@show",          SqlDbType.NVarChar,  100),
                new SqlParameter("@show_name",     SqlDbType.NVarChar,  500),
                new SqlParameter("@status",        SqlDbType.Int,         4),
                new SqlParameter("@create_person", SqlDbType.NVarChar,   50),
                new SqlParameter("@create_date",   SqlDbType.DateTime),
                new SqlParameter("@update_person", SqlDbType.NVarChar,   50),
                new SqlParameter("@update_date",   SqlDbType.DateTime)
            };
            parameters[0].Value  = model.deptid;
            parameters[1].Value  = model.group_name;
            parameters[2].Value  = model.ps_sid;
            parameters[3].Value  = model.show_column;
            parameters[4].Value  = model.remark;
            parameters[5].Value  = model.v1;
            parameters[6].Value  = model.v2;
            parameters[7].Value  = model.v3;
            parameters[8].Value  = model.v4;
            parameters[9].Value  = model.v5;
            parameters[10].Value = model.v6;
            parameters[11].Value = model.v7;
            parameters[12].Value = model.v8;
            parameters[13].Value = model.v9;
            parameters[14].Value = model.v10;
            parameters[15].Value = model.n1;
            parameters[16].Value = model.n2;
            parameters[17].Value = model.n3;
            parameters[18].Value = model.show;
            parameters[19].Value = model.show_name;
            parameters[20].Value = model.status;
            parameters[21].Value = model.create_person;
            parameters[22].Value = model.create_date;
            parameters[23].Value = model.update_person;
            parameters[24].Value = model.update_date;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.project_group_model DataRowToModel(DataRow row)
 {
     Maticsoft.Model.project_group_model model = new Maticsoft.Model.project_group_model();
     if (row != null)
     {
         if (row["sid"] != null && row["sid"].ToString() != "")
         {
             model.sid = int.Parse(row["sid"].ToString());
         }
         if (row["deptid"] != null && row["deptid"].ToString() != "")
         {
             model.deptid = int.Parse(row["deptid"].ToString());
         }
         if (row["group_name"] != null)
         {
             model.group_name = row["group_name"].ToString();
         }
         if (row["ps_sid"] != null)
         {
             model.ps_sid = row["ps_sid"].ToString();
         }
         if (row["show_column"] != null)
         {
             model.show_column = row["show_column"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["v1"] != null)
         {
             model.v1 = row["v1"].ToString();
         }
         if (row["v2"] != null)
         {
             model.v2 = row["v2"].ToString();
         }
         if (row["v3"] != null)
         {
             model.v3 = row["v3"].ToString();
         }
         if (row["v4"] != null)
         {
             model.v4 = row["v4"].ToString();
         }
         if (row["v5"] != null)
         {
             model.v5 = row["v5"].ToString();
         }
         if (row["v6"] != null)
         {
             model.v6 = row["v6"].ToString();
         }
         if (row["v7"] != null)
         {
             model.v7 = row["v7"].ToString();
         }
         if (row["v8"] != null)
         {
             model.v8 = row["v8"].ToString();
         }
         if (row["v9"] != null)
         {
             model.v9 = row["v9"].ToString();
         }
         if (row["v10"] != null)
         {
             model.v10 = row["v10"].ToString();
         }
         if (row["n1"] != null && row["n1"].ToString() != "")
         {
             model.n1 = int.Parse(row["n1"].ToString());
         }
         if (row["n2"] != null && row["n2"].ToString() != "")
         {
             model.n2 = int.Parse(row["n2"].ToString());
         }
         if (row["n3"] != null && row["n3"].ToString() != "")
         {
             model.n3 = int.Parse(row["n3"].ToString());
         }
         if (row["show"] != null)
         {
             model.show = row["show"].ToString();
         }
         if (row["show_name"] != null)
         {
             model.show_name = row["show_name"].ToString();
         }
         if (row["status"] != null && row["status"].ToString() != "")
         {
             model.status = int.Parse(row["status"].ToString());
         }
         if (row["create_person"] != null)
         {
             model.create_person = row["create_person"].ToString();
         }
         if (row["create_date"] != null && row["create_date"].ToString() != "")
         {
             model.create_date = DateTime.Parse(row["create_date"].ToString());
         }
         if (row["update_person"] != null)
         {
             model.update_person = row["update_person"].ToString();
         }
         if (row["update_date"] != null && row["update_date"].ToString() != "")
         {
             model.update_date = DateTime.Parse(row["update_date"].ToString());
         }
     }
     return(model);
 }
Beispiel #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.project_group_model model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update project_group_model set ");
            strSql.Append("deptid=@deptid,");
            strSql.Append("group_name=@group_name,");
            strSql.Append("ps_sid=@ps_sid,");
            strSql.Append("show_column=@show_column,");
            strSql.Append("remark=@remark,");
            strSql.Append("v1=@v1,");
            strSql.Append("v2=@v2,");
            strSql.Append("v3=@v3,");
            strSql.Append("v4=@v4,");
            strSql.Append("v5=@v5,");
            strSql.Append("v6=@v6,");
            strSql.Append("v7=@v7,");
            strSql.Append("v8=@v8,");
            strSql.Append("v9=@v9,");
            strSql.Append("v10=@v10,");
            strSql.Append("n1=@n1,");
            strSql.Append("n2=@n2,");
            strSql.Append("n3=@n3,");
            strSql.Append("show=@show,");
            strSql.Append("show_name=@show_name,");
            strSql.Append("status=@status,");
            strSql.Append("create_person=@create_person,");
            strSql.Append("create_date=@create_date,");
            strSql.Append("update_person=@update_person,");
            strSql.Append("update_date=@update_date");
            strSql.Append(" where sid=@sid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@deptid",        SqlDbType.Int,         4),
                new SqlParameter("@group_name",    SqlDbType.NVarChar,  100),
                new SqlParameter("@ps_sid",        SqlDbType.NVarChar,   50),
                new SqlParameter("@show_column",   SqlDbType.NVarChar,   50),
                new SqlParameter("@remark",        SqlDbType.Text),
                new SqlParameter("@v1",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v2",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v3",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v4",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v5",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v6",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v7",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v8",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v9",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v10",           SqlDbType.NVarChar,  255),
                new SqlParameter("@n1",            SqlDbType.Int,         4),
                new SqlParameter("@n2",            SqlDbType.Int,         4),
                new SqlParameter("@n3",            SqlDbType.Int,         4),
                new SqlParameter("@show",          SqlDbType.NVarChar,  100),
                new SqlParameter("@show_name",     SqlDbType.NVarChar,  500),
                new SqlParameter("@status",        SqlDbType.Int,         4),
                new SqlParameter("@create_person", SqlDbType.NVarChar,   50),
                new SqlParameter("@create_date",   SqlDbType.DateTime),
                new SqlParameter("@update_person", SqlDbType.NVarChar,   50),
                new SqlParameter("@update_date",   SqlDbType.DateTime),
                new SqlParameter("@sid",           SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.deptid;
            parameters[1].Value  = model.group_name;
            parameters[2].Value  = model.ps_sid;
            parameters[3].Value  = model.show_column;
            parameters[4].Value  = model.remark;
            parameters[5].Value  = model.v1;
            parameters[6].Value  = model.v2;
            parameters[7].Value  = model.v3;
            parameters[8].Value  = model.v4;
            parameters[9].Value  = model.v5;
            parameters[10].Value = model.v6;
            parameters[11].Value = model.v7;
            parameters[12].Value = model.v8;
            parameters[13].Value = model.v9;
            parameters[14].Value = model.v10;
            parameters[15].Value = model.n1;
            parameters[16].Value = model.n2;
            parameters[17].Value = model.n3;
            parameters[18].Value = model.show;
            parameters[19].Value = model.show_name;
            parameters[20].Value = model.status;
            parameters[21].Value = model.create_person;
            parameters[22].Value = model.create_date;
            parameters[23].Value = model.update_person;
            parameters[24].Value = model.update_date;
            parameters[25].Value = model.sid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }