示例#1
0
        public static UserClassDto GetOneUserClassDto(string table,string strwhere)
        {
            UserClassDto userClassDto=new UserClassDto();

            userClassDto = UserClassDal.GetOneUserClass(table, strwhere);

            return userClassDto;
        }
        public ActionResult UserClassInsert(UserClassAddViewModel model)
        {
            UserClassDto userClassDto = new UserClassDto();

            userClassDto.UserClassName = model.UserClassName;

            UserClassBll.AddUserClass(userClassDto);

               return RedirectTo("/UserClass/UserClassIndex", "归档类别添加成功了");
               //return RedirectToAction("UserClassIndex");
        }
示例#3
0
        public static void AddUserClass(UserClassDto userClassDto)
        {
            SqlParameter[] arParames = UserClassDal.getParameters(userClassDto);
             SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString);
            try
            {
            SqlHelper.ExecuteNonQuery(myconn, CommandType.StoredProcedure, "CreateUserClass", arParames);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {

                myconn.Close();
                myconn.Dispose();
            }
        }
示例#4
0
        public static UserClassDto GetOneUserClass(string table,string strwhere)
        {
            UserClassDto userClassDto = new UserClassDto();

            SqlParameter[] arParames = new SqlParameter[2];
            arParames[0] = new SqlParameter("@table ", SqlDbType.VarChar, 200);
            arParames[0].Value = table;

            arParames[1] = new SqlParameter("@Where ", SqlDbType.VarChar, 8000);
            arParames[1].Value = strwhere;

            DataTable dt = null;
             SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString);
            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(myconn, CommandType.StoredProcedure, "getModelByWhere", arParames);
            dt = ds.Tables[0];
            foreach (DataRow dr in dt.Rows)
            {

                userClassDto = UserClassDal.getDataRowToUserClassDto(dr);

            }

            return userClassDto;

             }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {

                myconn.Close();
                myconn.Dispose();
            }
        }
示例#5
0
 public static void UpdateUserClassDto(UserClassDto userClassDto)
 {
     UserClassDal.UpdateUserClass(userClassDto);
 }
示例#6
0
    public static void AddUserClass(UserClassDto userClassDto)
    {
        UserClassDal.AddUserClass(userClassDto);
 
    }
示例#7
0
        private static SqlParameter[] getParameters(UserClassDto userClassDto)
        {
            SqlParameter[] arParames = new SqlParameter[2];

            arParames[0] = new SqlParameter("@UserClassId", SqlDbType.Int);
            arParames[0].Value = userClassDto.UserClassId;

            arParames[1] = new SqlParameter("@UserClassName", SqlDbType.VarChar, 50);
            arParames[1].Value = userClassDto.UserClassName;

            return arParames;
        }
示例#8
0
        private static UserClassDto getDataRowToUserClassDto(DataRow dr)
        {
            UserClassDto userClassDto = new UserClassDto();

            userClassDto.UserClassId = int.Parse(dr["UserClassId"].ToString());
            userClassDto.UserClassName = dr["UserClassName"].ToString();

            return userClassDto;
        }