Example #1
0
        public string AddUser(string id, string idcard, string role, string username, string mobile, string email, string deptname, string duty, string tel)
        {
            string jsonAddUser = string.Empty;

            try
            {
                UserRequest ur    = new UserRequest();
                var         token = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString();

                UserAddResponseDataEntity ua = new UserAddResponseDataEntity
                {
                    idcard     = idcard,
                    username   = username,
                    role       = role,
                    mobile     = mobile,
                    hospitalid = id,
                    email      = email,

                    deptname = deptname,
                    duty     = duty,
                    tel      = tel,
                };

                jsonAddUser = ur.AddUser(token, ua);
            }
            catch (Exception ex)
            {
                AppLog.Instance.Write("AddUser", AppLog.LogMessageType.Error, ex);
            }
            return(jsonAddUser);
        }
Example #2
0
        /// <summary>
        ///  6、	添加用户
        /// </summary>
        /// <param name="token"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        /// Gerry Ge
        /// 请求方式:POST
        public string AddUser(string token, UserAddResponseDataEntity user)
        {
            string             strResponse = string.Empty;
            UserJoinedResponse apiResponse = new UserJoinedResponse();

            try
            {
                Dictionary <string, string> sPara = new Dictionary <string, string>();
                foreach (System.Reflection.PropertyInfo p in user.GetType().GetProperties())
                {
                    if (p.Name == "hospitalid")
                    {
                        sPara.Add(p.Name, p.GetValue(user).ToString());
                    }
                    else if (p.Name == "role")
                    {
                        sPara.Add(p.Name, p.GetValue(user).ToString());
                    }
                    else if (p.Name == "idcard")
                    {
                        sPara.Add(p.Name, p.GetValue(user).ToString());
                    }
                    else if (p.Name == "username")
                    {
                        sPara.Add(p.Name, p.GetValue(user).ToString());
                    }
                    else if (p.Name == "mobile")
                    {
                        sPara.Add(p.Name, p.GetValue(user).ToString());
                    }
                    else if (p.Name == "email")
                    {
                        sPara.Add(p.Name, p.GetValue(user).ToString());
                    }
                    else if (p.Name == "deptname")
                    {
                        sPara.Add(p.Name, p.GetValue(user).ToString());
                    }
                    else if (p.Name == "duty")
                    {
                        sPara.Add(p.Name, p.GetValue(user).ToString());
                    }
                    else if (p.Name == "tel")
                    {
                        sPara.Add(p.Name, p.GetValue(user).ToString());
                    }
                }

                strResponse = F8YLSubmit.BuildRequest(sPara, "ucenter/user/add?token=" + token);
            }
            catch (Exception)
            {
            }
            return(strResponse);
        }