Example #1
0
        public bool Update(PEIS.Model.SYSUserSection model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SYSUserSection set ");
            strSql.Append("SectionID=@SectionID,");
            strSql.Append("UserID=@UserID,");
            strSql.Append("OperatorID=@OperatorID,");
            strSql.Append("CreateDate=@CreateDate");
            strSql.Append(" where UserSectionID=@UserSectionID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SectionID",     SqlDbType.Int,       4),
                new SqlParameter("@UserID",        SqlDbType.Int,       4),
                new SqlParameter("@OperatorID",    SqlDbType.Int,       4),
                new SqlParameter("@CreateDate",    SqlDbType.DateTime),
                new SqlParameter("@UserSectionID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.SectionID;
            parameters[1].Value = model.UserID;
            parameters[2].Value = model.OperatorID;
            parameters[3].Value = model.CreateDate;
            parameters[4].Value = model.UserSectionID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        public List <PEIS.Model.SYSUserSection> DataTableToList(DataTable dt)
        {
            List <PEIS.Model.SYSUserSection> list = new List <PEIS.Model.SYSUserSection>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    PEIS.Model.SYSUserSection natUserSection = new PEIS.Model.SYSUserSection();
                    if (dt.Rows[i]["UserSectionID"].ToString() != "")
                    {
                        natUserSection.UserSectionID = Convert.ToInt32(dt.Rows[i]["UserSectionID"].ToString());
                    }
                    if (dt.Rows[i]["SectionID"].ToString() != "")
                    {
                        natUserSection.SectionID = new int?(int.Parse(dt.Rows[i]["SectionID"].ToString()));
                    }
                    if (dt.Rows[i]["CreateDate"].ToString() != "")
                    {
                        natUserSection.CreateDate = new DateTime?(DateTime.Parse(dt.Rows[i]["CreateDate"].ToString()));
                    }
                    if (dt.Rows[i]["OperatorID"].ToString() != "")
                    {
                        natUserSection.OperatorID = new int?(int.Parse(dt.Rows[i]["OperatorID"].ToString()));
                    }
                    if (dt.Rows[i]["UserID"].ToString() != "")
                    {
                        natUserSection.UserID = new int?(int.Parse(dt.Rows[i]["UserID"].ToString()));
                    }
                    list.Add(natUserSection);
                }
            }
            return(list);
        }
Example #3
0
 public PEIS.Model.SYSUserSection DataRowToModel(DataRow row)
 {
     PEIS.Model.SYSUserSection model = new PEIS.Model.SYSUserSection();
     if (row != null)
     {
         if (row["UserSectionID"] != null && row["UserSectionID"].ToString() != "")
         {
             model.UserSectionID = int.Parse(row["UserSectionID"].ToString());
         }
         if (row["SectionID"] != null && row["SectionID"].ToString() != "")
         {
             model.SectionID = int.Parse(row["SectionID"].ToString());
         }
         if (row["UserID"] != null && row["UserID"].ToString() != "")
         {
             model.UserID = int.Parse(row["UserID"].ToString());
         }
         if (row["OperatorID"] != null && row["OperatorID"].ToString() != "")
         {
             model.OperatorID = int.Parse(row["OperatorID"].ToString());
         }
         if (row["CreateDate"] != null && row["CreateDate"].ToString() != "")
         {
             model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
         }
     }
     return(model);
 }
Example #4
0
        public PEIS.Model.SYSUserSection GetModel(int UserSectionID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 UserSectionID,SectionID,UserID,OperatorID,CreateDate from SYSUserSection ");
            strSql.Append(" where UserSectionID=@UserSectionID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserSectionID", SqlDbType.Int, 4)
            };
            parameters[0].Value = UserSectionID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #5
0
        public void Add(PEIS.Model.SYSUserSection model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SYSUserSection(");
            strSql.Append("UserSectionID,SectionID,UserID,OperatorID,CreateDate)");
            strSql.Append(" values (");
            strSql.Append("@ID_UserSection,@SectionID,@UserID,@OperatorID,@CreateDate)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserSectionID", SqlDbType.Int, 4),
                new SqlParameter("@SectionID",     SqlDbType.Int, 4),
                new SqlParameter("@UserID",        SqlDbType.Int, 4),
                new SqlParameter("@OperatorID",    SqlDbType.Int, 4),
                new SqlParameter("@CreateDate",    SqlDbType.DateTime)
            };
            parameters[0].Value = model.UserSectionID;
            parameters[1].Value = model.SectionID;
            parameters[2].Value = model.UserID;
            parameters[3].Value = model.OperatorID;
            parameters[4].Value = model.CreateDate;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Example #6
0
 public bool Update(PEIS.Model.SYSUserSection model)
 {
     return(this.dal.Update(model));
 }
Example #7
0
 public void Add(PEIS.Model.SYSUserSection model)
 {
     this.dal.Add(model);
 }