예제 #1
0
        /// <summary>
        /// 保存修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvList_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            IAdminManage iam = GetInterface.GetIAdminManage();
            GridViewRow  gvr = this.gvList.Rows[e.RowIndex];

            int    oldGid   = ((LinkButton)gvr.FindControl("btnupdate_Update")).CommandArgument.ToString().GetInt(0);
            string nickName = ((TextBox)gvr.FindControl("tb_NickName")).Text.Trim();
            int    gid      = ((DropDownList)gvr.FindControl("ddl_GroupList")).SelectedValue.GetInt(0);
            string email    = ((TextBox)gvr.FindControl("tb_Email")).Text.Trim();
            int    AID      = this.gvList.DataKeys[e.RowIndex].Value.GetInt(0);

            if (nickName.Length == 0 || nickName.Length > 10)
            {
                this.Alert(AdminCollect.EDITOR_INFO_ERR_NICKNAME_ERR);
                return;
            }
            if (!email.IsEmail())
            {
                this.Alert(AdminCollect.EDITOR_INFO_ERR_EMAIL_ERR);
                return;
            }
            if (!iam.UpdateBaseInfo(nickName, email, AID))
            {
                this.Alert(AdminCollect.EDITOR_INFO_ERR_SAVE_ERR);
                return;
            }


            if (gid == 0)
            {
                this.Alert(AdminCollect.EDITOR_INFO_ERR_GROUP_ERR);
                return;
            }
            int arg = ((DropDownList)gvr.FindControl("ddl_rolearg")).SelectedValue.GetInt(0);

            if (!(arg == 0 && gid == oldGid))
            {
                if (!iam.UpdateGroup(gid, AID, (CYJH_OrderSystem.Admin.Base.Contract.Enums.EUpdateGroupArg)arg))
                {
                    this.Alert(AdminCollect.EDITOR_INFO_ERR_SAVE_GROUP_ERR);
                }
            }
            SiteRuleCheck.FlushPageAndRightCache();
            this.gvList.EditIndex = -1;
            DgBind();
        }
예제 #2
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            IAdminManage iamobj    = GetInterface.GetIAdminManage();
            string       anickname = this.tb_NickName.Text.Trim();
            string       pwd1      = this.tb_LoginPwd1.Text.Trim();
            string       pwd2      = this.tb_LoginPwd2.Text.Trim();
            string       oldpwd    = this.tb_OldPwd.Text.Trim();
            string       email     = this.tb_Email.Text.Trim();

            if (!string.IsNullOrEmpty(oldpwd))
            {
                if (!pwd1.IsPassWord(false))
                {
                    this.Alert(CYJH_OrderSystem.Admin.Base.LangPack.AdminCollect.EDITOR_INFO_ERR_PWD_ERR);
                    return;
                }
                if (pwd1 != pwd2)
                {
                    this.Alert(AdminCollect.EDITOR_INFO_ERR_PWD_NOT_THE_SAME);
                    return;
                }
                CYJH_OrderSystem.Admin.Base.Contract.Enums.EUpdatePwdReturn result1 = iamobj.UpdatePwd(this.AdminInfo.AID, oldpwd, pwd1);
                if (result1 == CYJH_OrderSystem.Admin.Base.Contract.Enums.EUpdatePwdReturn.OldPwdDeny)
                {
                    this.Alert(AdminCollect.EDITOR_INFO_ERR_OLD_PWD_ERR);
                    return;
                }
                else if (result1 == CYJH_OrderSystem.Admin.Base.Contract.Enums.EUpdatePwdReturn.Error)
                {
                    this.Alert(AdminCollect.EDITOR_INFO_ERR_SAVE_ERR);
                    return;
                }
            }

            if (anickname.Length == 0 || anickname.Length > 10)
            {
                this.Alert(CYJH_OrderSystem.Admin.Base.LangPack.AdminCollect.EDITOR_INFO_ERR_NICKNAME_ERR);
                return;
            }

            if (!email.IsEmail())
            {
                this.Alert(CYJH_OrderSystem.Admin.Base.LangPack.AdminCollect.EDITOR_INFO_ERR_EMAIL_ERR);
                return;
            }

            bool result = iamobj.UpdateBaseInfo(anickname, email, this.AdminInfo.AID);

            if (result)
            {
                this.AdminInfo.Email     = email;
                this.AdminInfo.ANickName = anickname;
                AdminPageStatic.SaveUserFormsCookie(this.AdminInfo);

                this.Alert(CYJH_OrderSystem.Admin.Base.LangPack.AdminCollect.EDITOR_INFO_SUCCESS);
            }
            else
            {
                this.Alert(CYJH_OrderSystem.Admin.Base.LangPack.AdminCollect.EDITOR_INFO_SUCCESS_PWD_BUT_BASEINFO);
            }
        }