Exemplo n.º 1
0
        public static UserDto GetOneUserDto(string table,string strwhere)
        {
            UserDto userDto=new UserDto();

            userDto = UserDal.GetOneUser(table, strwhere);

            return userDto;
        }
Exemplo n.º 2
0
        public static void AddUser(UserDto userDto)
        {
            SqlParameter[] arParames = UserDal.getParameters(userDto);
             SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString);
            try
            {
                SqlHelper.ExecuteNonQuery(myconn, CommandType.StoredProcedure, "CreateUser", arParames);
             }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {

                myconn.Close();
                myconn.Dispose();
            }
        }
Exemplo n.º 3
0
        public static UserDto GetOneUser(string table,string strwhere)
        {
            UserDto userDto = new UserDto();

            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;
             SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString);
            try
            {
            DataTable dt = null;

            DataSet ds = SqlHelper.ExecuteDataset(myconn, CommandType.StoredProcedure, "getModelByWhere", arParames);
            dt = ds.Tables[0];
            foreach (DataRow dr in dt.Rows)
            {

                userDto = UserDal.getDataRowToUserDto(dr);

            }

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

                myconn.Close();
                myconn.Dispose();
            }
        }
Exemplo n.º 4
0
        public ActionResult UserInsert(UserAddViewModel model)
        {
            UserDto userDto = new UserDto();

            userDto.UserPassword = model.UserPassword;
            userDto.UserName = model.UserName;
            userDto.UserSex = model.UserSex;
            userDto.UserBirthday = model.UserBirthday;
            userDto.UserNumber = model.UserNumber;
            userDto.UserTel = model.UserTel;
            userDto.UserFirstPerson = model.UserFirstPerson;
            userDto.UserFirstPersonTel = model.UserFirstPersonTel;
            userDto.UserJiedaoName = model.UserJiedaoName;
            userDto.UserJuweihuiName = model.UserJuweihuiName;
            userDto.UserHuji = model.UserHuji;
            userDto.UserMinzu = model.UserMinzu;
            userDto.UserWenhua = model.UserWenhua;
            userDto.UserZhiye = model.UserZhiye;
            userDto.UserHunyin = model.UserHunyin;
            userDto.UserDoctor = model.UserDoctor;
            userDto.UserGroup = model.UserGroup;
               // userDto.UserClass = model.UserClass;
               // userDto.UserClass = Request.Form["UserClass"];
            if (String.IsNullOrEmpty(Request.Form["UserClass"]))
            {
                userDto.UserClass = "11";

            }
            else
            {
                userDto.UserClass = Request.Form["UserClass"].ToString();
            }
            userDto.UserNowAddress = model.UserNowAddress;
            userDto.UserOldAddress = model.UserOldAddress;
            userDto.UserJobGroup = model.UserJobGroup;
            if (String.IsNullOrEmpty(Request.Form["UserDiy1"]))
            {
                userDto.UserDiy1 = "无";
            }
            else
            {
                userDto.UserDiy1 = Request.Form["UserDiy1"].ToString();
            }
            if (String.IsNullOrEmpty(Request.Form["UserDiy2"]))
            {
                userDto.UserDiy2 = "无";
            }
            else
            {
                userDto.UserDiy2 = Request.Form["UserDiy2"].ToString();
            }
            if (String.IsNullOrEmpty(Request.Form["UserDiy3"]))
            {
                userDto.UserDiy3 = "无";
            }
            else
            {
                userDto.UserDiy3 = Request.Form["UserDiy3"].ToString();
            }

            userDto.UserDiy4 = model.UserDiy4;
            userDto.UserDiy5 = model.UserDiy5;
            userDto.UserDiy6 = model.UserDiy6;
            userDto.UserBeizhu = model.UserBeizhu;

               UserBll.AddUser(userDto);
               UserDto healthUser = UserBll.GetOneUserDto("CrmUser", "UserName='******' and UserNumber='" + userDto.UserNumber + "' and UserTel='"+userDto.UserTel+"'");

             // return RedirectTo("/User/UserIndex?groupId=0&userClass=0", "客户添加成功了");
               return Redirect("/Health/HealthAdd?userId=" + healthUser.UserId + "&userName=" + userDto.UserName);
              //  return Content();
        }
Exemplo n.º 5
0
        private static SqlParameter[] getParameters(UserDto userDto)
        {
            SqlParameter[] arParames = new SqlParameter[29];

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

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

            arParames[2] = new SqlParameter("@UserName ", SqlDbType.VarChar, 50);
            arParames[2].Value = userDto.UserName;

            arParames[3] = new SqlParameter("@UserSex ", SqlDbType.VarChar, 50);
            arParames[3].Value = userDto.UserSex;

            arParames[4] = new SqlParameter("@UserBirthday ", SqlDbType.DateTime);
            arParames[4].Value = userDto.UserBirthday;

            arParames[5] = new SqlParameter("@UserNumber ", SqlDbType.VarChar, 50);
            arParames[5].Value = userDto.UserNumber;

            arParames[6] = new SqlParameter("@UserTel ", SqlDbType.VarChar, 50);
            arParames[6].Value = userDto.UserTel;

            arParames[7] = new SqlParameter("@UserFirstPerson ", SqlDbType.VarChar, 50);
            arParames[7].Value = userDto.UserFirstPerson;

            arParames[8] = new SqlParameter("@UserFirstPersonTel ", SqlDbType.VarChar, 50);
            arParames[8].Value = userDto.UserFirstPersonTel;

            arParames[9] = new SqlParameter("@UserJiedaoName ", SqlDbType.VarChar, 50);
            arParames[9].Value = userDto.UserJiedaoName;

            arParames[10] = new SqlParameter("@UserJuweihuiName", SqlDbType.VarChar, 50);
            arParames[10].Value = userDto.UserJuweihuiName;

            arParames[11] = new SqlParameter("@UserHuji", SqlDbType.VarChar, 50);
            arParames[11].Value = userDto.UserHuji;

            arParames[12] = new SqlParameter("@UserMinzu", SqlDbType.VarChar, 50);
            arParames[12].Value = userDto.UserMinzu;

            arParames[13] = new SqlParameter("@UserWenhua", SqlDbType.VarChar, 50);
            arParames[13].Value = userDto.UserWenhua;

            arParames[14] = new SqlParameter("@UserZhiye", SqlDbType.VarChar, 50);
            arParames[14].Value = userDto.UserZhiye;

            arParames[15] = new SqlParameter("@UserHunyin", SqlDbType.VarChar, 50);
            arParames[15].Value = userDto.UserHunyin;

            arParames[16] = new SqlParameter("@UserBeizhu", SqlDbType.Text);
            arParames[16].Value = userDto.UserBeizhu;

            arParames[17] = new SqlParameter("@UserDoctor", SqlDbType.Int);
            arParames[17].Value = userDto.UserDoctor;

            arParames[18] = new SqlParameter("@UserGroup", SqlDbType.Int);
            arParames[18].Value = userDto.UserGroup;

            arParames[19] = new SqlParameter("@UserClass", SqlDbType.VarChar, 500);
            arParames[19].Value = userDto.UserClass;

            arParames[20] = new SqlParameter("@UserNowAddress", SqlDbType.VarChar, 500);
            arParames[20].Value = userDto.UserNowAddress;

            arParames[21] = new SqlParameter("@UserOldAddress", SqlDbType.VarChar, 500);
            arParames[21].Value = userDto.UserOldAddress;

            arParames[22] = new SqlParameter("@UserJobGroup", SqlDbType.VarChar, 500);
            arParames[22].Value = userDto.UserJobGroup;

            arParames[23] = new SqlParameter("@UserDiy1", SqlDbType.VarChar, 500);
            arParames[23].Value = userDto.UserDiy1;

            arParames[24] = new SqlParameter("@UserDiy2", SqlDbType.VarChar, 500);
            arParames[24].Value = userDto.UserDiy2;

            arParames[25] = new SqlParameter("@UserDiy3", SqlDbType.VarChar, 500);
            arParames[25].Value = userDto.UserDiy3;

            arParames[26] = new SqlParameter("@UserDiy4", SqlDbType.VarChar, 500);
            arParames[26].Value = userDto.UserDiy4;

            arParames[27] = new SqlParameter("@UserDiy5", SqlDbType.VarChar, 500);
            arParames[27].Value = userDto.UserDiy5;

            arParames[28] = new SqlParameter("@UserDiy6", SqlDbType.VarChar, 500);
            arParames[28].Value = userDto.UserDiy6;

            return arParames;
        }
Exemplo n.º 6
0
        private static UserDto getDataRowToUserDto(DataRow dr)
        {
            UserDto userDto = new UserDto();

            userDto.UserId = int.Parse(dr["UserId"].ToString());
            userDto.UserPassword = dr["UserPassword"].ToString();
            userDto.UserName = dr["UserName"].ToString();
            userDto.UserSex = dr["UserSex"].ToString();
            userDto.UserBirthday =DateTime.Parse(dr["UserBirthday"].ToString());
            userDto.UserNumber = dr["UserNumber"].ToString();
            userDto.UserTel = dr["UserTel"].ToString();
            userDto.UserFirstPerson = dr["UserFirstPerson"].ToString();
            userDto.UserFirstPersonTel = dr["UserFirstPersonTel"].ToString();
            userDto.UserJiedaoName = dr["UserJiedaoName"].ToString();
            userDto.UserJuweihuiName = dr["UserJuweihuiName"].ToString();
            userDto.UserHuji = dr["UserHuji"].ToString();
            userDto.UserMinzu = dr["UserMinzu"].ToString();
            userDto.UserWenhua = dr["UserWenhua"].ToString();
            userDto.UserZhiye = dr["UserZhiye"].ToString();
            userDto.UserHunyin = dr["UserHunyin"].ToString();
            userDto.UserDoctor = int.Parse(dr["UserDoctor"].ToString());
            userDto.UserGroup = int.Parse(dr["UserGroup"].ToString());
            userDto.UserClass = dr["UserClass"].ToString();
            userDto.UserNowAddress = dr["UserNowAddress"].ToString();
            userDto.UserOldAddress = dr["UserOldAddress"].ToString();
            userDto.UserJobGroup = dr["UserJobGroup"].ToString();
            userDto.UserDiy1 = dr["UserDiy1"].ToString();
            userDto.UserDiy2 = dr["UserDiy2"].ToString();
            userDto.UserDiy3 = dr["UserDiy3"].ToString();
            userDto.UserDiy4 = dr["UserDiy4"].ToString();
            userDto.UserDiy5 = dr["UserDiy5"].ToString();
            userDto.UserDiy6 = dr["UserDiy6"].ToString();
            userDto.UserBeizhu = dr["UserBeizhu"].ToString();
            userDto.UserRegTime =DateTime.Parse(dr["UserRegTime"].ToString());

            return userDto;
        }
Exemplo n.º 7
0
 public static void UpdateUserDto(UserDto userDto)
 {
     UserDal.UpdateUser(userDto);
 }
Exemplo n.º 8
0
 public static void AddUser(UserDto userDto)
 {
     UserDal.AddUser(userDto);
 }
        public ActionResult UserInsert(UserAddViewModel model)
        {
            UserDto userDto = new UserDto();

            userDto.UserPassword = model.UserPassword;
            userDto.UserName = model.UserName;
            userDto.UserSex = model.UserSex;
            userDto.UserBirthday = model.UserBirthday;
            userDto.UserNumber = model.UserNumber;
            userDto.UserTel = model.UserTel;
            userDto.UserFirstPerson = model.UserFirstPerson;
            userDto.UserFirstPersonTel = model.UserFirstPersonTel;
            userDto.UserJiedaoName = model.UserJiedaoName;
            userDto.UserJuweihuiName = model.UserJuweihuiName;
            userDto.UserHuji = model.UserHuji;
            userDto.UserMinzu = model.UserMinzu;
            userDto.UserWenhua = model.UserWenhua;
            userDto.UserZhiye = model.UserZhiye;
            userDto.UserHunyin = model.UserHunyin;
            userDto.UserDoctor = model.UserDoctor;
            userDto.UserGroup = model.UserGroup;
            userDto.UserClass = model.UserClass;
            userDto.UserNowAddress = model.UserNowAddress;
            userDto.UserOldAddress = model.UserOldAddress;
            userDto.UserJobGroup = model.UserJobGroup;
            userDto.UserDiy1 = model.UserDiy1;
            userDto.UserDiy2 = model.UserDiy2;
            userDto.UserDiy3 = model.UserDiy3;
            userDto.UserDiy4 = model.UserDiy4;
            userDto.UserDiy5 = model.UserDiy5;
            userDto.UserDiy6 = model.UserDiy6;
            userDto.UserBeizhu = model.UserBeizhu;

            UserBll.AddUser(userDto);

               return RedirectTo("/User/UserIndex", "客户添加成功了");
               //return RedirectToAction("UserIndex");
        }