protected void Page_Load(object sender, EventArgs e) { m_ConfigHelper = new ConfigHelper(); m_WebLogService = new WebLogService(); m_PostFactory = new PostFactory(); m_MemberFactory = new MemberFactory(); m_AuthFactory = new AuthFactory(); m_HttpHelper = new HttpHelper(); m_SessionHelper = new SessionHelper(); m_AccountingFactory = new AccountingFactory(); m_AuthService = m_AuthFactory.GetAuthService(); m_MemberService = m_MemberFactory.GetMemberService(); m_PostService = m_PostFactory.GetPostService(); m_AccountingService = m_AccountingFactory.GetAccountingService(); if (!IsPostBack) { InitDDL(); ShowMode(); fillGridView(); new Thread(new ThreadStart(ApiUtil.UpdateMemberToServer)).Start(); new Thread(new ThreadStart(() => ApiUtil.UpdateFileToServer(Server.MapPath("../../App_Data/upload/")))).Start(); new Thread(new ThreadStart(() => ApiUtil.UpdatePostToServer(2))).Start(); //LoadTotalCommission(); } }
protected void Page_Load(object sender, EventArgs e) { m_AuthFactory = new AuthFactory(); m_AuthService = m_AuthFactory.GetAuthService(); m_MemberFactory = new MemberFactory(); m_MemberService = m_MemberFactory.GetMemberService(); }
protected void Page_Load(object sender, EventArgs e) { m_AuthFactory = new AuthFactory(); m_AuthService = m_AuthFactory.GetAuthService(); m_MemberFactory = new MemberFactory(); m_MemberService = m_MemberFactory.GetMemberService(); m_PostFactory = new PostFactory(); m_PostService = m_PostFactory.GetPostService(); if (!IsPostBack) { IList <NodeVO> storeList = m_PostService.GetNodeListByParentName("店家"); ltlTitle.Text = string.Format("<title> 品讚行動通訊聯合系統-{0}</title>", storeList[0].Name); ltlTitle2.Text = string.Format("<品讚行動通訊聯合系統-{0}", storeList[0].Name); } }
public void TestCaseInit() { m_AuthFactory = new AuthFactory(); m_PostFactory = new PostFactory(); m_SystemFactory = new SystemFactory(); m_StorageFactory = new StorageFactory(); m_MemberFactory = new MemberFactory(); m_AccountingFactory = new AccountingFactory(); m_AuthService = m_AuthFactory.GetAuthService(); m_PostService = m_PostFactory.GetPostService(); m_TemplateService = m_SystemFactory.GetTemplateService(); m_SystemService = m_SystemFactory.GetSystemService(); m_MessageService = m_PostFactory.GetMessageService(); m_StorageFileService = m_StorageFactory.GetStorageFileService(); m_MemberService = m_MemberFactory.GetMemberService(); m_AccountingService = m_AccountingFactory.GetAccountingService(); }
protected void Page_Load(object sender, EventArgs e) { m_ConfigHelper = new ConfigHelper(); m_WebLogService = new WebLogService(); m_PostFactory = new PostFactory(); m_MemberFactory = new MemberFactory(); m_AuthFactory = new AuthFactory(); m_HttpHelper = new HttpHelper(); m_SessionHelper = new SessionHelper(); m_AuthService = m_AuthFactory.GetAuthService(); m_MemberService = m_MemberFactory.GetMemberService(); m_PostService = m_PostFactory.GetPostService(); if (!IsPostBack) { pnlContent.Visible = false; fillGridView(); ShowMode(); InitDDL(); } }
protected void Page_Load(object sender, EventArgs e) { m_WebLogService = new WebLogService(); m_PostFactory = new PostFactory(); m_MemberFactory = new MemberFactory(); m_AuthFactory = new AuthFactory(); m_HttpHelper = new HttpHelper(); m_SessionHelper = new SessionHelper(); m_AccountingFactory = new AccountingFactory(); m_AuthService = m_AuthFactory.GetAuthService(); m_MemberService = m_MemberFactory.GetMemberService(); m_PostService = m_PostFactory.GetPostService(); m_AccountingService = m_AccountingFactory.GetAccountingService(); if (!IsPostBack) { ////先更新到今天之前的結帳 m_AccountingService.UpdateCash(); txtDate.Text = ConvertUtil.UtcDateTimeToTaiwanDateTime(DateTime.UtcNow).ToString("yyyy/MM/dd"); ShowMode(); LoadDataToUI(); } }
/// <summary> /// 同步到Server /// </summary> public static void UpdateMemberToServer() { MemberFactory m_MemberFactory = new MemberFactory(); IMemberService m_MemberService = m_MemberFactory.GetMemberService(); ConfigHelper m_ConfigHelper = new ConfigHelper(); if (string.IsNullOrEmpty(m_ConfigHelper.MemberApiUrl)) { return; } Dictionary <string, string> conditions = new Dictionary <string, string>(); conditions.Add("NeedUpdate", "true"); IList <MemberVO> list = m_MemberService.GetMemberList(conditions); if (list != null && list.Count > 0) { foreach (MemberVO vo in list) { try { MemberVO memberVO = m_MemberService.GetMemberById(vo.MemberId); if (memberVO.IsUpdatingToServer) { continue; } MemberDto dto = new MemberDto(vo); //狀態為刪除 if (dto.Status == "0") { vo.IsUpdatingToServer = true; m_MemberService.UpdateMember(vo); if (dto.ServerId > 0) { //有serverId就去server刪除 string url = m_ConfigHelper.MemberApiUrl + "/" + dto.ServerId.ToString(); WebRequest request = ApiUtil.Post(url, "DELETE", ""); using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { if (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Gone || response.StatusCode == HttpStatusCode.NoContent) { vo.NeedUpdate = false; vo.IsUpdatingToServer = false; m_MemberService.UpdateMember(vo); } } } else { //沒有serverId就直接標記已更新 vo.NeedUpdate = false; vo.IsUpdatingToServer = false; m_MemberService.UpdateMember(vo); } } else { vo.IsUpdatingToServer = true; m_MemberService.UpdateMember(vo); WebRequest request = ApiUtil.Post <MemberDto>(m_ConfigHelper.MemberApiUrl, "POST", dto); string responseInfo = string.Empty; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { if (response.StatusCode == HttpStatusCode.Created) { using (Stream stream = response.GetResponseStream()) { responseInfo = (new StreamReader(stream)).ReadToEnd().Trim(); MemberDto newMemberDto = JsonConvert.DeserializeObject <MemberDto>(responseInfo); vo.IsUpdatingToServer = false; vo.NeedUpdate = false; vo.ServerId = newMemberDto.MemberId; m_MemberService.UpdateMember(vo); } } } } } catch (Exception ex) { vo.IsUpdatingToServer = false; m_MemberService.UpdateMember(vo); string error = ex.ToString(); } } } }