/// <summary> /// 分配帐号 /// </summary> /// <returns></returns> void FenPei() { var info = new EyouSoft.BLL.GysStructure.BGys().GetGysUserInfo(GysId); bool IsAdd = info == null; string account = Utils.GetFormValue(this.txtAccount.UniqueID); string pwd = Utils.GetFormValue(this.txtPwd.UniqueID); if (string.IsNullOrEmpty(account)) { RCWE(UtilsCommons.AjaxReturnJson("0", "帐号不能为空!")); } if (string.IsNullOrEmpty(pwd)) { RCWE(UtilsCommons.AjaxReturnJson("0", "密码不能为空!")); } IList <EyouSoft.Model.SourceStructure.MSourceTravelRouteArea> TravelRouteArea = new List <EyouSoft.Model.SourceStructure.MSourceTravelRouteArea>(); string[] routeAreaList = Utils.GetFormValue(this.LineAreaSelect1.LineAreaSelectIDClient).Split(','); string[] routeAreaName = Utils.GetFormValue(this.LineAreaSelect1.LineAreaSelectNameClient).Split(','); if (routeAreaName.Length > 0 && routeAreaList.Length > 0) { for (int i = 0; i < routeAreaList.Length; i++) { TravelRouteArea.Add(new EyouSoft.Model.SourceStructure.MSourceTravelRouteArea { RouteAreaId = Utils.GetInt(routeAreaList[i].ToString()), SourceId = GysId, RouteAreaName = routeAreaName[i].ToString().Trim() }); } } EyouSoft.BLL.SourceStructure.BSource bll = new EyouSoft.BLL.SourceStructure.BSource(); int result = 0; if (IsAdd) { result = bll.AddAccountToTravel(GysId, this.SiteUserInfo.CompanyId, account, pwd, this.SiteUserInfo.UserId, this.SiteUserInfo.Username, this.SiteUserInfo.DeptId, TravelRouteArea); } else { result = bll.UpdateTravelAccountStatus(GysId, EyouSoft.Model.EnumType.ComStructure.UserStatus.正常, pwd, TravelRouteArea, true); } if (result == 1) { if (IsAdd) { RCWE(EyouSoft.Common.UtilsCommons.AjaxReturnJson("1", "分配成功")); } else { RCWE(EyouSoft.Common.UtilsCommons.AjaxReturnJson("1", "修改成功")); } } else if (result == -1) { RCWE(EyouSoft.Common.UtilsCommons.AjaxReturnJson("0", "此帐号已存在,请重新分配!")); } else { RCWE(EyouSoft.Common.UtilsCommons.AjaxReturnJson("0", "分配失败,请重试!")); } }