コード例 #1
0
        public JsonResult UpdateMembersAjax(string memberName, string sex, string relationType, string birthday, string iDNum, string membersId)
        {
            int mid = Utility.Util.ParseHelper.ToInt(membersId);
            pbs_basic_Members        members = new pbs_basic_Members();
            pbs_basic_MembersService pbsBasicMembersService = new pbs_basic_MembersService();

            ResultInfo <pbs_basic_Members> result_Members = pbsBasicMembersService.GetMembersModelById(mid);

            if (result_Members.Result && result_Members.Data != null)
            {
                members              = result_Members.Data;
                members.MemberName   = memberName;
                members.Sex          = Utility.Util.ParseHelper.ToInt(sex);
                members.RelationType = Utility.Util.ParseHelper.ToInt(relationType);
                members.Birthday     = birthday;
                members.IDNum        = iDNum;
                members.UpdateTime   = DateTime.Now;

                ResultInfo <bool> result_UpdateMembers = pbsBasicMembersService.UpdateMembers(members.MemberName, members.Sex, members.RelationType, members.Birthday, members.IDNum, userid, members.CreateTime, members.UpdateTime, 0, string.Empty, mid);
                if (result_UpdateMembers.Result && result_UpdateMembers.Data)
                {
                    return(Json(new ResultModel <bool>(0, "修改成功", true), JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(new ResultModel <bool>(1, "修改失败", true), JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult UpdateUserAjax(string nickName, string photoUrl, string babySex, string phone, string babyBirthday, string dadName, string mumName, string myAdress)
        {
            bool                         flag                   = false;
            pbs_basic_Users              users                  = new pbs_basic_Users();
            List <pbs_basic_Members>     listMembers            = new List <pbs_basic_Members>();
            pbs_basic_Members            dadMember              = new pbs_basic_Members();
            pbs_basic_Members            mumMember              = new pbs_basic_Members();
            pbs_basic_UsersService       pbsBasicUsersService   = new pbs_basic_UsersService();
            pbs_basic_MembersService     pbsBasicMembersService = new pbs_basic_MembersService();
            ResultInfo <pbs_basic_Users> result_Users           = pbsBasicUsersService.GetUsersModelById(userid);

            if (result_Users.Result && result_Users.Data != null)
            {
                users              = result_Users.Data;
                users.PhotoUrl     = photoUrl;
                users.NickName     = nickName;
                users.BabySex      = Utility.Util.ParseHelper.ToInt(babySex);
                users.Phone        = phone;
                users.BabyBirthday = babyBirthday;
                users.MyAdress     = myAdress;
                ResultInfo <bool> result_UpdateUsers = pbsBasicUsersService.UpdateUsers(users.LoginName, users.Pwd, users.NickName, users.PhotoUrl, users.Phone, users.BabySex, users.BabyBirthday, users.WeiXinCode, users.CreateTime, users.UpdateTime, users.UserId, users.Remark, users.MyAdress, users.UserId);
                if (result_UpdateUsers.Result && result_UpdateUsers.Data)
                {
                    ResultInfo <List <pbs_basic_Members> > result_Members = pbsBasicMembersService.GetMembersListByUserId(userid);
                    if (result_Members.Result && result_Members.Data != null)
                    {
                        listMembers = result_Members.Data;
                        if (listMembers.Where(p => p.RelationType == 0).FirstOrDefault() != null)
                        {
                            dadMember = listMembers.Where(p => p.RelationType == 0).FirstOrDefault();
                        }

                        if (listMembers.Where(p => p.RelationType == 1).FirstOrDefault() != null)
                        {
                            mumMember = listMembers.Where(p => p.RelationType == 1).FirstOrDefault();
                        }

                        dadMember.MemberName = dadName;
                        mumMember.MemberName = mumName;

                        if (dadMember != null && dadMember.MembersId > 0)
                        {
                            ResultInfo <bool> result_DadMemberUpdate = pbsBasicMembersService.UpdateMembers(dadMember.MemberName, dadMember.Sex, dadMember.RelationType, dadMember.Birthday, dadMember.IDNum, dadMember.UserId, dadMember.CreateTime, dadMember.UpdateTime, dadMember.CreatorId, dadMember.Remark, dadMember.MembersId);
                            if (result_DadMemberUpdate.Result && result_DadMemberUpdate.Data)
                            {
                                flag = true;
                            }
                        }

                        if (mumMember != null && mumMember.MembersId > 0)
                        {
                            ResultInfo <bool> result_MumMemberUpdate = pbsBasicMembersService.UpdateMembers(mumMember.MemberName, mumMember.Sex, mumMember.RelationType, mumMember.Birthday, mumMember.IDNum, mumMember.UserId, mumMember.CreateTime, mumMember.UpdateTime, mumMember.CreatorId, mumMember.Remark, mumMember.MembersId);
                            if (result_MumMemberUpdate.Result && result_MumMemberUpdate.Data)
                            {
                                flag = true;
                            }
                        }

                        if (flag)
                        {
                            return(Json(new ResultModel <bool>(0, "修改成功", true), JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        dadMember.MemberName   = dadName;
                        dadMember.Sex          = 0;
                        dadMember.RelationType = 0;
                        dadMember.Birthday     = string.Empty;
                        dadMember.IDNum        = string.Empty;
                        dadMember.UserId       = userid;
                        dadMember.CreateTime   = DateTime.Now;
                        dadMember.UpdateTime   = DateTime.Now;
                        dadMember.CreatorId    = 0;
                        dadMember.Remark       = string.Empty;
                        mumMember.MemberName   = mumName;
                        mumMember.Sex          = 0;
                        mumMember.RelationType = 0;
                        mumMember.Birthday     = string.Empty;
                        mumMember.IDNum        = string.Empty;
                        mumMember.UserId       = userid;
                        mumMember.CreateTime   = DateTime.Now;
                        mumMember.UpdateTime   = DateTime.Now;
                        mumMember.CreatorId    = 0;
                        mumMember.Remark       = string.Empty;

                        ResultInfo <bool> result_DadMemberUpdate = pbsBasicMembersService.AddMembers(dadMember.MemberName, dadMember.Sex, dadMember.RelationType, dadMember.Birthday, dadMember.IDNum, dadMember.UserId, dadMember.CreateTime, dadMember.UpdateTime, dadMember.CreatorId, dadMember.Remark);
                        ResultInfo <bool> result_MumMemberUpdate = pbsBasicMembersService.AddMembers(mumMember.MemberName, mumMember.Sex, mumMember.RelationType, mumMember.Birthday, mumMember.IDNum, mumMember.UserId, mumMember.CreateTime, mumMember.UpdateTime, mumMember.CreatorId, mumMember.Remark);
                        if (result_DadMemberUpdate.Result && result_DadMemberUpdate.Data && result_MumMemberUpdate.Result && result_MumMemberUpdate.Data)
                        {
                            return(Json(new ResultModel <bool>(0, "修改成功", true), JsonRequestBehavior.AllowGet));
                        }
                    }
                }
            }
            return(Json(new ResultModel <bool>(1, "修改失败", true), JsonRequestBehavior.AllowGet));
        }