public async void GetUserDataHandler_RequestingUserData_ReturnsCorrectUser() { // Arrange IGetManageUserDataAccess dataAccess = CreateFakeDataAccess(); IWeeeAuthorization authorization = AuthorizationBuilder.CreateUserWithAllRights(); GetUserDataHandler handler = new GetUserDataHandler(userContext, authorization, dataAccess); GetUserData request = new GetUserData(orgUserId); // Act var response = await handler.HandleAsync(request); // Assert Assert.NotNull(response); Assert.Equal(response.Email, "*****@*****.**"); Assert.Equal(response.OrganisationName, "Test ltd."); }
public async void GetUserDataHandler_WithNonInternalUser_ThrowSecurityException(AuthorizationBuilder.UserType userType) { // Arrange IGetManageUserDataAccess dataAccess = A.Fake<IGetManageUserDataAccess>(); A.CallTo(() => dataAccess.GetCompetentAuthorityUser(Guid.NewGuid())).Returns(new ManageUserData()); A.CallTo(() => dataAccess.GetOrganisationUser(Guid.NewGuid())).Returns(new ManageUserData()); IWeeeAuthorization authorization = AuthorizationBuilder.CreateFromUserType(userType); GetUserDataHandler handler = new GetUserDataHandler(userContext, authorization, dataAccess); GetUserData request = new GetUserData(Guid.NewGuid()); // Act Func<Task<ManageUserData>> action = () => handler.HandleAsync(request); // Assert await Assert.ThrowsAsync<SecurityException>(action); }
IEnumerator GetFriendListFromCloud_Corutine() { BaseCloudAction action = new GetUserData(CloudUser.instance.authenticatedUserID, CloudServices.PROP_ID_FRIENDS); GameCloudManager.AddAction(action); m_GetFriendListAction = action; // wait for authentication... while (action.isDone == false) { yield return(new WaitForSeconds(0.2f)); } if (action.isFailed == true) { Debug.LogError("Can't obtain frinds list " + action.result); } else { //Debug.Log("frinds list is here " + action.result); RegenerateFriendList(action.result); } m_GetFriendListAction = null; }
protected void gvItem_PageIndexChanging(object sender, GridViewPageEventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { if (e.NewPageIndex >= 0) { gvItemTable.PageIndex = e.NewPageIndex; BindGridWithFilter(); AdminBLL ws = new AdminBLL(); GetUserData _req = new GetUserData(); GetUserDataResponse _resp = ws.GetUserInfoData(_req); int pageSize = ContextKeys.GRID_PAGE_SIZE; gvItemTable.PageSize = pageSize; gvItemTable.DataSource = _resp.UserID; gvItemTable.DataBind(); } } catch (Exception ex) { logger.Info(ex.Message); } }
private bool VerifyUserTeam() { bool isValid = true; if (config.UserTeam != "" && config.UserTeam != null) { GetUserData getUser = new GetUserData(sessionContext); string[] mdataGetUserDataValues = getUser.mdataGetUserData(this.txtUserName.Text.Trim(), this.txtPassword.Text.Trim(), config.StationNumber); if (mdataGetUserDataValues != null && mdataGetUserDataValues.Length > 0) { string teamnumber = mdataGetUserDataValues[2]; if (!config.UserTeam.Contains(teamnumber)) { SetStatusLabelText("User Team not authorized", 1); isValid = false; } } else { SetStatusLabelText("User Team not authorized", 1); isValid = false; } } return(isValid); }
private bool VerifyTeamNumber() { bool isValid = false; GetUserData getUser = new GetUserData(sessionContext); string[] mdataGetUserDataValues = getUser.mdataGetUserData(this.txtUserName.Text.Trim(), this.txtPassword.Text.Trim(), config.StationNumber); if (mdataGetUserDataValues != null && mdataGetUserDataValues.Length > 0) { string teamNo = mdataGetUserDataValues[2]; if (string.IsNullOrEmpty(config.UserTeam)) { isValid = true; } else if (string.IsNullOrEmpty(teamNo)) { isValid = false; } else { if (config.UserTeam.Contains(teamNo)) { isValid = true; } } } return(isValid); }
public bool ChangePassword(MainPack pack) { if (GetCodeData.CheckCode(pack)) { return(GetUserData.ChangePassword(pack)); } else { return(false); } }
public MainPack Logon(MainPack pack) { if (GetCodeData.CheckCode(pack)) { return(GetUserData.Logon(pack)); } else { pack.Returncode = ReturnCode.Fail; return(pack); } }
//預載上一個月和下一個月 private void PreLoadLastNextMonth() { //小於0為沒有Cache //等於0為Cache不會過期 //大於0為多少分鐘後清掉Cache if (this.CacheMinuteTTL >= 0) { Task.Factory.StartNew(() => { GetUserData.AsyncPOST(UserID, UserPWD, MeetingListDate.AddMonths(-1) , (userObj1, dateTime1) => { try { PreLoadLastNextMonthDict[dateTime1] = userObj1; GetUserData.AsyncPOST(UserID, UserPWD, MeetingListDate.AddMonths(1) , (userObj2, dateTime2) => { try { PreLoadLastNextMonthDict[dateTime2] = userObj2; } catch (Exception ex) { LogTool.Debug(ex); } }); if (this.CacheMinuteTTL > 0) { if (CacheThread != null) { CacheThread.Abort(); } CacheThread = new Thread(delegate() { Thread.Sleep(this.CacheMinuteTTL * 60 * 1000); PreLoadLastNextMonthDict.Clear(); }); CacheThread.IsBackground = true; CacheThread.Start(); } } catch (Exception ex) { LogTool.Debug(ex); } }); }); } }
public GetUserDataResponse GetUserInfoData(GetUserData objGetUserInfoDataRequest) { try { AdminDAL objAdminDAL = new AdminDAL(); GetUserDataResponse ret = new GetUserDataResponse(); List <User_Info> lst = objAdminDAL.GetUserInfoData(objGetUserInfoDataRequest); ret.UserID = lst; return(ret); } catch (Exception ex) { throw ex; } }
public void setData(GetUserData data) { this.data = data; if (data != null) { if (!string.IsNullOrEmpty(data.portrait)) { DCWebImageMaanager.shard.downloadImageAsync(data.portrait, (image, b) => { if (image != null) { avatarPictureBox.BeginInvoke(() => { avatarPictureBox.Image = image; }); } }); } if (this.IsHandleCreated) { this.BeginInvoke(new EventHandler((s, e) => { nameLabel.Text = data.user_name; nameLabel.Size = TextRenderer.MeasureText(nameLabel.Text, nameLabel.Font); nameLabel.Location = new Point(Width / 2 - nameLabel.Width / 2, 170); nickNameLabel.Text = "畅聊号:" + model.id_Card; nickNameLabel.Size = TextRenderer.MeasureText(nickNameLabel.Text, nickNameLabel.Font); nickNameLabel.Location = new Point((Width - nickNameLabel.Width) / 2, 200); idCardLabel.Visible = false; sendMessageButton.Location = new Point((Width - sendMessageButton.Width) / 2, 250); sendMessageButton.Text = "加为好友"; })); } else { nameLabel.Text = data.user_name; nameLabel.Size = TextRenderer.MeasureText(nameLabel.Text, nameLabel.Font); nameLabel.Location = new Point(Width / 2 - nameLabel.Width / 2, 170); nickNameLabel.Text = "畅聊号:" + model.id_Card; nickNameLabel.Size = TextRenderer.MeasureText(nickNameLabel.Text, nickNameLabel.Font); nickNameLabel.Location = new Point((Width - nickNameLabel.Width) / 2, 200); idCardLabel.Visible = false; sendMessageButton.Location = new Point((Width - sendMessageButton.Width) / 2, 250); sendMessageButton.Text = "加为好友"; } } }
private static bool PacketGetUserDataProc(ref Packet.State __result, ref PacketGetUserData __instance) { Log.Info($"PacketGetUserData proc"); GetUserData query = __instance.query as GetUserData; if (!FileSystem.Configuration.FileExists("UserData.json")) { query.response_ = GetUserDataResponse.create(); query.response_.userData.trophyId = GameDefaultID.TrophyID.getValue(); query.response_.userId = Singleton<UserManager>.instance.UserId; FileSystem.Configuration.SaveJson("UserData.json", query.response_); } query.response_ = FileSystem.Configuration.LoadJson<GetUserDataResponse>("UserData.json"); return true; }
private void addFriendButton_MouseClick(object sender, DSkin.DirectUI.DuiMouseEventArgs e) { if (member == null) { return; } GetUserData data = new GetUserData(); data.user_id = member.userID; data.portrait = member.avatar; data.user_name = member.user_name; data.id_card = member.id_card; AddFriendCheckForm form = new AddFriendCheckForm(data); form.Show(); this.Close(); }
public async void GetUserDataHandler_RequestingUserData_ReturnsCorrectUser() { // Arrange IGetManageUserDataAccess dataAccess = CreateFakeDataAccess(); IWeeeAuthorization authorization = AuthorizationBuilder.CreateUserWithAllRights(); GetUserDataHandler handler = new GetUserDataHandler(userContext, authorization, dataAccess); GetUserData request = new GetUserData(orgUserId); // Act var response = await handler.HandleAsync(request); // Assert Assert.NotNull(response); Assert.Equal(response.Email, "*****@*****.**"); Assert.Equal(response.OrganisationName, "Test ltd."); }
public bool Login(string username = "", string password = "") { HttpContext ctx = System.Web.HttpContext.Current; bool loginSuccessFlag = false; GetUserData userInfo = new GetUserData(); userInfo = oAccountService.GetUserData(username, password); if (userInfo != null) { ctx.Session["LoginSuccessFlag"] = true; ctx.Session["accountid"] = userInfo?.Id; ctx.Session["role"] = userInfo?.Role; ctx.Session["name"] = userInfo?.Name; loginSuccessFlag = true; } return(loginSuccessFlag); }
public async void GetUserDataHandler_WithNonInternalUser_ThrowSecurityException(AuthorizationBuilder.UserType userType) { // Arrange IGetManageUserDataAccess dataAccess = A.Fake <IGetManageUserDataAccess>(); A.CallTo(() => dataAccess.GetCompetentAuthorityUser(Guid.NewGuid())).Returns(new ManageUserData()); A.CallTo(() => dataAccess.GetOrganisationUser(Guid.NewGuid())).Returns(new ManageUserData()); IWeeeAuthorization authorization = AuthorizationBuilder.CreateFromUserType(userType); GetUserDataHandler handler = new GetUserDataHandler(userContext, authorization, dataAccess); GetUserData request = new GetUserData(Guid.NewGuid()); // Act Func <Task <ManageUserData> > action = () => handler.HandleAsync(request); // Assert await Assert.ThrowsAsync <SecurityException>(action); }
public void addStronger(GetUserData model) { queue.QueueTask(() => { var sf = db.strongers.Where(p => p.userID.Equals(model.user_id) && p.groupID.Equals("Self")).FirstOrDefault(); if (sf != null) { sf.avatar = model.portrait; sf.nickName = model.user_name; sf.idCard = model.id_card; } else { StrongerModel m = new StrongerModel(); m.userID = model.user_id; m.groupID = "Self"; m.nickName = model.user_name; m.idCard = model.id_card; m.avatar = model.portrait; db.strongers.Add(m); } db.SaveChanges(); }); }
private void BindGrid() { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { AdminBLL ws = new AdminBLL(); GetUserData _req = new GetUserData(); GetUserDataResponse _resp = ws.GetUserInfoData(_req); int pageSize = ContextKeys.GRID_PAGE_SIZE; gvItemTable.PageSize = pageSize; gvItemTable.DataSource = _resp.UserID; if (_resp.UserID.Count == 0) { userid.Visible = false; } gvItemTable.DataBind(); } catch (Exception ex) { logger.Info(ex.Message); } }
IEnumerator GetAccountsData() { int page = 1; int maxPages; int currentIndex = 0; string accountPage = "http://" + username + ":" + password + "@" + "api.futurefinance.io/api/accounts/?page=" + page + "&sort=DESCENDING"; //string accountPage = "http://"+username+":"+password+"@"+APIPage+"accounts/"; WWW accountData = new WWW(accountPage); yield return(accountData); string jsonAccountData = accountData.text; AccountsSpace.BankAccounts allAcountData = JsonUtility.FromJson <AccountsSpace.BankAccounts>(jsonAccountData); userData = new GetUserData[allAcountData.total]; maxPages = Mathf.CeilToInt((float)allAcountData.total / allAcountData.count); for (int i = 0; i < maxPages; i++) { accountPage = "http://" + username + ":" + password + "@" + "api.futurefinance.io/api/accounts/?page=" + page + "&sort=DESCENDING"; accountData = new WWW(accountPage); yield return(accountData); jsonAccountData = accountData.text; allAcountData = JsonUtility.FromJson <AccountsSpace.BankAccounts>(jsonAccountData); for (int x = 0; x < allAcountData.count; x++) { userData[currentIndex] = new GetUserData(allAcountData._embedded.accounts[x].accountNumber, allAcountData._embedded.accounts[x]._links.transactions.href); } for (int x = 0; x < allAcountData.count; x++) { string transactionsPage = "http://" + username + ":" + password + "@" + APIPage + "accounts/" + userData[x].AccountNumber + "/transactions/"; WWW transactionsData = new WWW(transactionsPage); yield return(transactionsData); string jsonTransactionData = transactionsData.text; TransactionsSpace.AccountTransactions allAcountTransactions = JsonUtility.FromJson <TransactionsSpace.AccountTransactions>(jsonTransactionData); string paymentAgreementPage = "http://" + username + ":" + password + "@" + APIPage + "accounts/" + userData[x].AccountNumber + "/paymentagreements/"; WWW paymentAgreementData = new WWW(paymentAgreementPage); yield return(paymentAgreementData); string jsonPaymentAgreementData = paymentAgreementData.text; AgreementsSpace.AccountPaymentAgreements allPaymentAgreeements = JsonUtility.FromJson <AgreementsSpace.AccountPaymentAgreements>(jsonPaymentAgreementData); userData[currentIndex] = new GetUserData( allAcountData._embedded.accounts[x]._embedded.owner.firstname, allAcountData._embedded.accounts[x]._embedded.owner.lastname, allAcountData._embedded.accounts[x]._embedded.owner.customerNumber, allAcountData._embedded.accounts[x].accountNumber, allAcountData._embedded.accounts[x].coowners, allAcountData._embedded.accounts[x].accountStatus, allAcountData._embedded.accounts[x].balance, allAcountData._embedded.accounts[x].creditMax, allAcountData._embedded.accounts[x]._links.transactions.href, allAcountData._embedded.accounts[x]._links.paymentagreements.href); //userData[currentIndex].CustomerTransactions = new GetTransactionData[allAcountTransactions.count]; //userData[currentIndex].PaymentAgreements = new GetPaymentAgreementData[allPaymentAgreeements.count]; /*for(int y = 0; y < allAcountTransactions.count; y++) * { * userData[currentIndex].CustomerTransactions[y] = new GetTransactionData( * allAcountTransactions._embedded.transactions[y].id, * allAcountTransactions._embedded.transactions[y].transactionDate, * allAcountTransactions._embedded.transactions[y].transactionDateTimestamp, * allAcountTransactions._embedded.transactions[y].merchantCategoryCode, * allAcountTransactions._embedded.transactions[y].amount, * allAcountTransactions._embedded.transactions[y].text, * allAcountTransactions._embedded.transactions[y].alternativeText, * allAcountTransactions._embedded.transactions[y].reconciled, * allAcountTransactions._embedded.transactions[y].paymentMedia, * allAcountTransactions._embedded.transactions[y].reserved); * }*/ /*for(int z = 0; z < allPaymentAgreeements.count; z++) * { * userData[currentIndex].PaymentAgreements[z] = new GetPaymentAgreementData( * allPaymentAgreeements._embedded.paymentAgreements[z].agreementNumber, * allPaymentAgreeements._embedded.paymentAgreements[z].text, * allPaymentAgreeements._embedded.paymentAgreements[z].pbsDebitGroup, * allPaymentAgreeements._embedded.paymentAgreements[z].pbsCreditorGroup, * allPaymentAgreeements._embedded.paymentAgreements[z].pbsCustomerNumber, * allPaymentAgreeements._embedded.paymentAgreements[z].status); * }*/ currentIndex++; } page++; } }
private bool VerifyUserTeam() { bool isValid = true; string Supervisor = ""; string Supervisor_OPTION = "1"; string IPQC = ""; string IPQC_OPTION = "1"; if (config.AUTH_CHECKLIST_APP_TEAM != "" && config.AUTH_CHECKLIST_APP_TEAM != null) { string[] teams = config.AUTH_CHECKLIST_APP_TEAM.Split(';'); string[] items = teams[0].Split(','); Supervisor = items[0]; Supervisor_OPTION = items[1]; string[] IPQCitems = teams[1].Split(','); IPQC = IPQCitems[0]; IPQC_OPTION = IPQCitems[1]; } if (logintype == 0) { if (config.UserTeam != "" && config.UserTeam != null) { GetUserData getUser = new GetUserData(sessionContext); string[] mdataGetUserDataValues = getUser.mdataGetUserData(this.txtUserName.Text.Trim(), this.txtPassword.Text.Trim(), config.StationNumber); if (mdataGetUserDataValues != null && mdataGetUserDataValues.Length > 0) { string teamnumber = mdataGetUserDataValues[2]; if (!config.UserTeam.Contains(teamnumber)) { SetStatusLabelText("User Team not authorized", 1); isValid = false; } } else { SetStatusLabelText("User Team not authorized", 1); isValid = false; } } } else if (logintype == 4) { if (Supervisor != "" && Supervisor_OPTION == "0") { GetUserData getUser = new GetUserData(sessionContext); string[] mdataGetUserDataValues = getUser.mdataGetUserData(this.txtUserName.Text.Trim(), this.txtPassword.Text.Trim(), config.StationNumber); if (mdataGetUserDataValues != null && mdataGetUserDataValues.Length > 0) { string teamnumber = mdataGetUserDataValues[2]; if (!Supervisor.Contains(teamnumber)) { SetStatusLabelText("User Team not authorized", 1); isValid = false; } } else { SetStatusLabelText("User Team not authorized", 1); isValid = false; } } } else if (logintype == 5) { if (IPQC != "" && IPQC_OPTION == "0") { GetUserData getUser = new GetUserData(sessionContext); string[] mdataGetUserDataValues = getUser.mdataGetUserData(this.txtUserName.Text.Trim(), this.txtPassword.Text.Trim(), config.StationNumber); if (mdataGetUserDataValues != null && mdataGetUserDataValues.Length > 0) { string teamnumber = mdataGetUserDataValues[2]; if (!IPQC.Contains(teamnumber)) { SetStatusLabelText("User Team not authorized", 1); isValid = false; } } else { SetStatusLabelText("User Team not authorized", 1); isValid = false; } } } return(isValid); }
public string Get(int id) { IGetUser readobject = new GetUserData(); return(readobject.GetUser(id).ToString()); }
public bool SetUserMaxCpId(MainPack pack) { return(GetUserData.SetUserMaxCpId(pack)); }
private void BindGridWithFilter() { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { AdminBLL ws = new AdminBLL(); GetUserData objReq = new GetUserData(); string WhereClause = ReturnWhere(); if (!string.IsNullOrEmpty(txtuserid.Text)) { objReq.UserID = txtuserid.Text; } if (!string.IsNullOrEmpty(txtfirstname.Text)) { objReq.FirstName = txtfirstname.Text; } if (!string.IsNullOrEmpty(txtrole.Text)) { objReq.Role = txtrole.Text; } if (!string.IsNullOrEmpty(txtnricno.Text)) { objReq.NRICno = txtnricno.Text; } if (!string.IsNullOrEmpty(WhereClause)) { objReq.WhereClause = WhereClause; } if (!string.IsNullOrEmpty(txtdateto.Text)) { if (!string.IsNullOrEmpty(txtdatefrom.Text)) { objReq.LastLoginTime = txtdatefrom.Text; objReq.LastLoginTime = txtdatefrom.Text; } } if (!string.IsNullOrEmpty(txtdatefrom.Text)) { if (string.IsNullOrEmpty(txtdateto.Text)) { objReq.LastLoginTime = txtdatefrom.Text; } } GetUserDataResponse ret = ws.GetUserInfoData(objReq); int pageSize = ContextKeys.GRID_PAGE_SIZE; gvItemTable.PageSize = pageSize; gvItemTable.DataSource = ret.UserID; if (ret.UserID.Count == 0) { // userid.Visible = false; } gvItemTable.DataBind(); userid.Text = ret.UserID.Count.ToString(); } catch (Exception ex) { logger.Info(ex.Message); } }
public void setDataBeforeLoad(GetUserData data) { this.data = data; }
bool ProcessAuthenticationData(BaseCloudAction[] actions, out string err) { err = string.Empty; foreach (BaseCloudAction action in actions) { // ------------------------------------------------------------------------- // Get actual region info... if (action is GetUserRegionInfo) { GetUserRegionInfo data = (GetUserRegionInfo)action; m_RealRegion = data.region; m_CountryCode = data.countryCode; } // ------------------------------------------------------------------------- // Get custom region info... else if (action is GetCustomRegionInfo) { if (action.isSucceeded == true) { GetCustomRegionInfo data = (GetCustomRegionInfo)action; m_CustomRegion = data.region; } else if (action.isFailed == true) { SetUserProductData setAction = new SetUserProductData(m_AuthenticatedUserID, CloudServices.PROP_ID_CUSTOM_REGION, "none"); GameCloudManager.AddAction(setAction); } } // ------------------------------------------------------------------------- // Get available premium accounts... else if (action is GetAvailablePremiumAccounts) { GetAvailablePremiumAccounts data = (GetAvailablePremiumAccounts)action; m_AvailableAccts = data.accounts; if (m_AvailableAccts == null) { // do not break, this isn't critical... Debug.LogWarning("Can't retrive list of all available premium accounts!"); } } else if (action is GetUserData) { if (action.isSucceeded == true) { GetUserData data = (GetUserData)action; // ------------------------------------------------------------------------- // Get nick name from cloud... if (data.dataID == CloudServices.PROP_ID_NICK_NAME) { string nickName = data.result; if (string.IsNullOrEmpty(nickName) == false) { m_NickName = GuiBaseUtils.FixNickname(nickName, m_UserName); } } // ------------------------------------------------------------------------- // Get 'i want news' from cloud... else if (data.dataID == CloudServices.PROP_ID_I_WANT_NEWS) { bool receiveNews; if (bool.TryParse(action.result, out receiveNews) == true) { m_ReceiveNews = receiveNews; } } // ------------------------------------------------------------------------- // Get account kind from cloud... else if (data.dataID == CloudServices.PROP_ID_ACCT_KIND) { try { m_UserAcctKind = (E_UserAcctKind)System.Enum.Parse(typeof(E_UserAcctKind), data.result, false); } catch { } } } } } return(true); }
private void GetNewMeeting_DoAction(string dataString) { // 先判斷是否要invoke if (this.Dispatcher.CheckAccess() == false) { // 這裡是下載事件處理,優先權設定為ContextIdle => 列舉值為 3。 幕後作業完成後,會處理作業。 this.Dispatcher.BeginInvoke(new Action <string>(GetNewMeeting_DoAction), dataString); } else { try { string CourseOrMeeting_String = PaperLess_Emeeting.Properties.Settings.Default.CourseOrMeeting_String; XDocument xml = null; string State = ""; try { xml = XDocument.Parse(dataString); State = xml.Element("User").Attribute("State").Value.Trim(); } catch (Exception ex) { LogTool.Debug(ex); } switch (State) { case "0": string NewAddMeetingID = xml.Element("User").Element("MeetingData").Attribute("ID").Value.Trim(); string BeginTime = xml.Element("User").Element("MeetingData").Attribute("BeginTime").Value.Trim(); DateTime date = DateTime.Now; bool IsValid = DateTime.TryParse(BeginTime, out date); if (IsValid == false) { date = DateTime.Now; } // 先做UI,再把按鈕的JSON存下來 //string SQL = @"update NowLogin Set MeetingListDate=@1,NewAddMeetingID=@2";//,HomeUserButtonAryJSON=@2 //int success = MSCE.ExecuteNonQuery(SQL, date.ToString("yyyy/MM/dd"),NewAddMeetingID);//, HomeUserButtonAryJSON); //if (success < 1) // LogTool.Debug(new Exception(@"DB失敗: " + SQL)); this.NewAddMeetingID = NewAddMeetingID; // 非同步POST方法 MouseTool.ShowLoading(); //GetUserData.AsyncPOST(UserID, UserPWD // , date // , (userObj, dateTime) => GetUserData_DoAction(userObj, dateTime)); if (NetworkTool.CheckNetwork() > 0) { GetUserData.AsyncPOST(UserID, UserPWD , date , (userObj, dateTime) => GetUserData_DoAction(userObj, dateTime)); } else { //DB查詢日期 DataTable dt = MSCE.GetDataTable("select UserJson from UserData where UserID =@1 and ListDate=@2" , UserID , DateTool.MonthFirstDate(MeetingListDate).ToString("yyyyMMdd")); User user = new User(); if (dt.Rows.Count > 0) { user = JsonConvert.DeserializeObject <User>(dt.Rows[0]["UserJson"].ToString()); } else { dt = MSCE.GetDataTable("select top 1 UserJson from UserData where UserID =@1" , UserID); if (dt.Rows.Count > 0) { user = JsonConvert.DeserializeObject <User>(dt.Rows[0]["UserJson"].ToString()); } user.MeetingList = new UserMeeting[0]; } GetUserData_DoAction(user, MeetingListDate); } AutoClosingMessageBox.Show(string.Format("成功加入{0}", CourseOrMeeting_String)); //重整列表 break; case "1": //AutoClosingMessageBox.Show(string.Format("該機關非{0}人員", CourseOrMeeting_String)); AutoClosingMessageBox.Show(string.Format("本{0}未邀請貴機關單位參與", CourseOrMeeting_String)); //AutoClosingMessageBox.Show("該機關非與會人員"); break; case "2": AutoClosingMessageBox.Show("已加入過"); break; case "3": AutoClosingMessageBox.Show(string.Format("{0}不存在", CourseOrMeeting_String)); break; case "4": AutoClosingMessageBox.Show(string.Format("{0}尚未發佈", CourseOrMeeting_String)); break; case "5": AutoClosingMessageBox.Show("無此使用者"); break; case "6": AutoClosingMessageBox.Show("加入失敗"); break; case "7": AutoClosingMessageBox.Show("機密會議"); break; case "8": AutoClosingMessageBox.Show("會議已取消"); break; default: AutoClosingMessageBox.Show("新增錯誤,請聯絡系統管理人員"); break; } } catch (Exception ex) { AutoClosingMessageBox.Show("新增錯誤,請聯絡系統管理人員"); LogTool.Debug(ex); } txtPinCode.Text = ""; MouseTool.ShowArrow(); } }
public UserInfoForm(GetUserData model) { data = model; InitializeComponent(); personalPanl1.setDataBeforeLoad(model); }
private void searchPerson() { if (string.IsNullOrEmpty(dSkinTextBox1.Text)) { MessageBox.Show("请填写手机号或者畅聊号"); return; } GetUserByMobileOrIdCardSendModel model = new GetUserByMobileOrIdCardSendModel(); model.mobile = dSkinTextBox1.Text; HttpUitls.Instance.get <GetUserByMobileOrIdCardReciveModel>("user/getUserByMobile", model, (json) => { if (json.code == 200) { FriendListData friend = DBHelper.Instance.getFriend(json.data.user_id); if (friend == null) { MainFrm frm = Application.OpenForms["MainFrm"] as MainFrm; if (frm != null) { GetUserData data = new GetUserData(); data.user_id = json.data.user_id; data.user_name = json.data.user_name; data.portrait = json.data.portrait; data.id_card = json.data.id_card; UserInfoForm form = new UserInfoForm(data); frm.BeginInvoke(new EventHandler((s, e) => { this.FormClosed += new FormClosedEventHandler((ss, ee) => { form.BeginInvoke(new EventHandler((sss, sse) => { form.BringToFront(); form.Activate(); })); }); this.Close(); form.Show(); })); DBHelper.Instance.addStronger(data); } else { this.BeginInvoke(new EventHandler((s, e) => { GetUserData data = new GetUserData(); data.user_id = json.data.user_id; data.user_name = json.data.user_name; data.portrait = json.data.portrait; data.id_card = json.data.id_card; UserInfoForm form = new UserInfoForm(data); form.Show(); DBHelper.Instance.addStronger(data); this.Close(); form.BringToFront(); })); } } else { MainFrm frm = Application.OpenForms["MainFrm"] as MainFrm; if (frm != null) { UserInfoForm form = new UserInfoForm(friend.toFriend()); frm.BeginInvoke(new EventHandler((s, e) => { this.FormClosed += new FormClosedEventHandler((ss, ee) => { form.BeginInvoke(new EventHandler((sss, sse) => { form.BringToFront(); form.Activate(); })); }); this.Close(); form.Show(); })); GetUserData data = new GetUserData(); data.user_id = json.data.user_id; data.user_name = json.data.user_name; data.portrait = json.data.portrait; data.id_card = json.data.id_card; DBHelper.Instance.addStronger(data); } else { this.BeginInvoke(new EventHandler((s, e) => { UserInfoForm form = new UserInfoForm(friend.toFriend()); form.Show(); GetUserData data = new GetUserData(); data.user_id = json.data.user_id; data.user_name = json.data.user_name; data.portrait = json.data.portrait; data.id_card = json.data.id_card; DBHelper.Instance.addStronger(data); this.Close(); form.BringToFront(); })); } } } else { this.BeginInvoke(new EventHandler((s, ee) => { MessageBox.Show(json.message); })); if (json.message.Contains("请重新登录")) { MainFrm frm = (MainFrm)Application.OpenForms["MainFrm"]; if (frm != null) { frm.gotoLogin(); this.BeginInvoke(new EventHandler((s, ee) => { this.Close(); })); } } } }, (code) => { if (code > 500 && code < 503) { this.BeginInvoke(new EventHandler((s, ee) => { MessageBox.Show("请重新登录"); })); MainFrm frm = (MainFrm)Application.OpenForms["MainFrm"]; if (frm != null) { frm.gotoLogin(); this.BeginInvoke(new EventHandler((s, ee) => { this.Close(); })); } } }); }
// private void btnLastNext_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { SV.ScrollToVerticalOffset(1); Image img = sender as Image; if (img.Name.Equals("btnLast")) { MeetingListDate = MeetingListDate.AddMonths(-1); } else { MeetingListDate = MeetingListDate.AddMonths(1); } // 非同步POST方法 MouseTool.ShowLoading(); //檢查是否有網路連線 Network.HttpRequest hr = new Network.HttpRequest(); if (NetworkTool.CheckNetwork() > 0) { Task.Factory.StartNew(() => { //無快取機制 //GetUserData.AsyncPOST(UserID, UserPWD // , MeetingListDate // , (userObj, dateTime) => GetUserData_DoAction(userObj, dateTime)); //有快取機制 if (PreLoadLastNextMonthDict.ContainsKey(MeetingListDate) == true) { GetUserData_DoAction(PreLoadLastNextMonthDict[MeetingListDate], MeetingListDate); //預載上一個月和下一個月 PreLoadLastNextMonth(); } else { GetUserData.AsyncPOST(UserID, UserPWD , MeetingListDate , (userObj, dateTime) => { GetUserData_DoAction(userObj, dateTime); //預載上一個月和下一個月 PreLoadLastNextMonth(); }); } }); //}).ContinueWith(task => //{ // //預載上一個月 // //Thread.Sleep(100); // //GetUserData.AsyncPOST(UserID, UserPWD // // , MeetingListDate.AddMonths(-1) // // , (userObj, dateTime) => { LastNextDict[dateTime] = userObj; }); //}).ContinueWith(task => //{ // //預載下一個月 // //Thread.Sleep(100); // //GetUserData.AsyncPOST(UserID, UserPWD // // , MeetingListDate.AddMonths(1) // // , (userObj, dateTime) => { LastNextDict[dateTime] = userObj; }); //}); } else { //DB查詢日期 DataTable dt = MSCE.GetDataTable("select UserJson from UserData where UserID =@1 and ListDate=@2" , UserID , DateTool.MonthFirstDate(MeetingListDate).ToString("yyyyMMdd")); User user = new User(); if (dt.Rows.Count > 0) { user = JsonConvert.DeserializeObject <User>(dt.Rows[0]["UserJson"].ToString()); } else { dt = MSCE.GetDataTable("select top 1 UserJson from UserData where UserID =@1" , UserID); if (dt.Rows.Count > 0) { user = JsonConvert.DeserializeObject <User>(dt.Rows[0]["UserJson"].ToString()); } user.MeetingList = new UserMeeting[0]; } GetUserData_DoAction(user, MeetingListDate); } //, () => { this.Dispatcher.BeginInvoke(new Action(() => { AutoClosingMessageBox.Show("無法取得資料,請稍後再試"); })); }); #region 步POST方法 //User user=GetUserData.POST(UserID, UserPWD, // DateTool.MonthFirstDate(MeetingListDate).ToString("yyyyMMdd"), // DateTool.MonthLastDate(MeetingListDate).ToString("yyyyMMdd")); //if (user != null) //{ // if (user.MeetingList.Length < 1) // txtNothing.Visibility = Visibility.Visible; // InitUI(user.MeetingList, MeetingListDate); // // 會議列表的上下一頁不要複寫Buton的JSON了 // // HomeUserButtonAryJSON = JsonConvert.SerializeObject(user.EnableButtonList); //} //else //{ // AutoClosingMessageBox.Show("無法取得資料,請稍後再試"); //} #endregion // 先做UI,再把按鈕的JSON存下來 string SQL = @"update NowLogin Set MeetingListDate=@1"; //,HomeUserButtonAryJSON=@2 int success = MSCE.ExecuteNonQuery(SQL, MeetingListDate.ToString("yyyy/MM/dd")); //, HomeUserButtonAryJSON); if (success < 1) { LogTool.Debug(new Exception(@"DB失敗: " + SQL)); } }
private void bw_DoWork(object sender, DoWorkEventArgs e) { logger.Log(LogLevel.Debug, "SIMSBulkImport.UserSet.bw_DoWork()"); queryStart = DateTime.Now; var worker = sender as BackgroundWorker; // Query SIMS database and get a total count of all the (current) pupils. recordcount = Switcher.SimsApiClass.GetPupilUsernameCount; recordupto = 0; logger.Log(LogLevel.Debug, "Total row count: " + recordcount); // Pull the SIMS data in _pupilData = Switcher.SimsApiClass.GetPupilUsernames; //while (recordupto < recordcount) //{ foreach (DataRow _dr in _pupilData.Rows) { if (worker.CancellationPending) { e.Cancel = true; logger.Log(LogLevel.Debug, "Kill process received"); break; } string newUser; bool addNewOk; string systemId = _dr["SystemId"].ToString(); string forename = _dr["Forename"].ToString(); string surname = _dr["Surname"].ToString(); string admissionNo = _dr["AdmissionNo"].ToString(); string admissionYear = _dr["AdmissionYear"].ToString(); string yearGroup = _dr["YearGroup"].ToString(); string regGroup = _dr["RegGroup"].ToString(); int personId = Convert.ToInt32(systemId); int increment = 0; string simsUser = Switcher.SimsApiClass.GetPupilUsername(personId); string status = "New"; if (string.IsNullOrWhiteSpace(simsUser)) { status = "Exists"; newUser = simsUser; } else { // Generate username newUser = Switcher.UserGenClass.GenerateUsername(forename, surname, admissionNo, admissionYear, yearGroup, regGroup, systemId, increment.ToString()); addNewOk = SetUsername(newUser); // Deal with duplicates - but only if we're using the increment field in our username expression while (!addNewOk && Switcher.UserGenClass.ExpressionContainsIncrement) { increment = increment + 1; newUser = Switcher.UserGenClass.GenerateUsername(forename, surname, admissionNo, admissionYear, yearGroup, regGroup, systemId, increment.ToString()); addNewOk = SetUsername(newUser); } } DataRow row = GetUserData.NewRow(); row["Forename"] = forename; row["Surname"] = surname; row["YearGroup"] = yearGroup; row["RegGroup"] = regGroup; row["Username"] = newUser; row["ExistsOrNew"] = status; GetUserData.Rows.Add(row); recordupto = recordupto + 1; // Update report progress int percent = Convert.ToInt32(recordupto * 100 / recordcount); worker.ReportProgress(percent); //} } }
public NewAddFriendInfoForm(GetUserData data) { model = data; InitializeComponent(); }
public MainPack Login(MainPack pack) { return(GetUserData.Login(pack)); }