Пример #1
0
    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();
        }
    }
    /// <summary>
    /// 取得主視覺的內容
    /// </summary>
    /// <param name="server"></param>
    /// <param name="mainAdvNodeId">主視覺設定檔代碼</param>
    /// <returns>主視覺的內容</returns>
    public static string GetMainAdvContent(HttpServerUtility server, int mainAdvNodeId)
    {
        string content = string.Empty;

        PostFactory  postFactory = new PostFactory();
        IPostService postService = postFactory.GetPostService();

        NodeVO nodeVO = postService.GetNodeById(mainAdvNodeId);

        if (nodeVO != null)
        {
            if (nodeVO.UType == NodeVO.UnitType.Flash)
            {
                string advFile     = server.MapPath("~/template/") + "main-adv-flash01.txt";
                string fileContent = File.ReadAllText(advFile, System.Text.Encoding.UTF8);

                content = fileContent.Replace("(#FILENAME)", nodeVO.PicFileName);
            }
            //暫時不用圖片,僅flash
            //else if (nodeVO.UType == NodeVO.UnitType.Pic)
            //{
            //    string advFile = server.MapPath("~/template/") + "main-adv-pic01.txt";
            //    string fileContent = File.ReadAllText(advFile, System.Text.Encoding.UTF8);

            //    content = fileContent.Replace("(#FILENAME)", nodeVO.PicFileName);
            //}
        }

        return(content);
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_PostFactory = new PostFactory();
        m_PostService = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            LoadUI();
        }
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        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);
        }
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_WebLogService = new WebLogService();
        m_PostFactory   = new PostFactory();
        m_PostService   = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            GetList();
            ShowMode();
        }
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_WebLogService = new WebLogService();
        m_PostFactory   = new PostFactory();
        m_PostService   = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            pnlContent.Visible = false;
            fillGridView();
            ShowMode();
        }
    }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_PostFactory = new PostFactory();
        m_PostService = m_PostFactory.GetPostService();

        if (!Page.IsPostBack)
        {
            if (m_SessionHelper.LoginUser != null)
            {
                lblMsg.Text = m_SessionHelper.LoginUser.FullNameInChinese + "@" + HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] + " > 歡迎您再次登入!今天是民國" + (ConvertUtil.UtcDateTimeToTaiwanDateTime(DateTime.UtcNow).Year - 1911).ToString() + "年" + ConvertUtil.UtcDateTimeToTaiwanDateTime(DateTime.UtcNow).Month.ToString("00") + "月" + ConvertUtil.UtcDateTimeToTaiwanDateTime(DateTime.UtcNow).Day.ToString("00") + "日";
            }
            IList <NodeVO> storeList = m_PostService.GetNodeListByParentName("店家");
            ltlTitle.Text  = string.Format("<title> 品讚行動通訊聯合系統-{0}</title>", storeList[0].Name);
            ltlTitle2.Text = string.Format("<品讚行動通訊聯合系統-{0}", storeList[0].Name);
        }
    }
Пример #8
0
 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();
 }
Пример #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ConfigHelper  = new ConfigHelper();
        m_WebLogService = new WebLogService();
        m_PostFactory   = new PostFactory();
        m_AuthFactory   = new AuthFactory();
        m_SessionHelper = new SessionHelper();
        m_AuthService   = m_AuthFactory.GetAuthService();
        m_PostService   = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            InitDDL();
            pnlContent.Visible = false;
            fillGridView();
            ShowMode();
        }
    }
    public static string GetMainTopAdvPic(HttpServerUtility server, int m_PostId1)
    {
        string content = string.Empty;

        WebPageHelper webPageHelper = new WebPageHelper();
        PostFactory   postFactory   = new PostFactory();
        IPostService  postService   = postFactory.GetPostService();

        PostVO podeVO = postService.GetPostById(m_PostId1);

        if (podeVO != null)
        {
            string advFile     = server.MapPath("~/template/") + "main-adv-pic01.txt";
            string fileContent = File.ReadAllText(advFile, System.Text.Encoding.UTF8);

            content = fileContent.Replace("(#FILENAME)", webPageHelper.GetContent(podeVO, "PicFileName"));
        }

        return(content);
    }
Пример #11
0
    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();
        }
    }
Пример #12
0
    /// <summary>
    /// 同步Post到Server
    /// </summary>
    public static void UpdatePostToServer(int nodeId)
    {
        PostFactory  m_PostFactory  = new PostFactory();
        IPostService m_PostService  = m_PostFactory.GetPostService();
        ConfigHelper m_ConfigHelper = new ConfigHelper();

        if (string.IsNullOrEmpty(m_ConfigHelper.PostApiUrl))
        {
            return;
        }

        Dictionary <string, string> conditions = new Dictionary <string, string>();

        conditions.Add("NeedUpdate", "true");
        conditions.Add("NodeId", nodeId.ToString());
        IList <PostVO> list = m_PostService.GetPostList(conditions);

        if (list != null && list.Count > 0)
        {
            foreach (PostVO vo in list)
            {
                try
                {
                    PostVO postVO = m_PostService.GetPostById(vo.PostId);
                    if (postVO.IsUpdatingToServer)
                    {
                        continue;
                    }

                    PostDto dto = new PostDto(vo);

                    //狀態為刪除
                    if (dto.Flag == 0)
                    {
                        vo.IsUpdatingToServer = true;
                        m_PostService.UpdatePost(vo);

                        if (dto.ServerId > 0)
                        {
                            //有serverId就去server刪除
                            string     url     = m_ConfigHelper.PostApiUrl + "/" + 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_PostService.UpdatePost(vo);
                                }
                            }
                        }
                        else
                        {
                            //沒有serverId就直接標記已更新
                            vo.NeedUpdate         = false;
                            vo.IsUpdatingToServer = false;
                            m_PostService.UpdatePost(vo);
                        }
                    }
                    else
                    {
                        vo.IsUpdatingToServer = true;
                        m_PostService.UpdatePost(vo);

                        WebRequest request = ApiUtil.Post <PostDto>(m_ConfigHelper.PostApiUrl, "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();

                                    PostDto newPostDto = JsonConvert.DeserializeObject <PostDto>(responseInfo);

                                    vo.IsUpdatingToServer = false;
                                    vo.NeedUpdate         = false;
                                    vo.ServerId           = newPostDto.PostId;
                                    m_PostService.UpdatePost(vo);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    vo.IsUpdatingToServer = false;
                    m_PostService.UpdatePost(vo);
                    string error = ex.ToString();
                }
            }
        }
    }
Пример #13
0
 public WebPageHelper()
 {
     m_PostFactory = new PostFactory();
     m_PostService = m_PostFactory.GetPostService();
 }