public ActionResult UserAdd(FormCollection collection) { RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); string id = Request.QueryString["id"]; string name = string.Empty; string account = string.Empty; string status = string.Empty; string note = string.Empty; Guid parentID; if (collection != null && id.IsGuid(out parentID)) { name = Request.Form["Name"]; account = Request.Form["Account"]; status = Request.Form["Status"]; note = Request.Form["Note"]; Guid userID = Guid.NewGuid(); string userXML = string.Empty; using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope()) { //添加人员 RoadFlow.Data.Model.Users user = new RoadFlow.Data.Model.Users(); user.Account = account.Trim(); user.Name = name.Trim(); user.Note = note.IsNullOrEmpty() ? null : note; user.Password = busers.GetUserEncryptionPassword(userID.ToString(), busers.GetInitPassword()); user.Sort = 1; user.Status = status.IsInt() ? status.ToInt() : 0; user.ID = userID; busers.Add(user); //添加关系 RoadFlow.Data.Model.UsersRelation userRelation = new RoadFlow.Data.Model.UsersRelation(); userRelation.IsMain = 1; userRelation.OrganizeID = parentID; userRelation.Sort = new RoadFlow.Platform.UsersRelation().GetMaxSort(parentID); userRelation.UserID = userID; new RoadFlow.Platform.UsersRelation().Add(userRelation); //更新父级[ChildsLength]字段 borganize.UpdateChildsLength(parentID); //更新角色 new RoadFlow.Platform.UsersRole().UpdateByUserID(userID); userXML = user.Serialize(); scope.Complete(); } RoadFlow.Platform.Log.Add("添加了人员", userXML, RoadFlow.Platform.Log.Types.组织机构); ViewBag.Script = "alert('添加成功!');parent.frames[0].reLoad('" + id + "');window.location=window.location;"; } ViewBag.StatusRadios = borganize.GetStatusRadio("Status", "0", "validate=\"radio\""); return(View()); }
protected void Page_Load(object sender, EventArgs e) { this.Account.Attributes.Add("validate_url", "CheckAccount.ashx"); RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); string id = Request.QueryString["id"]; string name = string.Empty; string account = string.Empty; string status = string.Empty; string note = string.Empty; Guid parentID; if (IsPostBack && id.IsGuid(out parentID)) { name = Request.Form["Name"]; account = Request.Form["Account"]; status = Request.Form["Status"]; note = Request.Form["Note"]; Guid userID = Guid.NewGuid(); string userXML = string.Empty; using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope()) { //添加人员 RoadFlow.Data.Model.Users user = new RoadFlow.Data.Model.Users(); user.Account = account.Trim(); user.Name = name.Trim(); user.Note = note.IsNullOrEmpty() ? null : note; user.Password = busers.GetUserEncryptionPassword(userID.ToString(), busers.GetInitPassword()); user.Sort = 1; user.Status = status.IsInt() ? status.ToInt() : 0; user.ID = userID; busers.Add(user); //添加关系 RoadFlow.Data.Model.UsersRelation userRelation = new RoadFlow.Data.Model.UsersRelation(); userRelation.IsMain = 1; userRelation.OrganizeID = parentID; userRelation.Sort = new RoadFlow.Platform.UsersRelation().GetMaxSort(parentID); userRelation.UserID = userID; new RoadFlow.Platform.UsersRelation().Add(userRelation); //更新父级[ChildsLength]字段 borganize.UpdateChildsLength(parentID); //更新角色 new RoadFlow.Platform.UsersRole().UpdateByUserID(userID); userXML = user.Serialize(); scope.Complete(); } RoadFlow.Platform.Log.Add("添加了人员", userXML, RoadFlow.Platform.Log.Types.组织机构); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');parent.frames[0].reLoad('" + id + "');window.location=window.location;", true); } this.StatusRadios.Text = borganize.GetStatusRadio("Status", "0", "validate=\"radio\""); }
public ActionResult EditUserInfo(FormCollection collection) { RoadFlow.Platform.Users users = new RoadFlow.Platform.Users(); Guid currentUserId = RoadFlow.Platform.Users.CurrentUserID; RoadFlow.Data.Model.Users model = users.Get(currentUserId); if (collection != null) { string str1 = this.Request.Form["Tel"]; string str2 = this.Request.Form["MobilePhone"]; string str3 = this.Request.Form["WeiXin"]; string str4 = this.Request.Form["Email"]; string str5 = this.Request.Form["QQ"]; string str6 = this.Request.Form["OtherTel"]; string str7 = this.Request.Form["Note"]; int num = 0; model.Tel = str1; model.Mobile = str2; model.WeiXin = str3; model.Email = str4; model.QQ = str5; model.OtherTel = str6; model.Note = str7; if (num != 0) { users.Add(model); } else { users.Update(model); } // ISSUE: reference to a compiler-generated field if (UserInfoController.\u003C\u003Eo__2.\u003C\u003Ep__0 == null) { // ISSUE: reference to a compiler-generated field UserInfoController.\u003C\u003Eo__2.\u003C\u003Ep__0 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "script", typeof(UserInfoController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null), CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, (string)null) })); } // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field object obj = UserInfoController.\u003C\u003Eo__2.\u003C\u003Ep__0.Target((CallSite)UserInfoController.\u003C\u003Eo__2.\u003C\u003Ep__0, this.ViewBag, "alert('保存成功!');window.location=window.location;"); } return((ActionResult)this.View((object)model)); }