//请求登陆 public void SendLogin(TempLogRegDataVO data) { //不论成功失败都会添加用户Id数据 UserInfoProxy userInfoProxy = AppFacade.getInstance.RetrieveProxy(UserInfoProxy.NAME) as UserInfoProxy; DbAccess dbAccess = new DbAccess(); string userName = data.UserName; string password = data.Password; string query = string.Format("SELECT id FROM info_users WHERE playername='{0}' AND passwd='{1}'", userName, password); SqliteDataReader reader = dbAccess.ExecuteQuery(query); if (reader.Read()) { int id = Utils.GetInt(reader["id"]); userInfoProxy.UsertData.Id = id; tempData = new TempLogRegDataVO(); tempData.status = ErrorCode.SUCCESS; LocalSaveData.LoginUserName = userName; LocalSaveData.LoginPassword = password; } else { tempData = new TempLogRegDataVO(); userInfoProxy.UsertData.Id = -1; tempData.status = ErrorCode.INVALID_LOGIN_INFO; } dbAccess.CloseSqlConnection(); SendNotification(LoginViewMediator.LOGIN_RESPONSE, tempData); }
public ChosenUserData(UserInfoProxy i_user, string i_aboutMe, string i_prevJobs, string i_education, string i_languages) { User = i_user; AboutMe = i_aboutMe; PrevJobs = i_prevJobs; Education = i_education; Languages = i_languages; }
public override void OnRemove() { //移除的时候,把本身的变量也移除掉 userInfoProxy = null; // dbAcces = null; mBuildBlueprintDict = null; mBuildDict = null; }
public override void Execute(INotification notification) { UserInfoProxy user = AppFacade.GetInstance().RetrieveProxy(UserInfoProxy.NAME) as UserInfoProxy; BuildModelVo vo = notification.Body as BuildModelVo; user.setfacility(vo); //设置模型与位置信息; }
public override void OnRegister() { userInfoProxy = AppFacade.getInstance.RetrieveProxy(UserInfoProxy.NAME) as UserInfoProxy; foreach (stat_blueprintRow blueprint in stat_blueprint.GetInstance().rowList) { mBuildBlueprintDict[blueprint.id] = blueprint; } foreach (stat_buildingRow build in stat_building.GetInstance().rowList) { mBuildDict[build.id] = build; } }
public static string[] GetChatHtml(UserInfoProxy userInfo, int chatID, int lastMessageID) { LoginUser loginUser = new LoginUser(userInfo.UserID, userInfo.OrganizationID, null); ChatUserSetting setting = ChatUserSettings.GetSetting(loginUser, loginUser.UserID); setting.CurrentChatID = chatID; setting.Collection.Save(); Chat chat = Chats.GetChat(loginUser, chatID); if (chat == null || chat.OrganizationID != loginUser.OrganizationID) { return(null); } ChatMessages messages = new ChatMessages(loginUser); int i = messages.GetLastMessageID(chatID); string chatHtml = ""; if (i > -1 && i != lastMessageID) { ChatParticipants.UpdateLastMessageID(loginUser, loginUser.UserID, ChatParticipantType.User, chatID, i); chatHtml = chat.GetHtml(true, loginUser.CultureInfo); } // load typers ChatParticipants participants = new ChatParticipants(loginUser); participants.LoadTypers(loginUser.UserID, ChatParticipantType.User, chatID, 2); StringBuilder typers = new StringBuilder(); foreach (ChatParticipant item in participants) { if (typers.Length > 0) { typers.Append(", "); } typers.Append(item.FirstName); } if (typers.Length > 0) { typers.Append(" is typing a message."); } return(new string[] { chatID.ToString(), i.ToString(), chatHtml, typers.ToString() }); }
public static string GetChatRequestHtml(UserInfoProxy userInfo, bool forceUpdate) { LoginUser loginUser = new LoginUser(userInfo.UserID, userInfo.OrganizationID, null); StringBuilder builder = new StringBuilder(); ChatRequests requests = new ChatRequests(loginUser); requests.LoadWaitingRequests(loginUser.UserID, loginUser.OrganizationID); foreach (ChatRequest request in requests) { ParticipantInfo participant = ChatParticipant.GetParticipantInfo(loginUser, request.RequestorID, request.RequestorType); string row = "<tr><td class=\"col1\">{0}</td><td class=\"col2\">{1}</td></tr>"; string stateClass = request.RequestType != ChatRequestType.External ? "ui-state-highlight" : "ui-state-default"; builder.Append(string.Format("<div class=\"ts-panellist-header ui-helper-reset {0} ui-corner-all\" role=\"tab\" aria-expanded=\"false\" tabindex=\"-1\">", stateClass)); builder.Append("<span class=\"ui-icon ui-icon-triangle-1-e \" />"); builder.Append("<a href=\"#\">" + participant.FirstName + " " + participant.LastName + " - " + request.DateCreated.ToString("t", loginUser.CultureInfo) + "</a>"); builder.Append("</div>"); builder.Append("<div class=\"content\">"); builder.Append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"5\">"); builder.Append(string.Format(row, "Email:", participant.Email)); if (participant.CompanyName != "") { builder.Append(string.Format(row, "Company:", participant.CompanyName)); } builder.Append(string.Format(row, "Time:", request.DateCreated.ToString("t", loginUser.CultureInfo))); builder.Append(string.Format(row, "Message:", request.Message)); builder.Append("</table>"); builder.Append(string.Format("<div class=\"accept\"><a class=\"ts-link-button {0} ui-corner-all \" href=\"#\" onclick=\"AcceptRequest({1}); return false;\">Accept</a></div>", stateClass, request.ChatRequestID.ToString())); builder.Append("</div>"); } string html = builder.ToString().Trim(); if (html == "") { html = "<div class=\"content\">There are no chat requests.</div>"; } if (!forceUpdate && HttpContext.Current.Session["LastRequestHtml"] != null && (string)HttpContext.Current.Session["LastRequestHtml"] == html) { return(""); } HttpContext.Current.Session["LastRequestHtml"] = html; return(html); }
//Test public void Init() { userInfoProxy = Facade.RetrieveProxy(UserInfoProxy.NAME) as UserInfoProxy; DbAccess dbAccess = new DbAccess(); SqliteDataReader reader = dbAccess.SelectWhere("info_spheres", new string[] { "customer_current" }, new string[] { "userid" }, new string[] { " = " }, new string[] { userInfoProxy.UsertData.Id.ToString() }); if (reader.Read()) { SpawnData.CurrentCustomer = Utils.GetInt(reader["customer_current"]); } dbAccess.CloseSqlConnection(); SpawnData.RefreshTime = AppConst.CUSTOM_REFRESH_TIME; SpawnData.DefaultSpawnNum = AppConst.DEFALUT_SPAWN_NUM; SpawnData.VisibleCustomer = AppConst.VISIBLE_CUSTOMER; SpawnData.MaxCustomer = AppConst.DEFAULT_MAX_CUSTOMER; }
public override void Execute(INotification notification) { UserInfoProxy userInfoProxy = (UserInfoProxy)Facade.RetrieveProxy(UserInfoProxy.NAME); switch (notification.Name) { case NotiConst.GET_USER_INFO_VALUE: userInfoProxy.RefreshUserInfoValue(); break; case NotiConst.SET_GOLD: userInfoProxy.SetGold((int)notification.Body); break; case NotiConst.SET_EXP: userInfoProxy.setEXP((int)notification.Body); break; default: break; } }
public static string[] GetActiveChatsHtml(UserInfoProxy userInfo, bool forceUpdate, int activeChatID) { LoginUser loginUser = new LoginUser(userInfo.UserID, userInfo.OrganizationID, null); Chats.KickOutDisconnectedClients(loginUser, loginUser.OrganizationID); StringBuilder builder = new StringBuilder(); ChatParticipants participants = new ChatParticipants(loginUser); participants.LoadByUserID(loginUser.UserID, loginUser.OrganizationID); if (!participants.IsEmpty) { int chatID = -1; StringBuilder names = new StringBuilder(); foreach (ChatParticipant item in participants) { if (item.ParticipantType != ChatParticipantType.External) { continue; } bool isNew = (int)item.Row["LastPostedMessageID"] != (int)item.Row["MyLastMessageID"]; string state = isNew ? "ui-state-highlight" : "chat-state-normal"; state = activeChatID == item.ChatID ? "ui-state-default" : state; if (chatID != item.ChatID) { if (names.Length > 0) { names.Append("</div>"); } names.Append(string.Format("<div id=\"divChat{0}\" class=\"chat ui-corner-all ts-icon-container ui-widget ui-helper-reset {1} \">", item.ChatID.ToString(), state)); } string name = item.FirstName + " " + item.LastName; if (!string.IsNullOrEmpty(item.CompanyName)) { name = name + " - " + item.CompanyName; } names.Append(string.Format("<span class=\"ts-icon {1}\"/><span class=\"ts-icon-text\">{0}</span>", name, item.IsOnline ? "ts-icon-online" : "ts-icon-offline")); chatID = item.ChatID; } names.Append("</div>"); builder.Append(names.ToString()); } string html = builder.ToString().Trim(); if (html == "") { html = "<div class=\"chat\">There are no active chats.</div>"; } if (!forceUpdate && HttpContext.Current.Session["LastChatHtml"] != null && (string)HttpContext.Current.Session["LastChatHtml"] == html) { return(null); } HttpContext.Current.Session["LastChatHtml"] = html; return(new string[] { html, activeChatID.ToString() }); }
public override void OnRegister() { userInfoProxy = Facade.RetrieveProxy(UserInfoProxy.NAME) as UserInfoProxy; manorInfoProxy = Facade.RetrieveProxy(ManorInfoProxy.NAME) as ManorInfoProxy; catgroupproxy = Facade.RetrieveProxy(CatGroupProxy.NAME) as CatGroupProxy; }
public AboutMeCreator1(UserInfoProxy i_UserInfoProxy) { m_UserInfoProxy = i_UserInfoProxy; }