Exemple #1
0
        public static void ImportTitle()
        {
            try
            {
                ImportSqlServerUtility sql = new ImportSqlServerUtility();

                string strsql = "select * from POSTRANKCODE";

                RelationSqlServerUtility rsql = new RelationSqlServerUtility();

                rsql.ExecuteSql("truncate table  rtitle ");

                string insertsql = " insert into rtitle(old,new) values('{0}','{1}')";

                DataSet ds = sql.ExecuteSqlDataSet(strsql);

                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        CY.CSTS.Core.Business.UserPostRank title = new CY.CSTS.Core.Business.UserPostRank();

                        title.PostRankName = ds.Tables[0].Rows[i][1].ToString();

                        title.Save();

                        rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), title.Id.ToString()));
                    }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        protected void btRegister_Click(object sender, EventArgs e)
        {
            CY.CSTS.Core.Business.User registerUser = new CY.CSTS.Core.Business.User();
            // 用户名
            if (tbUserName.Text != null && tbUserName.Text.Trim() != "")
            {
                if (CY.CSTS.Core.Business.User.GetUserByUserId(tbUserName.Text) != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('该ID已被其它用户注册,请更换ID')</script>");
                    return;
                }
                else
                {
                    registerUser.UserID = tbUserName.Text;
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请填写登陆ID')</script>");
                return;
            }

            // 电子邮件
            if (tbEmail.Text != null && tbEmail.Text.Trim() != "")
            {
                string email = tbEmail.Text.Trim();
                if (Regex.IsMatch(email, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"))
                {
                    //IList<CY.CSTS.Core.Business.User> all = CY.CSTS.Core.Business.User.GetAllUser() as List<CY.CSTS.Core.Business.User>;
                    //List<CY.CSTS.Core.Business.User> users = all.Where(item => item.Email == tbEmail.Text).ToList();
                    //if (users.Count == 0 || users == null)
                    //{
                        registerUser.Email = tbEmail.Text;
                    //}
                    //else5
                    //{
                    //    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电子邮件错误", "<script>alert('该电子邮件地址已被注册')</script>");
                    //    return;
                    //}
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电子邮件", "<script>alert('电子邮件格式不正确')</script>");
                    return;
                }

            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电子邮件", "<script>alert('请填写电子邮件')</script>");
                return;
            }

            // 性别
            if (rblSex.SelectedValue != "" && rblSex.SelectedValue != null)
            {
                registerUser.Gender = rblSex.SelectedValue;
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请选择性别')</script>");
                return;
            }

            // 真实姓名
            if (tbRealName.Text != null && tbRealName.Text.Trim() != "")
            {
                registerUser.Name = tbRealName.Text;
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请填写真实姓名')</script>");
                return;
            }
            if (ddlPostRand.Visible)
            {
                // 职称
                if (ddlPostRand.Text.Trim() != "")
                {
                    List<CY.CSTS.Core.Business.UserPostRank> postRankList = CY.CSTS.Core.Business.UserPostRank.GetAllUserPostRank()
                        as List<CY.CSTS.Core.Business.UserPostRank>;
                    postRankList = postRankList.Where(Items => Items.PostRankName == ddlPostRand.Text.Trim()).ToList();
                    Guid postId = new Guid();
                    if (postRankList.Count == 0)
                    {
                        CY.CSTS.Core.Business.UserPostRank post = new CY.CSTS.Core.Business.UserPostRank();
                        post.PostRankName = ddlPostRand.Text.Trim();
                        post.Save();
                        postId = post.Id;
                    }
                    else
                    {
                        postId = postRankList[0].Id;
                    }

                    registerUser.PostRankID = postId;
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请选择职称')</script>");
                    return;
                }
            }
            if (ddlEdu.Visible)
            {
                // 学历
                if (ddlEdu.SelectedValue != null && ddlEdu.SelectedValue != "")
                {
                    registerUser.EducationID = new System.Guid(ddlEdu.SelectedValue);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请选择学历')</script>");
                    return;
                }
            }

            // 头像
            if (hfIconPath.Value != null && !hfIconPath.Value.Equals(""))
            {
                registerUser.PicURL = hfIconPath.Value;
            }
            else
            {
                registerUser.PicURL = "Content/Icon/defaultIcon.jpg";
            }

            // 密码
            if (tbPwd.Text != null && tbPwd.Text != "" && tbPwdConfirm.Text != null && tbPwdConfirm.Text != "")
            {
                if (tbPwd.Text != tbPwdConfirm.Text)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('两次密码不一致')</script>");
                    return;
                }
                else
                {
                    registerUser.Password = tbPwd.Text;
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请确认密码填写正确')</script>");
                return;
            }

            // 出生日期
            if (tbBirthday.Text.Trim() != "" && tbBirthday.Text != null)
            {
                registerUser.BirthDate = Convert.ToDateTime(tbBirthday.Text);
            }
            else
            {
                registerUser.BirthDate = new DateTime();
            }
            // 通信地址
            registerUser.Address = tbAddress.Text.Trim();
            // 邮政编码
            if (tbCode.Text != null && !tbCode.Text.Trim().Equals(""))
            {
                int temp = 0;
                string code = tbCode.Text.Trim();
                if (!int.TryParse(code, out temp))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "邮政编码错误", "<script>alert('邮政编码格式不对')</script>");
                    return;
                }
                else
                {
                    registerUser.Mailcode = code;
                }
            }
            else
            {
                registerUser.Mailcode = "";
            }

            // 传真
            registerUser.Fax = tbFax.Text;
            // 固定电话
            if (tbFixPhone.Text != null && !tbFixPhone.Text.Trim().Equals(""))
            {
                int tempPhone = 0;
                string phone = tbFixPhone.Text.Trim();
                if (!int.TryParse(phone, out tempPhone))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电话错误", "<script>alert('电话格式不对')</script>");
                    return;
                }
                else
                {
                    registerUser.Phone = phone;
                }
            }
            else
            {
                registerUser.Phone = "";
            }

            // 移动电话
            registerUser.MobilePhone = tbCellFhone.Text;

            // 专长
            registerUser.Specialty = tbSpecialty.Text;
            // 专业简历
            registerUser.Resume = fckResume.Value;
            // 备注
            registerUser.Remark = tbRemark.Text;

            // 人员类型
            registerUser.UserType = Int32.Parse(ddlUserType.SelectedValue);
            if (registerUser.UserType != 1 && registerUser.UserType != 4 && registerUser.UserType != 5)
            {
                // 单位
                if (ddlUnit.SelectedValue != null && ddlUnit.SelectedValue != "")
                {
                    registerUser.UnitID = new System.Guid(ddlUnit.SelectedValue);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "单位", "<script>alert('请选择单位')</script>");
                    return;
                }
            }

            // 主要论文
            registerUser.Discourse = tbPaper.Value;
            // 获奖情况
            registerUser.Acquire = tbAcquire.Value;

            List<CY.CSTS.Core.Business.ExpertField> selectFiled = new List<CY.CSTS.Core.Business.ExpertField>();    // 保存研究领域
            if (ddlUserType.SelectedValue == "4")
            {
                // 所在单位
                registerUser.Unit = tbUnitOfExpert.Text;
                // 职务
                registerUser.Duty = tbDuty.Text;
                // 研究领域1
                if (ddlField.SelectedValue != null && ddlField.SelectedValue != "")
                {
                    registerUser.FeildID = new System.Guid(ddlField.SelectedValue);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "研究领域", "<script>alert('请选择研究领域')</script>");
                    return;
                }
                // 研究领域2
                for (int i = 0; i < cblField.Items.Count; i++)
                {
                    if (cblField.Items[i].Selected)
                    {
                        CY.CSTS.Core.Business.ExpertField f = new CY.CSTS.Core.Business.ExpertField();
                        f.FieldID = new Guid(cblField.Items[i].Value);
                        selectFiled.Add(f);
                    }
                }
            }

            // 注册时间
            registerUser.RegDate = System.DateTime.Now;
            // 最后登录时间
            //registerUser.LastActiveTime = new DateTime();
            // 状态, 2 表示正常
            registerUser.Status = 2;

            // 保存用户
            //registerUser.Save();

            // 保存专家研究领域
            if (ddlUserType.SelectedValue == "4")
            {
                // SaveAndGetId保存专家用户,并获取ID
                string id = registerUser.SaveAndGetId();
                for (int j = 0; j < selectFiled.Count; j++)
                {
                    selectFiled[j].ExpertID = new Guid(id);
                    selectFiled[j].Save();
                }
            }
            else
            {
                registerUser.Save();
            }

            //Server.Transfer("UserInfo.aspx");

            // 跳回上一页面
            if (ViewState["PrePage"] != null)
            {
                string url = ViewState["PrePage"].ToString();
                Response.Redirect(url);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "添加成功", "<script>alert('添加成功')</script>");
                return;
            }
        }
Exemple #3
0
        protected void btModify_Click(object sender, EventArgs e)
        {
            if ((CY.CSTS.Core.Business.User)Session["User"] != null)
            {
                CY.CSTS.Core.Business.User registerUser = CY.CSTS.Core.Business.User.Load(((CY.CSTS.Core.Business.User)Session["User"]).Id);

                if (registerUser.UserType != 4 || (registerUser.UserType == 4 && registerUser.Status == 5))
                {
                    // 性别
                    if (rblSex.SelectedValue != "" && rblSex.SelectedValue != null)
                    {
                        registerUser.Gender = rblSex.SelectedValue;
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请选择性别')</script>");
                        return;
                    }

                    // 真实姓名
                    if (tbRealName.Text != null && tbRealName.Text.Trim() != "")
                    {
                        registerUser.Name = tbRealName.Text;
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请填写真实姓名')</script>");
                        return;
                    }

                    // 职称
                    if (tbPost.Text.Trim()!= "")
                    {
                        List<CY.CSTS.Core.Business.UserPostRank> postRankList = CY.CSTS.Core.Business.UserPostRank.GetAllUserPostRank()
                            as List<CY.CSTS.Core.Business.UserPostRank>;
                        postRankList = postRankList.Where(Items => Items.PostRankName == tbPost.Text.Trim()).ToList();
                        Guid postId = new Guid();
                        if (postRankList.Count == 0)
                        {
                            CY.CSTS.Core.Business.UserPostRank post = new CY.CSTS.Core.Business.UserPostRank();
                            post.PostRankName = tbPost.Text.Trim();
                            post.Save();
                            postId = post.Id;
                        }
                        else
                        {
                            postId = postRankList[0].Id;
                        }
                        registerUser.PostRankID = postId;
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请填写职称')</script>");
                        return;
                    }

                    // 学历
                    if (ddlEdu.SelectedValue != null && ddlEdu.SelectedValue != "")
                    {
                        registerUser.EducationID = new System.Guid(ddlEdu.SelectedValue);
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请选择学历')</script>");
                        return;
                    }

                    // 头像
                    if (hfIconPath.Value != null && !hfIconPath.Value.Equals(""))
                    {
                        registerUser.PicURL = hfIconPath.Value;
                    }
                    else
                    {
                        if (imgIcon.ImageUrl != null && !imgIcon.ImageUrl.Equals(""))
                        {
                            if (imgIcon.ImageUrl.Contains("../.."))
                            {
                                imgIcon.ImageUrl = imgIcon.ImageUrl.Remove(imgIcon.ImageUrl.IndexOf("../.."), 6);
                            }
                            registerUser.PicURL = imgIcon.ImageUrl;
                        }
                        else
                        {
                            registerUser.PicURL = "";
                        }
                    }

                    // 密码
                    if (tbPwd.Text != null && tbPwd.Text != "" && tbPwdConfirm.Text != null && tbPwdConfirm.Text != "")
                    {
                        if (tbPwd.Text != tbPwdConfirm.Text)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('两次密码不一致')</script>");
                            return;
                        }
                        else
                        {
                            registerUser.Password = tbPwd.Text;
                        }
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请确认密码填写正确')</script>");
                        return;
                    }

                    // 出生日期
                    if (tbBirthday.Text.Trim() != "" && tbBirthday.Text != null)
                    {
                        registerUser.BirthDate = Convert.ToDateTime(tbBirthday.Text);
                    }
                    else
                    {
                        registerUser.BirthDate = new DateTime();
                    }
                    // 通信地址
                    registerUser.Address = tbAddress.Text.Trim();
                    // 邮政编码
                    if (tbCode.Text != null && !tbCode.Text.Trim().Equals(""))
                    {
                        int temp = 0;
                        string code = tbCode.Text.Trim();
                        if (!int.TryParse(code, out temp))
                        {
                            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "邮政编码错误", "<script>alert('邮政编码格式不对')</script>");
                            return;
                        }
                        else
                        {
                            registerUser.Mailcode = code;
                        }
                    }
                    else
                    {
                        registerUser.Mailcode = "";
                    }

                    // 传真
                    registerUser.Fax = tbFax.Text;
                    // 固定电话
                    if (tbFixPhone.Text != null && !tbFixPhone.Text.Trim().Equals(""))
                    {
                        int tempPhone = 0;
                        string phone = tbFixPhone.Text.Trim();
                        //if (!int.TryParse(phone, out tempPhone))
                        //{
                        //    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电话错误", "<script>alert('电话格式不对')</script>");
                        //    return;
                        //}
                        //else
                        {
                            registerUser.Phone = phone;
                        }
                    }
                    else
                    {
                        registerUser.Phone = "";
                    }

                    // 移动电话
                    registerUser.MobilePhone = tbCellFhone.Text;
                    // 电子邮件
                    if (tbEmail.Text != null && tbEmail.Text.Trim() != "")
                    {
                        string email = tbEmail.Text.Trim();
                        if (Regex.IsMatch(email, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"))
                        {
                            registerUser.Email = tbEmail.Text;
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电子邮件", "<script>alert('电子邮件格式不正确')</script>");
                            return;
                        }

                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电子邮件", "<script>alert('请填写电子邮件')</script>");
                        return;
                    }

                    // 专长
                    registerUser.Specialty = tbSpecialty.Text;
                    // 专业简历
                    registerUser.Resume = fckResume.Value;
                    // 备注
                    registerUser.Remark = tbRemark.Value;

                    // 主要论文
                    registerUser.Discourse = tbPaper.Value;
                    // 获奖情况
                    registerUser.Acquire = tbAcquire.Value;

                    List<CY.CSTS.Core.Business.ExpertField> selectFiled = new List<CY.CSTS.Core.Business.ExpertField>();
                    if (registerUser.UserType == 4) // 4表示专家
                    {
                        // 所在单位
                        registerUser.Unit = tbUnitOfExpert.Text;
                        // 职务
                        registerUser.Duty = tbDuty.Text;

                        // 研究领域1
                        if (ddlField.SelectedValue != null && ddlField.SelectedValue != "")
                        {
                            registerUser.FeildID = new System.Guid(ddlField.SelectedValue);
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "研究领域", "<script>alert('请选择研究领域')</script>");
                            return;
                        }

                        // 研究领域2

                        for (int i = 0; i < cblExpertField.Items.Count; i++)
                        {
                            if (cblExpertField.Items[i].Selected)
                            {
                                CY.CSTS.Core.Business.ExpertField f = new CY.CSTS.Core.Business.ExpertField();
                                f.FieldID = new Guid(cblExpertField.Items[i].Value);
                                f.ExpertID = registerUser.Id;
                                selectFiled.Add(f);
                            }
                        }
                    }

                    // 注册时间
                    registerUser.RegDate = registerUser.RegDate;

                    // 最后登录时间
                    registerUser.LastActiveTime = DateTime.Now;

                    if (registerUser.UserType == 4)
                    {
                        // 原领域
                        List<CY.CSTS.Core.Business.ExpertField> oldExpertFields = CY.CSTS.Core.Business.ExpertField.GetAllExpertField().Where(item => item.ExpertID == registerUser.Id).ToList<CY.CSTS.Core.Business.ExpertField>();
                        List<string> strOldExpertFieldId = new List<string>();
                        foreach (CY.CSTS.Core.Business.ExpertField ef in oldExpertFields)
                        {
                            strOldExpertFieldId.Add(ef.FieldID.ToString());
                        }

                        // 修改后的领域
                        List<string> strModifiedExpertFieldId = new List<string>();
                        foreach (CY.CSTS.Core.Business.ExpertField ef in selectFiled)
                        {
                            strModifiedExpertFieldId.Add(ef.FieldID.ToString());
                        }

                        // 求解新增的领域
                        List<string> addedFields = strModifiedExpertFieldId.Except(strOldExpertFieldId).ToList<string>();
                        // 求解被删掉的领域
                        List<string> deletedFields = strOldExpertFieldId.Except(strModifiedExpertFieldId).ToList<string>();

                        List<CY.CSTS.Core.Business.ExpertField> added = new List<CY.CSTS.Core.Business.ExpertField>();
                        List<CY.CSTS.Core.Business.ExpertField> deleted = new List<CY.CSTS.Core.Business.ExpertField>();

                        foreach (string strNf in addedFields)
                        {
                            CY.CSTS.Core.Business.ExpertField ef = new CY.CSTS.Core.Business.ExpertField();
                            ef.FieldID = new Guid(strNf);
                            ef.ExpertID = registerUser.Id;
                            added.Add(ef);
                        }

                        foreach (string strOf in deletedFields)
                        {
                            if (CY.CSTS.Core.Business.ExpertField.GetAllExpertField().Where(item => item.ExpertID == registerUser.Id && item.FieldID == new Guid(strOf)).ToList<CY.CSTS.Core.Business.ExpertField>().Count > 0)
                            {
                                deleted.Add(CY.CSTS.Core.Business.ExpertField.GetAllExpertField().Where(item => item.ExpertID == registerUser.Id && item.FieldID == new Guid(strOf)).ToList<CY.CSTS.Core.Business.ExpertField>().First());
                            }
                        }

                        foreach (CY.CSTS.Core.Business.ExpertField ef in added)
                        {
                            ef.Save();
                        }

                        foreach (CY.CSTS.Core.Business.ExpertField of in deleted)
                        {
                            CY.CSTS.Core.Business.ExpertField df = CY.CSTS.Core.Business.ExpertField.Load(of.Id);
                            df.DeleteOnSave();
                            df.Save();
                        }

                        registerUser.Status = 2;    // 6 表示修改完成

                    }

                    registerUser.Save();

                    //Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "修改成功", "<script>alert('修改成功')</script>");

                    // 跳转回个人信息页面
                    //Server.Transfer("UserInfo.aspx");
                    // 跳回上一页面
                    if (ViewState["PrePage"] != null)
                    {
                        string url = ViewState["PrePage"].ToString();
                        Response.Redirect(url);
                    }
                    else
                    {
                        //Response.Redirect("UserInfo.aspx");
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "修改成功", "<script>alert('修改成功')</script>");
                        return;
                    }

                }
                else if (registerUser.UserType == 4 && registerUser.Status == 2)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "请先申请个人信息", "<script>alert('请申请个人信息')</script>");
                    return;
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('暂不能修改')</script>");
                    return;
                }

            }
        }
Exemple #4
0
        private string HandlerData(HttpContext context)
        {
            StringBuilder returnvalue = new StringBuilder();

            returnvalue.Append("{");
            try
            {
                string UnitId = context.Request["UnitId"];
                string UserId = context.Request["UserId"];
                string UserName = context.Request["UserName"];
                string UserPass = context.Request["UserPass"];
                string UserEdu = context.Request["UserEdu"];
                string UserSex = context.Request["UserSex"];
                string UserPost = context.Request["UserPost"];
                CY.CSTS.Core.Business.User u = new CY.CSTS.Core.Business.User();
                u.UserID = UserId;
                u.Password = UserPass;
                u.Name = UserName;
                if (!UserEdu.Equals(String.Empty) && CY.Utility.Common.StringHelper.IsGuid(UserEdu))
                {
                    u.EducationID = new Guid(UserEdu);
                }
                // 职称
                if (UserPost.Trim() != "")
                {
                    List<CY.CSTS.Core.Business.UserPostRank> postRankList = CY.CSTS.Core.Business.UserPostRank.GetAllUserPostRank()
                        as List<CY.CSTS.Core.Business.UserPostRank>;
                    postRankList = postRankList.Where(Items => Items.PostRankName == UserPost.Trim()).ToList();
                    Guid postId = new Guid();
                    if (postRankList.Count == 0)
                    {
                        CY.CSTS.Core.Business.UserPostRank post = new CY.CSTS.Core.Business.UserPostRank();
                        post.PostRankName = UserPost.Trim();
                        post.Save();
                        postId = post.Id;
                    }
                    else
                    {
                        postId = postRankList[0].Id;
                    }
                    u.PostRankID = postId;
                }
                if (!UnitId.Equals(String.Empty) && CY.Utility.Common.StringHelper.IsGuid(UnitId))
                {
                    u.UnitID = new Guid(UnitId);

                    CY.CSTS.Core.Business.UnitInfo ui = CY.CSTS.Core.Business.UnitInfo.Load(u.UnitID);
                    if (ui == null)
                    {
                        throw (new Exception("单位错误"));
                    }
                    else
                    {
                        if (ui.IsCooperantUnit == 2) //分中心
                        {
                            u.UserType = 2;
                        }
                        else if (ui.IsCooperantUnit == 1) //协作单位
                        {
                            u.UserType = 3;
                        }
                    }
                }
                else
                {
                    throw (new Exception("单位错误"));
                }
                u.Gender = UserSex;
                u.Save();
                returnvalue.Append("status:'0',");
                returnvalue.Append("message:'ok'");
            }
            catch (Exception ex)
            {
                returnvalue.Append("status:'1',");
                returnvalue.Append("message:'发生异常'");
            }
            finally
            {
                returnvalue.Append("}");
            }
            return returnvalue.ToString();
        }