public void SetUserInfoEx(UserInfoEx info) { bigAvatarPanel.BackgroundImage = info.AvatarBig; smallAvatarPanel.BackgroundImage = info.AvatarSmall; aboutRichTextBox.Text = info.About; ContactListUtils.UnpackContacts(info.Contacts, contactsListView); }
public void GetUserInfo() { dbInfo = new UserInfoEx { Id = 1, AvatarBigFileName = "AvatarBig.png", AvatarSmallFileName = "AvatarSmall.png", AboutFileName = "About.rtf", Contacts = "*****@*****.**", AvatarBig = SystemIcons.Information.ToBitmap(), AvatarSmall = SystemIcons.Warning.ToBitmap(), About = "About" }; cache = new UserInfoExCache(source.Object); var path = ExecutablePath.ExecPath + "\\files"; Assert.IsTrue(Directory.Exists(path), "cache directory " + path + " not found"); // 1st test // db with 3 files, cache is empty calls.Clear(); cache.GetUserInfo(1); Assert.AreEqual(4, calls.Count, "1: request count mismatch"); Assert.IsTrue(calls.Contains("GetUserBriefInfo 1"), "1: GetUserBriefInfo not found"); Assert.IsTrue(calls.Contains("ReadFile " + dbInfo.AvatarBigFileName), "1: ReadFile AvatarBigFileName not found"); Assert.IsTrue(calls.Contains("ReadFile " + dbInfo.AvatarSmallFileName), "1: ReadFile AvatarSmallFileName not found"); Assert.IsTrue(calls.Contains("ReadFile " + dbInfo.AboutFileName), "1: ReadFile AboutFileName not found"); // 2nd test // db with 3 files, cache is filled calls.Clear(); cache.GetUserInfo(1); Assert.AreEqual(1, calls.Count, "2: request count mismatch"); Assert.IsTrue(calls.Contains("GetUserBriefInfo 1"), "2: GetUserBriefInfo not found"); // 3rd test // 1 file is changed in db, cache is filled dbInfo.AvatarBig = SystemIcons.Error.ToBitmap(); calls.Clear(); cache.GetUserInfo(1); Assert.AreEqual(2, calls.Count, "3: request count mismatch"); Assert.IsTrue(calls.Contains("GetUserBriefInfo 1"), "3: GetUserBriefInfo not found"); Assert.IsTrue(calls.Contains("ReadFile " + dbInfo.AvatarBigFileName), "3: ReadFile AvatarBigFileName not found"); // 4th test // 1 file deleted from db, then added, cache is filled dbInfo.AvatarBigFileName = null; dbInfo.AvatarBig = null; calls.Clear(); cache.GetUserInfo(1); Assert.AreEqual(1, calls.Count, "4.1: request count mismatch"); Assert.IsTrue(calls.Contains("GetUserBriefInfo 1"), "4.1: GetUserBriefInfo not found"); calls.Clear(); dbInfo.AvatarBigFileName = "AvatarBig.png"; dbInfo.AvatarBig = SystemIcons.Error.ToBitmap(); cache.GetUserInfo(1); Assert.AreEqual(1, calls.Count, "4.2: request count mismatch"); Assert.IsTrue(calls.Contains("GetUserBriefInfo 1"), "4.2: GetUserBriefInfo not found"); }
public bool WriteFile(string name, byte[] data) { using (var context = DatabaseContext.Instance.Make()) { try { var file = context.FILE.Find(name); if (file == null) { context.FILE.Add(new FILE { Name = name, Data = data, HashCode = UserInfoEx.ComputeHash(data) }); } else { file.Data = data; file.HashCode = UserInfoEx.ComputeHash(data); } context.SaveChanges(); } catch (Exception ex) { Logger.Error("AccountEfficiencyCache.WriteFile", ex); return(false); } } return(true); }
protected UserInfoEx LoadUserInfoEx(Guid userID) { var dep = GetDepartmentForUser(userID); var ui = new UserInfoEx { Info = CoreContext.UserManager.GetUsers(userID), PhotoPath = UserPhotoManager.GetPhotoAbsoluteWebPath(userID), DepartmentID = (dep != null) ? dep.ID : Guid.Empty, Department = (dep != null) ? dep.Name.HtmlEncode() : "", }; var nodes = SocialContactsManager.xmlSocialContacts.GetElementsByTagName("contact"); if (nodes == null) { return(ui); } for (Int32 i = 0, n = nodes.Count; i < n; i++) { ui.Contacts.Add(GetSocialContact((XmlElement)nodes[i])); } return(ui); }
private void UserInfoExReceivedInternal(UserInfoEx info) { if (UserInfoExReceived != null) { UserInfoExReceived(info); } }
/// <summary> /// /// </summary> /// <param name="user"></param> /// <returns></returns> public ApiMessage <string> EditPassWord(UserInfoEx user) { var api = new ApiMessage <string>(); var gCode = CacheHelper.GetCache("VCode_" + user.UserCode); if (gCode == null) { api.Success = false; api.Msg = "验证码已过期"; return(api); } if (gCode.ToString() != user.VerifyCode) { api.Success = false; api.Msg = "验证码有误"; return(api); } var dbModel = _dal.GetByPhone(user.UserCode); if (!dbModel.Success) { api.Success = false; api.Msg = "账号不存在"; return(api); } var dbUser = dbModel.Data; dbUser.PassWord = Encrypt.MD5(user.PassWord); return(_dal.Edit(dbUser)); }
/// <summary> /// /// </summary> /// <param name="user"></param> /// <returns></returns> public ApiMessage <string> EditUser(UserInfoEx user) { var dbUser = _dal.Get(user.ID).Data; dbUser.UserName = user.UserName; dbUser.ImgUrl = user.ImgUrl; var api = _dal.Edit(dbUser); return(api); }
public UserInfoEx GetUserInfo() { var result = new UserInfoEx(); var rows = userInfoFastGrid.GetRowValues <Cortege2 <string, string> >(false).ToList(); result.Id = rows.FirstOrDefault(pair => pair.a == "ID").b.ToInt(0); result.AvatarBig = bigAvatarPanel.BackgroundImage as Bitmap; result.AvatarSmall = smallAvatarPanel.BackgroundImage as Bitmap; result.About = aboutRichTextBox.Text; result.Contacts = ContactListUtils.PackContacts(contactsListView); return(result); }
private static FILE CreateBitmap(Bitmap bitmap, string fileName = "") { var result = new FILE(); if (string.IsNullOrEmpty(fileName)) { fileName = string.Format("{0}", Guid.NewGuid()) + ".png"; } result.Name = fileName; result.Data = UserInfoEx.GetBitmapData(bitmap); result.HashCode = UserInfoEx.ComputeHash(result.Data); return(result); }
private static bool UpdateBitmap(FILE file, Bitmap bitmap) { var data = UserInfoEx.GetBitmapData(bitmap); var hash = UserInfoEx.ComputeHash(data); if (file.HashCode == hash) { return(false); } file.Data = data; file.HashCode = hash; return(true); }
private static FILE CreateText(string text, string fileName = "") { var result = new FILE(); if (string.IsNullOrEmpty(fileName)) { fileName = string.Format("{0}", Guid.NewGuid()) + ".rtf"; } result.Name = fileName; result.Data = UserInfoEx.GetTextData(text); result.HashCode = UserInfoEx.ComputeHash(result.Data); return(result); }
private static bool UpdateText(FILE file, string text) { var data = UserInfoEx.GetTextData(text); var hash = UserInfoEx.ComputeHash(data); if (file.HashCode == hash) { return(false); } file.Data = data; file.HashCode = hash; return(true); }
public void SetVoidUserInfo() { var sourceVoid1 = new Mock <IAccountStatistics>(); sourceVoid1.Setup(s => s.GetUserInfo(It.IsAny <int>())).Returns <int>(GetUserInfo); sourceVoid1.Setup(s => s.GetUsersBriefInfo(It.IsAny <List <int> >())).Returns <List <int> >(ids => { calls.Add(string.Format("GetUserBriefInfo {0}", 1)); return(null); }); sourceVoid1.Setup(s => s.SetUserInfo(It.IsAny <UserInfoEx>())).Returns <UserInfoEx>(SetUserInfo); sourceVoid1.Setup(s => s.ReadFiles(It.IsAny <List <string> >())).Returns <List <string> >(names => null); sourceVoid1.Setup(s => s.WriteFile(It.IsAny <string>(), It.IsAny <byte[]>())).Returns <string, byte[]>(WriteFile); cache = new UserInfoExCache(sourceVoid1.Object); calls.Clear(); cache.SetUserInfo(new UserInfoEx { Id = 1, Contacts = "*****@*****.**", AvatarBig = SystemIcons.Information.ToBitmap(), AvatarSmall = SystemIcons.Warning.ToBitmap(), About = "About" }); Assert.IsTrue(calls.Contains("GetUserBriefInfo 1"), "2: GetUserBriefInfo not found"); dbInfo = new UserInfoEx { Id = 1, AvatarBigFileName = "AvatarBig.png", AboutFileName = "About.rtf", Contacts = "*****@*****.**", AvatarBig = SystemIcons.Information.ToBitmap(), AvatarSmall = SystemIcons.Warning.ToBitmap(), About = "About" }; sourceVoid1.Setup(s => s.GetUsersBriefInfo(It.IsAny <List <int> >())).Returns <List <int> >(GetUsersBriefInfo); cache = new UserInfoExCache(sourceVoid1.Object); cache.SetUserInfo(new UserInfoEx { Id = 1, Contacts = "*****@*****.**", AvatarBig = SystemIcons.Information.ToBitmap(), AvatarSmall = SystemIcons.Warning.ToBitmap(), About = "About" }); }
private void UserInfoExReceived(UserInfoEx info) { if (isStopping) { return; } try { BeginInvoke(new Action <UserInfoEx>(OnUserInfoExReceive), info); } catch (Exception) { } }
public ApiMessage <string> EditUser(UserInfoEx user) { user.ID = UserInfo.Id; user.UserCode = UserInfo.UserCode; var api = _bll.EditUser(user); if (api.Success) { var key = Encrypt.MD5(UserInfo.Id + "_用户"); var currentUser = (CurrentUser)CacheHelper.GetCache(key); currentUser.UserName = user.UserName; currentUser.ImageUrl = user.ImgUrl; CacheHelper.SetCache(key, currentUser, new TimeSpan(0, 30, 0)); } return(api); }
public ApiMessage <string> UploadImg() { var request = System.Web.HttpContext.Current.Request; var res = new ApiMessage <string>(); var files = request.Files; string[] limitPictureType = { ".JPG", ".JPEG", ".GIF", ".PNG", ".BMP" }; if (files.Count > 0) { var file = files[0]; var name = file.FileName; //获取后缀名 string namejpg = Path.GetExtension(name).ToUpper(); //判断是否符合要求 if (!limitPictureType.Contains(namejpg) && file.ContentLength > 0) { res.Success = false; res.Msg = "图片格式错误"; return(res); } var tempPath = $"/images/" + UserInfo.UserCode + "/"; //获取上传的路径 var path = System.Web.Hosting.HostingEnvironment.MapPath(tempPath); //生成一个新的文件名 var gid = Guid.NewGuid().ToString(); var newname = gid + namejpg; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } //上传 file.SaveAs(path + newname); res.Data = tempPath + newname; //更新数据库 var user = new UserInfoEx(); user.UserName = UserInfo.UserName; user.ImgUrl = res.Data; EditUser(user); return(res); } return(new ApiMessage <string>() { Success = false, Msg = "上传失败" }); }
/// <summary> /// /// </summary> /// <param name="user"></param> /// <returns></returns> public ApiMessage <string> Registered(UserInfoEx user) { var api = new ApiMessage <string>(); var gCode = CacheHelper.GetCache("VCode_" + user.UserCode); if (_dal.GetByPhone(user.UserCode).Success) { api.Success = false; api.Msg = "手机号已注册"; return(api); } if (gCode == null) { api.Success = false; api.Msg = "验证码已过期"; return(api); } if (gCode.ToString() != user.VerifyCode) { api.Success = false; api.Msg = "验证码有误"; return(api); } var strDate = ConfigurationManager.AppSettings["Member_Date"]; if (string.IsNullOrEmpty(strDate)) { strDate = "2020-10-31"; } var dbUser = new userinfo { ID = Guid.NewGuid().ToString(), IsActive = 1, IsMember = 0, PassWord = Encrypt.MD5(user.PassWord), CreateDate = DateTime.Now, Phone = user.UserCode, UserCode = user.UserCode, ImgUrl = "", UserName = "******" + new Random().Next(100000, 999999), MemberDate = DateTime.Parse(strDate) }; api = _dal.Add(dbUser); return(api); }
private UserInfoEx CreateUserInfoEx(USER_INFO info, bool full) { var result = new UserInfoEx(); result.Id = info.Id; result.AvatarBigFileName = info.AvatarBig; // if full reading is enabled, then hash codes will be set automatically with setting data if (info.FILE_BIG != null) { if (full) { result.AvatarBigData = info.FILE_BIG.Data; } else { result.AvatarBigHashCode = info.FILE_BIG.HashCode ?? UserInfoEx.ComputeHash(result.AvatarBigData); } } result.AvatarSmallFileName = info.AvatarSmall; if (info.FILE_SMALL != null) { if (full) { result.AvatarSmallData = info.FILE_SMALL.Data; } else { result.AvatarSmallHashCode = info.FILE_SMALL.HashCode ?? UserInfoEx.ComputeHash(result.AvatarSmallData); } } result.AboutFileName = info.About; if (info.FILE_ABOUT != null) { if (full) { result.AboutData = info.FILE_ABOUT.Data; } else { result.AboutHashCode = info.FILE_ABOUT.HashCode ?? UserInfoEx.ComputeHash(result.AboutData); } } result.Contacts = info.Contacts; return(result); }
public void SetUserInfo() { cache = new UserInfoExCache(source.Object); dbInfo = new UserInfoEx { Id = 1 }; var info = new UserInfoEx { Id = 1, Contacts = "*****@*****.**", AvatarBig = SystemIcons.Information.ToBitmap(), AvatarSmall = SystemIcons.Warning.ToBitmap(), About = "About" }; // 1st test // db is empty, cache is empty calls.Clear(); cache.SetUserInfo(info); // info with 3 files Assert.AreEqual(2, calls.Count, "1: request count mismatch"); Assert.IsTrue(calls.Contains("GetUserBriefInfo 1"), "1: GetUserBriefInfo not found"); Assert.IsTrue(calls.Contains("SetUserInfo 1"), "1: SetUserInfo not found"); // 2nd test // db with 3 files, cache is filled info.AvatarBig = SystemIcons.Error.ToBitmap(); calls.Clear(); cache.SetUserInfo(info); // info with 3 files, 1 file changed Assert.AreEqual(3, calls.Count, "2: request count mismatch"); Assert.IsTrue(calls.Contains("GetUserBriefInfo 1"), "2: GetUserBriefInfo not found"); Assert.IsTrue(calls.Contains("WriteFile " + dbInfo.AvatarBigFileName), "2: GetUserBriefInfo not found"); Assert.IsTrue(calls.Contains("SetUserInfo 1"), "2: SetUserInfo not found"); // 3rd test // db with 3 files, cache is filled info.AvatarBig = null; info.AvatarSmall = null; info.About = null; calls.Clear(); cache.SetUserInfo(info); // info with no files Assert.AreEqual(1, calls.Count, "3: request count mismatch"); Assert.IsTrue(calls.Contains("SetUserInfo 1"), "3: SetUserInfo not found"); }
private void OnUserInfoExReceive(UserInfoEx info) { if (info == null) { return; } var form = new UserInfoForm(); var user = AllUsers.Instance.GetUser(info.Id) ?? new User { ID = info.Id }; form.SetUser(user); form.SetUserInfoEx(info); //form.SetReadOnly(engine.CurrentUserId != info.Id); form.SetReadOnly(true); if (form.ShowDialog(this) == DialogResult.Cancel) { return; } engine.SetUserInfoEx(form.GetUserInfo()); }
// запись файла в БД с обновлением кэша в случае необходимости private bool SetFile(string name, byte[] data) { if (string.IsNullOrEmpty(name)) { return(false); } try { var cacheFileName = path + "\\" + name; if (File.Exists(cacheFileName) && UserInfoEx.ComputeHash(File.ReadAllBytes(cacheFileName)) == UserInfoEx.ComputeHash(data)) { return(false); } dataSource.WriteFile(name, data); File.WriteAllBytes(cacheFileName, data); return(true); } catch (Exception ex) { Logger.Info(string.Format("UserInfoExCache.SetFile: error caching file {0}", name), ex); return(false); } }
// если файловые данные (аватары, текст) не меняются, то передается null и действительная хеш-сумма public UserInfoEx SetUserInfo(UserInfoEx info) { UserInfoEx result; using (var context = DatabaseContext.Instance.Make()) { try { var dbUserInfo = context.USER_INFO.Find(info.Id); var userInfoAdded = false; var fileChanged = false; if (dbUserInfo == null) { dbUserInfo = new USER_INFO(); dbUserInfo.Id = info.Id; userInfoAdded = true; } // big avatar if (dbUserInfo.AvatarBig == null) { if (info.AvatarBig != null) // insert { dbUserInfo.AvatarBig = context.FILE.Add(CreateBitmap(info.AvatarBig)).Name; } } else if (dbUserInfo.FILE_BIG.HashCode != info.AvatarBigHashCode) { if (info.AvatarBig == null) // delete { context.FILE.Remove(dbUserInfo.FILE_BIG); dbUserInfo.AvatarBig = null; } else // update { if (UpdateBitmap(dbUserInfo.FILE_BIG, info.AvatarBig)) { fileChanged = true; } } } // small avatar if (dbUserInfo.AvatarSmall == null) { if (info.AvatarSmall != null) // insert { dbUserInfo.AvatarSmall = context.FILE.Add(CreateBitmap(info.AvatarSmall)).Name; } } else if (dbUserInfo.FILE_SMALL.HashCode != info.AvatarSmallHashCode) { if (info.AvatarSmall == null) // delete { context.FILE.Remove(dbUserInfo.FILE_SMALL); dbUserInfo.AvatarSmall = null; } else // update { if (UpdateBitmap(dbUserInfo.FILE_SMALL, info.AvatarSmall)) { fileChanged = true; } } } // about if (dbUserInfo.About == null) { if (info.About != null) // insert { dbUserInfo.About = context.FILE.Add(CreateText(info.About)).Name; } } else if (dbUserInfo.FILE_ABOUT.HashCode != info.AboutHashCode) { if (info.About == null) // delete { context.FILE.Remove(dbUserInfo.FILE_ABOUT); dbUserInfo.About = null; } else // update { if (UpdateText(dbUserInfo.FILE_ABOUT, info.About)) { fileChanged = true; } } } if (fileChanged) { context.SaveChanges(); } dbUserInfo.Contacts = info.Contacts; if (userInfoAdded) { context.USER_INFO.Add(dbUserInfo); } context.SaveChanges(); result = CreateUserInfoEx(dbUserInfo, false); } catch (Exception ex) { Logger.Error("AccountEfficiencyCache.SetUserInfo", ex); return(null); } } return(result); }
public void SetUserInfoEx(UserInfoEx info) { QueueRequest(new ChatRequest(RequestCode.SetUserInfoEx, new List <object> { info }, -1)); }
public void DataBind(List <PerformerStatEx> performerStats, ChatControlBackEnd chat) { var images = imgListChartMini.Images.Cast <Image>().ToList(); imgListChartMini.Images.Clear(); foreach (var img in images) { img.Dispose(); } var data = new List <PerformerStatEx>(); // UserScore вычисляется на сервере // RecalcUserScore(performerStats); var userInfoExSource = new UserInfoExCache(TradeSharpAccountStatistics.Instance.proxy); var usersInfoEx = userInfoExSource.GetUsersInfo(performerStats.Select(p => p.UserId).Distinct().ToList()); var rowColors = new[] { Color.Red, Color.ForestGreen, Color.Black }; var stringFormat = new StringFormat { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center }; using (var font = new Font(Font.FontFamily, 7)) foreach (var performerStat in performerStats) { // создать картинку с графиком var bmp = new Bitmap(imgListChartMini.ImageSize.Width, imgListChartMini.ImageSize.Height); if (performerStat.Chart != null) { using (var gr = Graphics.FromImage(bmp)) { var leftValue = performerStat.AvgYearProfit; var leftText = string.Format("{0:f2}%", leftValue); var leftTextWidth = gr.MeasureString(leftText, font).ToSize().Width; var rightValue = performerStat.ProfitLastMonthsAbs; var rightText = rightValue.ToStringUniformMoneyFormat(false); var textWidth = leftTextWidth + gr.MeasureString(rightText, font).ToSize().Width; if (!ShowLabelsInMiniChart) { textWidth = 0; } PointF[] points; if (ChartBrush != null) { points = MiniChartPacker.MakePolygon(performerStat.Chart, imgListChartMini.ImageSize.Width - textWidth, imgListChartMini.ImageSize.Height, 1, 1); } else { points = MiniChartPacker.MakePolyline(performerStat.Chart, imgListChartMini.ImageSize.Width - textWidth, imgListChartMini.ImageSize.Height, 1, 1); } gr.SmoothingMode = SmoothingMode.AntiAlias; gr.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; if (ShowLabelsInMiniChart) { for (var i = 0; i < points.Length; i++) { points[i] = new PointF(points[i].X + leftTextWidth, points[i].Y); } gr.DrawString(leftText, font, new SolidBrush(leftValue >= 0 ? rowColors[1] : rowColors[0]), 0, imgListChartMini.ImageSize.Height / 2, stringFormat); gr.DrawString(rightText, font, new SolidBrush(rightValue >= 0 ? rowColors[1] : rowColors[0]), imgListChartMini.ImageSize.Width - textWidth + leftTextWidth, imgListChartMini.ImageSize.Height / 2, stringFormat); } if (ChartBrush != null) { gr.FillPolygon(ChartBrush, points); } else { gr.DrawLines(ChartPen ?? new Pen(leftValue >= 0 ? rowColors[1] : rowColors[0], 2), points); } } } var item = new PerformerStatEx(performerStat) { ChartIndex = imgListChartMini.Images.Count }; imgListChartMini.Images.Add(bmp); imgListChartMini.Images.SetKeyName(item.ChartIndex, item.ChartIndex.ToString()); // создать фотку UserInfoEx userInfoEx = null; if (usersInfoEx != null) { userInfoEx = usersInfoEx.Find(ui => ui != null && ui.Id == performerStat.UserId); } if (userInfoEx != null && userInfoEx.AvatarSmall != null) { item.AvatarSmallIndex = imgListAvatar.Images.Count; imgListAvatar.Images.Add(userInfoEx.AvatarSmall); imgListAvatar.Images.SetKeyName(item.AvatarSmallIndex, item.AvatarSmallIndex.ToString()); } else { item.AvatarSmallIndex = -1; } data.Add(item); } grid.DataBind(data); grid.Invalidate(); if (this.chat != null) { this.chat.RoomsReceived -= RoomsReceived; } this.chat = chat; if (chat == null) { return; } chat.RoomsReceived += RoomsReceived; chat.GetRooms(); }
private void EditExisting() { var login = AccountStatus.Instance.Login; if (string.IsNullOrEmpty(login)) { return; } if (string.IsNullOrEmpty(oldPassword)) { return; } if (editedUser == null) { return; } if (editedAccount == null) { return; } // собрать данные var user = new PlatformUser { Email = tbEmail.Text, Login = tbLogin.Text, Name = tbName.Text, Surname = tbSurname.Text, Patronym = tbPatronym.Text, Phone1 = tbPhone1.Text, Phone2 = tbPhone2.Text, Description = tbDescription.Text, Password = tbPassword.Text }; var maxLeverage = tbMaxLeverage.Text.ToFloatUniform(); bool loginIsBusy; var resp = MainForm.serverProxyTrade.proxy.ModifyUserAndAccount(login, oldPassword, user, editedAccount.ID, maxLeverage, out loginIsBusy); if (loginIsBusy) { MessageBox.Show(string.Format(Localizer.GetString("MessageLoginInUse"), user.Login)); return; } if (resp == AuthenticationResponse.AccountInactive || resp == AuthenticationResponse.InvalidAccount || resp == AuthenticationResponse.WrongPassword || resp == AuthenticationResponse.ServerError) { var msg = Localizer.GetString("MessageUnableToUpdate") + " - " + EnumFriendlyName <AuthenticationResponse> .GetString(resp); MessageBox.Show(msg, Localizer.GetString("TitleError")); } // обновить дополнительные данные о пользователе try { var userInfoExSource = new UserInfoExCache(TradeSharpAccountStatistics.Instance.proxy, TerminalEnvironment.FileCacheFolder); var info = new UserInfoEx { Id = editedUser.ID, AvatarBig = bigAvatarPanel.BackgroundImage as Bitmap, AvatarSmall = smallAvatarPanel.BackgroundImage as Bitmap, About = aboutRichTextBox.Text, Contacts = ContactListUtils.PackContacts(contactsListView) }; userInfoExSource.SetUserInfo(info); } catch (Exception ex) { MessageBox.Show(Localizer.GetString("TitleServerError"), Localizer.GetString("TitleError")); Logger.Info("Ошбика при записи дополнительной информации о пользователе", ex); return; } MessageBox.Show(Localizer.GetString("MessageDataSuccessfulyUpdated"), Localizer.GetString("TitleConfirmation"), MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
public static void TssSdkSetUserInfoEx(EENTRYID entryId, string uin, string appId, uint worldId, string roleId) { UserInfoEx ex; ex = new UserInfoEx { size = Marshal.SizeOf(ex), entrance_id = (uint)entryId, uin_type = 2 }; byte[] buffer = new byte[0x40]; byte[] buffer2 = String2Bytes(uin); int index = 0; while ((index < buffer2.Length) && (index < 0x40)) { buffer[index] = buffer2[index]; index++; } while (index < 0x40) { buffer[index] = 0; index++; } ex.uin_00 = buffer[0]; ex.uin_01 = buffer[1]; ex.uin_02 = buffer[2]; ex.uin_03 = buffer[3]; ex.uin_04 = buffer[4]; ex.uin_05 = buffer[5]; ex.uin_06 = buffer[6]; ex.uin_07 = buffer[7]; ex.uin_08 = buffer[8]; ex.uin_09 = buffer[9]; ex.uin_10 = buffer[10]; ex.uin_11 = buffer[11]; ex.uin_12 = buffer[12]; ex.uin_13 = buffer[13]; ex.uin_14 = buffer[14]; ex.uin_15 = buffer[15]; ex.uin_16 = buffer[0x10]; ex.uin_17 = buffer[0x11]; ex.uin_18 = buffer[0x12]; ex.uin_19 = buffer[0x13]; ex.uin_20 = buffer[20]; ex.uin_21 = buffer[0x15]; ex.uin_22 = buffer[0x16]; ex.uin_23 = buffer[0x17]; ex.uin_24 = buffer[0x18]; ex.uin_25 = buffer[0x19]; ex.uin_26 = buffer[0x1a]; ex.uin_27 = buffer[0x1b]; ex.uin_28 = buffer[0x1c]; ex.uin_29 = buffer[0x1d]; ex.uin_30 = buffer[30]; ex.uin_31 = buffer[0x1f]; ex.uin_32 = buffer[0x20]; ex.uin_33 = buffer[0x21]; ex.uin_34 = buffer[0x22]; ex.uin_35 = buffer[0x23]; ex.uin_36 = buffer[0x24]; ex.uin_37 = buffer[0x25]; ex.uin_38 = buffer[0x26]; ex.uin_39 = buffer[0x27]; ex.uin_40 = buffer[40]; ex.uin_41 = buffer[0x29]; ex.uin_42 = buffer[0x2a]; ex.uin_43 = buffer[0x2b]; ex.uin_44 = buffer[0x2c]; ex.uin_45 = buffer[0x2d]; ex.uin_46 = buffer[0x2e]; ex.uin_47 = buffer[0x2f]; ex.uin_48 = buffer[0x30]; ex.uin_49 = buffer[0x31]; ex.uin_50 = buffer[50]; ex.uin_51 = buffer[0x33]; ex.uin_52 = buffer[0x34]; ex.uin_53 = buffer[0x35]; ex.uin_54 = buffer[0x36]; ex.uin_55 = buffer[0x37]; ex.uin_56 = buffer[0x38]; ex.uin_57 = buffer[0x39]; ex.uin_58 = buffer[0x3a]; ex.uin_59 = buffer[0x3b]; ex.uin_60 = buffer[60]; ex.uin_61 = buffer[0x3d]; ex.uin_62 = buffer[0x3e]; ex.uin_63 = buffer[0x3f]; ex.appid_type = 2; byte[] buffer3 = String2Bytes(appId); index = 0; while ((index < buffer3.Length) && (index < 0x40)) { buffer[index] = buffer3[index]; index++; } while (index < 0x40) { buffer[index] = 0; index++; } ex.appid_00 = buffer[0]; ex.appid_01 = buffer[1]; ex.appid_02 = buffer[2]; ex.appid_03 = buffer[3]; ex.appid_04 = buffer[4]; ex.appid_05 = buffer[5]; ex.appid_06 = buffer[6]; ex.appid_07 = buffer[7]; ex.appid_08 = buffer[8]; ex.appid_09 = buffer[9]; ex.appid_10 = buffer[10]; ex.appid_11 = buffer[11]; ex.appid_12 = buffer[12]; ex.appid_13 = buffer[13]; ex.appid_14 = buffer[14]; ex.appid_15 = buffer[15]; ex.appid_16 = buffer[0x10]; ex.appid_17 = buffer[0x11]; ex.appid_18 = buffer[0x12]; ex.appid_19 = buffer[0x13]; ex.appid_20 = buffer[20]; ex.appid_21 = buffer[0x15]; ex.appid_22 = buffer[0x16]; ex.appid_23 = buffer[0x17]; ex.appid_24 = buffer[0x18]; ex.appid_25 = buffer[0x19]; ex.appid_26 = buffer[0x1a]; ex.appid_27 = buffer[0x1b]; ex.appid_28 = buffer[0x1c]; ex.appid_29 = buffer[0x1d]; ex.appid_30 = buffer[30]; ex.appid_31 = buffer[0x1f]; ex.appid_32 = buffer[0x20]; ex.appid_33 = buffer[0x21]; ex.appid_34 = buffer[0x22]; ex.appid_35 = buffer[0x23]; ex.appid_36 = buffer[0x24]; ex.appid_37 = buffer[0x25]; ex.appid_38 = buffer[0x26]; ex.appid_39 = buffer[0x27]; ex.appid_40 = buffer[40]; ex.appid_41 = buffer[0x29]; ex.appid_42 = buffer[0x2a]; ex.appid_43 = buffer[0x2b]; ex.appid_44 = buffer[0x2c]; ex.appid_45 = buffer[0x2d]; ex.appid_46 = buffer[0x2e]; ex.appid_47 = buffer[0x2f]; ex.appid_48 = buffer[0x30]; ex.appid_49 = buffer[0x31]; ex.appid_50 = buffer[50]; ex.appid_51 = buffer[0x33]; ex.appid_52 = buffer[0x34]; ex.appid_53 = buffer[0x35]; ex.appid_54 = buffer[0x36]; ex.appid_55 = buffer[0x37]; ex.appid_56 = buffer[0x38]; ex.appid_57 = buffer[0x39]; ex.appid_58 = buffer[0x3a]; ex.appid_59 = buffer[0x3b]; ex.appid_60 = buffer[60]; ex.appid_61 = buffer[0x3d]; ex.appid_62 = buffer[0x3e]; ex.appid_63 = buffer[0x3f]; ex.world_id = worldId; byte[] buffer4 = String2Bytes(roleId); index = 0; while (index < buffer4.Length) { buffer[index] = buffer4[index]; index++; } while (index < 0x40) { buffer[index] = 0; index++; } ex.role_id_00 = buffer[0]; ex.role_id_01 = buffer[1]; ex.role_id_02 = buffer[2]; ex.role_id_03 = buffer[3]; ex.role_id_04 = buffer[4]; ex.role_id_05 = buffer[5]; ex.role_id_06 = buffer[6]; ex.role_id_07 = buffer[7]; ex.role_id_08 = buffer[8]; ex.role_id_09 = buffer[9]; ex.role_id_10 = buffer[10]; ex.role_id_11 = buffer[11]; ex.role_id_12 = buffer[12]; ex.role_id_13 = buffer[13]; ex.role_id_14 = buffer[14]; ex.role_id_15 = buffer[15]; ex.role_id_16 = buffer[0x10]; ex.role_id_17 = buffer[0x11]; ex.role_id_18 = buffer[0x12]; ex.role_id_19 = buffer[0x13]; ex.role_id_20 = buffer[20]; ex.role_id_21 = buffer[0x15]; ex.role_id_22 = buffer[0x16]; ex.role_id_23 = buffer[0x17]; ex.role_id_24 = buffer[0x18]; ex.role_id_25 = buffer[0x19]; ex.role_id_26 = buffer[0x1a]; ex.role_id_27 = buffer[0x1b]; ex.role_id_28 = buffer[0x1c]; ex.role_id_29 = buffer[0x1d]; ex.role_id_30 = buffer[30]; ex.role_id_31 = buffer[0x1f]; ex.role_id_32 = buffer[0x20]; ex.role_id_33 = buffer[0x21]; ex.role_id_34 = buffer[0x22]; ex.role_id_35 = buffer[0x23]; ex.role_id_36 = buffer[0x24]; ex.role_id_37 = buffer[0x25]; ex.role_id_38 = buffer[0x26]; ex.role_id_39 = buffer[0x27]; ex.role_id_40 = buffer[40]; ex.role_id_41 = buffer[0x29]; ex.role_id_42 = buffer[0x2a]; ex.role_id_43 = buffer[0x2b]; ex.role_id_44 = buffer[0x2c]; ex.role_id_45 = buffer[0x2d]; ex.role_id_46 = buffer[0x2e]; ex.role_id_47 = buffer[0x2f]; ex.role_id_48 = buffer[0x30]; ex.role_id_49 = buffer[0x31]; ex.role_id_50 = buffer[50]; ex.role_id_51 = buffer[0x33]; ex.role_id_52 = buffer[0x34]; ex.role_id_53 = buffer[0x35]; ex.role_id_54 = buffer[0x36]; ex.role_id_55 = buffer[0x37]; ex.role_id_56 = buffer[0x38]; ex.role_id_57 = buffer[0x39]; ex.role_id_58 = buffer[0x3a]; ex.role_id_59 = buffer[0x3b]; ex.role_id_60 = buffer[60]; ex.role_id_61 = buffer[0x3d]; ex.role_id_62 = buffer[0x3e]; ex.role_id_63 = buffer[0x3f]; tss_sdk_setuserinfo_ex(ex); }
private static extern void tss_sdk_setuserinfo_ex(UserInfoEx info);
public ApiMessage <string> Registered(UserInfoEx user) { var api = _bll.Registered(user); return(api); }
private UserInfoEx SetUserInfo(UserInfoEx info) { calls.Add(string.Format("SetUserInfo {0}", info.Id)); if (info.Id != dbInfo.Id) { return(null); } if (info.AvatarBigHashCode != dbInfo.AvatarBigHashCode) { dbInfo.AvatarBig = info.AvatarBig; } if (info.AvatarSmallHashCode != dbInfo.AvatarSmallHashCode) { dbInfo.AvatarSmall = info.AvatarSmall; } if (info.AboutHashCode != dbInfo.AboutHashCode) { dbInfo.About = info.About; } dbInfo.Contacts = info.Contacts; if (dbInfo.AvatarBig != null) { if (string.IsNullOrEmpty(dbInfo.AvatarBigFileName)) { dbInfo.AvatarBigFileName = "AvatarBig.png"; } } else { dbInfo.AvatarBigFileName = null; } if (dbInfo.AvatarSmall != null) { if (string.IsNullOrEmpty(dbInfo.AvatarSmallFileName)) { dbInfo.AvatarSmallFileName = "AvatarSmall.png"; } } else { dbInfo.AvatarBigFileName = null; } if (dbInfo.About != null) { if (string.IsNullOrEmpty(dbInfo.AboutFileName)) { dbInfo.AboutFileName = "About.png"; } } else { dbInfo.AboutFileName = null; } var result = new UserInfoEx { Id = dbInfo.Id, AvatarBigFileName = dbInfo.AvatarBigFileName, AvatarSmallFileName = dbInfo.AvatarSmallFileName, AboutFileName = dbInfo.AboutFileName, Contacts = dbInfo.Contacts, AvatarBigHashCode = dbInfo.AvatarBigHashCode, AvatarSmallHashCode = dbInfo.AvatarSmallHashCode, AboutHashCode = dbInfo.AboutHashCode }; return(result); }
public ApiMessage <string> EditPassWord(UserInfoEx user) { var api = _bll.EditPassWord(user); return(api); }
public static void TssSdkSetUserInfoEx(EENTRYID entryId, string uin, string appId, uint worldId, string roleId ) { UserInfoEx info = new UserInfoEx (); info.size = Marshal.SizeOf (info); info.entrance_id = (uint)entryId; info.uin_type = (uint)EUINTYPE.UIN_TYPE_STR; byte[] chars = new byte[64]; byte[] uinArray = String2Bytes (uin); int i; for (i = 0; i < uinArray.Length && i < 64; i++) { chars[i] = uinArray[i]; } for (; i < 64; i++) { chars[i] = 0; } info.uin_00 = chars [0]; info.uin_01 = chars [1]; info.uin_02 = chars [2]; info.uin_03 = chars [3]; info.uin_04 = chars [4]; info.uin_05 = chars [5]; info.uin_06 = chars [6]; info.uin_07 = chars [7]; info.uin_08 = chars [8]; info.uin_09 = chars [9]; info.uin_10 = chars [10]; info.uin_11 = chars [11]; info.uin_12 = chars [12]; info.uin_13 = chars [13]; info.uin_14 = chars [14]; info.uin_15 = chars [15]; info.uin_16 = chars [16]; info.uin_17 = chars [17]; info.uin_18 = chars [18]; info.uin_19 = chars [19]; info.uin_20 = chars [20]; info.uin_21 = chars [21]; info.uin_22 = chars [22]; info.uin_23 = chars [23]; info.uin_24 = chars [24]; info.uin_25 = chars [25]; info.uin_26 = chars [26]; info.uin_27 = chars [27]; info.uin_28 = chars [28]; info.uin_29 = chars [29]; info.uin_30 = chars [30]; info.uin_31 = chars [31]; info.uin_32 = chars [32]; info.uin_33 = chars [33]; info.uin_34 = chars [34]; info.uin_35 = chars [35]; info.uin_36 = chars [36]; info.uin_37 = chars [37]; info.uin_38 = chars [38]; info.uin_39 = chars [39]; info.uin_40 = chars [40]; info.uin_41 = chars [41]; info.uin_42 = chars [42]; info.uin_43 = chars [43]; info.uin_44 = chars [44]; info.uin_45 = chars [45]; info.uin_46 = chars [46]; info.uin_47 = chars [47]; info.uin_48 = chars [48]; info.uin_49 = chars [49]; info.uin_50 = chars [50]; info.uin_51 = chars [51]; info.uin_52 = chars [52]; info.uin_53 = chars [53]; info.uin_54 = chars [54]; info.uin_55 = chars [55]; info.uin_56 = chars [56]; info.uin_57 = chars [57]; info.uin_58 = chars [58]; info.uin_59 = chars [59]; info.uin_60 = chars [60]; info.uin_61 = chars [61]; info.uin_62 = chars [62]; info.uin_63 = chars [63]; //info.uin = uin; info.appid_type = (uint)EAPPIDTYPE.APP_ID_TYPE_STR; //info.appid = appId; byte[] appIdArray = String2Bytes (appId); for (i = 0; i < appIdArray.Length && i < 64; i++) { chars[i] = appIdArray[i]; } for (; i < 64; i++) { chars[i] = 0; } //byte[] uinArray = Encoding.ASCII.GetBytes (uin); info.appid_00 = chars [0]; info.appid_01 = chars [1]; info.appid_02 = chars [2]; info.appid_03 = chars [3]; info.appid_04 = chars [4]; info.appid_05 = chars [5]; info.appid_06 = chars [6]; info.appid_07 = chars [7]; info.appid_08 = chars [8]; info.appid_09 = chars [9]; info.appid_10 = chars [10]; info.appid_11 = chars [11]; info.appid_12 = chars [12]; info.appid_13 = chars [13]; info.appid_14 = chars [14]; info.appid_15 = chars [15]; info.appid_16 = chars [16]; info.appid_17 = chars [17]; info.appid_18 = chars [18]; info.appid_19 = chars [19]; info.appid_20 = chars [20]; info.appid_21 = chars [21]; info.appid_22 = chars [22]; info.appid_23 = chars [23]; info.appid_24 = chars [24]; info.appid_25 = chars [25]; info.appid_26 = chars [26]; info.appid_27 = chars [27]; info.appid_28 = chars [28]; info.appid_29 = chars [29]; info.appid_30 = chars [30]; info.appid_31 = chars [31]; info.appid_32 = chars [32]; info.appid_33 = chars [33]; info.appid_34 = chars [34]; info.appid_35 = chars [35]; info.appid_36 = chars [36]; info.appid_37 = chars [37]; info.appid_38 = chars [38]; info.appid_39 = chars [39]; info.appid_40 = chars [40]; info.appid_41 = chars [41]; info.appid_42 = chars [42]; info.appid_43 = chars [43]; info.appid_44 = chars [44]; info.appid_45 = chars [45]; info.appid_46 = chars [46]; info.appid_47 = chars [47]; info.appid_48 = chars [48]; info.appid_49 = chars [49]; info.appid_50 = chars [50]; info.appid_51 = chars [51]; info.appid_52 = chars [52]; info.appid_53 = chars [53]; info.appid_54 = chars [54]; info.appid_55 = chars [55]; info.appid_56 = chars [56]; info.appid_57 = chars [57]; info.appid_58 = chars [58]; info.appid_59 = chars [59]; info.appid_60 = chars [60]; info.appid_61 = chars [61]; info.appid_62 = chars [62]; info.appid_63 = chars [63]; info.world_id = worldId; //info.role_id = roleId; byte[] roleIdArray = String2Bytes(roleId); for (i = 0; i < roleIdArray.Length; i++) { chars[i] = roleIdArray[i]; } for (; i < 64; i++) { chars[i] = 0; } //byte[] uinArray = Encoding.ASCII.GetBytes (uin); info.role_id_00 = chars [0]; info.role_id_01 = chars [1]; info.role_id_02 = chars [2]; info.role_id_03 = chars [3]; info.role_id_04 = chars [4]; info.role_id_05 = chars [5]; info.role_id_06 = chars [6]; info.role_id_07 = chars [7]; info.role_id_08 = chars [8]; info.role_id_09 = chars [9]; info.role_id_10 = chars [10]; info.role_id_11 = chars [11]; info.role_id_12 = chars [12]; info.role_id_13 = chars [13]; info.role_id_14 = chars [14]; info.role_id_15 = chars [15]; info.role_id_16 = chars [16]; info.role_id_17 = chars [17]; info.role_id_18 = chars [18]; info.role_id_19 = chars [19]; info.role_id_20 = chars [20]; info.role_id_21 = chars [21]; info.role_id_22 = chars [22]; info.role_id_23 = chars [23]; info.role_id_24 = chars [24]; info.role_id_25 = chars [25]; info.role_id_26 = chars [26]; info.role_id_27 = chars [27]; info.role_id_28 = chars [28]; info.role_id_29 = chars [29]; info.role_id_30 = chars [30]; info.role_id_31 = chars [31]; info.role_id_32 = chars [32]; info.role_id_33 = chars [33]; info.role_id_34 = chars [34]; info.role_id_35 = chars [35]; info.role_id_36 = chars [36]; info.role_id_37 = chars [37]; info.role_id_38 = chars [38]; info.role_id_39 = chars [39]; info.role_id_40 = chars [40]; info.role_id_41 = chars [41]; info.role_id_42 = chars [42]; info.role_id_43 = chars [43]; info.role_id_44 = chars [44]; info.role_id_45 = chars [45]; info.role_id_46 = chars [46]; info.role_id_47 = chars [47]; info.role_id_48 = chars [48]; info.role_id_49 = chars [49]; info.role_id_50 = chars [50]; info.role_id_51 = chars [51]; info.role_id_52 = chars [52]; info.role_id_53 = chars [53]; info.role_id_54 = chars [54]; info.role_id_55 = chars [55]; info.role_id_56 = chars [56]; info.role_id_57 = chars [57]; info.role_id_58 = chars [58]; info.role_id_59 = chars [59]; info.role_id_60 = chars [60]; info.role_id_61 = chars [61]; info.role_id_62 = chars [62]; info.role_id_63 = chars [63]; //UnityEngine.Debug.Log (string.Format("UserInfoEx size:{0}", Marshal.SizeOf(info)), null); tss_sdk_setuserinfo_ex (info); }
protected UserInfoEx LoadUserInfoEx(Guid userID) { var dep = GetDepartmentForUser(userID); var ui = new UserInfoEx { Info = CoreContext.UserManager.GetUsers(userID), PhotoPath = UserPhotoManager.GetPhotoAbsoluteWebPath(userID), DepartmentID = (dep != null) ? dep.ID : Guid.Empty, Department = (dep != null) ? dep.Name.HtmlEncode() : "", }; var nodes = SocialContactsManager.xmlSocialContacts.GetElementsByTagName("contact"); if (nodes == null) return ui; for (Int32 i = 0, n = nodes.Count; i < n; i++) { ui.Contacts.Add(GetSocialContact((XmlElement)nodes[i])); } return ui; }
public AjaxResponse SaveUser(UserInfoEx userInfoEx, string photoPath) { var resp = new AjaxResponse(); if (!SecurityContext.IsAuthenticated) { resp.rs1 = "0"; return resp; } var isNew = userInfoEx.Info.ID.Equals(Guid.Empty); userInfoEx.Info.Email = (userInfoEx.Info.Email ?? "").Trim(); if (String.IsNullOrEmpty(userInfoEx.Info.FirstName.Trim())) { resp.rs1 = "0"; resp.rs2 = "<div>" + Resources.Resource.ErrorEmptyUserFirstName + "</div>"; return resp; } else if (String.IsNullOrEmpty(userInfoEx.Info.LastName.Trim())) { resp.rs1 = "0"; resp.rs2 = "<div>" + Resources.Resource.ErrorEmptyUserLastName + "</div>"; return resp; } else if (String.IsNullOrEmpty(userInfoEx.Info.Email.Trim()) || !userInfoEx.Info.Email.TestEmailRegex()) { resp.rs1 = "0"; resp.rs2 = "<div>" + Resources.Resource.ErrorNotCorrectEmail + "</div>"; return resp; } if (isNew) userInfoEx.Pwd = UserManagerWrapper.GeneratePassword(); try { var self = SecurityContext.CurrentAccount.ID.Equals(userInfoEx.Info.ID); var newDepartment = CoreContext.GroupManager.GetGroupInfo(userInfoEx.DepartmentID); if (newDepartment != ASC.Core.Users.Constants.LostGroupInfo) userInfoEx.Info.Department = newDepartment.Name; UserInfo newUserInfo = null; if (isNew && SecurityContext.IsAuthenticated && SecurityContext.CheckPermissions(ASC.Core.Users.Constants.Action_AddRemoveUser)) { var disableEditGroups = false; if (!SecurityContext.CheckPermissions(ASC.Core.Users.Constants.Action_EditGroups)) { userInfoEx.Info.Title = ""; disableEditGroups = true; } newUserInfo = UserManagerWrapper.AddUser(userInfoEx.Info, userInfoEx.Pwd); if (disableEditGroups == false && userInfoEx.DepartmentID != Guid.Empty) CoreContext.UserManager.AddUserIntoGroup(newUserInfo.ID, userInfoEx.DepartmentID); resp.rs3 = "add_user"; resp.rs10 = CustomNamingPeople.Substitute<Resources.Resource>("UserMakerAddUser").HtmlEncode(); } else if (SecurityContext.CheckPermissions(ASC.Core.Users.Constants.Action_EditUser) || (self && SecurityContext.CheckPermissions(new UserSecurityProvider(SecurityContext.CurrentAccount.ID), ASC.Core.Users.Constants.Action_EditUser))) { newUserInfo = (UserInfo)CoreContext.UserManager.GetUsers(userInfoEx.Info.ID).Clone(); newUserInfo.FirstName = userInfoEx.Info.FirstName.Trim(); newUserInfo.LastName = userInfoEx.Info.LastName.Trim(); newUserInfo.Sex = userInfoEx.Info.Sex; newUserInfo.Title = userInfoEx.Info.Title.Trim(); newUserInfo.BirthDate = userInfoEx.Info.BirthDate; newUserInfo.WorkFromDate = userInfoEx.Info.WorkFromDate; newUserInfo.Notes = userInfoEx.Info.Notes.Trim(); newUserInfo.Department = userInfoEx.Info.Department; newUserInfo.Location = userInfoEx.Info.Location.Trim(); newUserInfo.Contacts.Clear(); userInfoEx.Info.Contacts.ForEach(c => newUserInfo.Contacts.Add(c)); if (SecurityContext.CheckPermissions(ASC.Core.Users.Constants.Action_EditGroups)) { var oldDep = GetDepartmentForUser(userInfoEx.Info.ID); if (oldDep != null && !oldDep.ID.Equals(userInfoEx.DepartmentID)) { CoreContext.UserManager.RemoveUserFromGroup(newUserInfo.ID, oldDep.ID); newUserInfo.Department = ""; } if (((oldDep != null && !oldDep.ID.Equals(userInfoEx.DepartmentID)) || oldDep == null) && userInfoEx.DepartmentID != Guid.Empty) { CoreContext.UserManager.AddUserIntoGroup(newUserInfo.ID, userInfoEx.DepartmentID); var dep = CoreContext.GroupManager.GetGroupInfo(userInfoEx.DepartmentID); newUserInfo.Department = dep.Name; } } UserManagerWrapper.SaveUserInfo(newUserInfo); resp.rs3 = "edit_user"; resp.rs10 = Resources.Resource.UserMakerEditUser; resp.rs5 = SecurityContext.CurrentAccount.ID.Equals(newUserInfo.ID) ? "1" : ""; if (self && !CoreContext.UserManager.IsUserInGroup(SecurityContext.CurrentAccount.ID, ASC.Core.Users.Constants.GroupAdmin.ID)) StudioNotifyService.Instance.SendMsgToAdminAboutProfileUpdated(); } else { resp.rs1 = "0"; return resp; } if (!String.IsNullOrEmpty(photoPath)) { var fileName = Path.GetFileName(photoPath); var data = UserPhotoManager.GetTempPhotoData(fileName); UserPhotoManager.SaveOrUpdatePhoto(newUserInfo.ID, data); try { UserPhotoManager.RemoveTempPhoto(fileName); } catch { } ; } resp.rs1 = "1"; } catch (Exception e) { resp.rs1 = "0"; resp.rs2 = "<div>" + e.Message.HtmlEncode() + "</div>"; } return resp; }