Ejemplo n.º 1
0
    private void UpdateProductByPhoneSerWithDelete(string phoneSer)
    {
        Dictionary <string, string> conditions = new Dictionary <string, string>();

        conditions.Add("Flag", "1");
        conditions.Add("ProductSer", phoneSer);
        conditions.Add("PageIndex", "0");
        conditions.Add("PageSize", "1");
        IList <PostVO> list = m_PostService.GetPostList(conditions);

        if (list != null && list.Count > 0)
        {
            PostVO postVO = m_PostService.GetPostById(list[0].PostId);
            postVO.MemberId     = null;
            postVO.Type         = 0;
            postVO.SellPrice    = 0;
            postVO.CloseDate    = null;
            postVO.MemberName   = string.Empty;
            postVO.MemberPhone  = string.Empty;
            postVO.CustomField2 = string.Empty;
            m_PostService.UpdatePost(postVO);
            m_WebLogService.AddSystemLog(MsgVO.Action.修改, postVO, "", string.Format("單號:{0}", postVO.PostId));
            new Thread(new ThreadStart(() => ApiUtil.UpdatePostToServer(2))).Start();
        }
    }
Ejemplo n.º 2
0
    private void LoadProduct()
    {
        int id;

        if (!string.IsNullOrEmpty(Request["id"]) && int.TryParse(Request["id"], out id))
        {
            ltlPriceTitle.Text = "單機價";
            PostVO post = m_PostService.GetPostByIdNoLazy(id);
            if (post != null && post.Flag == 1)
            {
                if (post.Node != null && post.Node.NodeId == 4)
                {
                    ltlPriceTitle.Text = "特價";
                }
                ltlProductPic.Text  = string.Format("<div class='product_item_img' style=\"background-image:url('upload/{0}')\"></div>", post.PicFileName);
                ltlTitle.Text       = post.Title;
                ltlPrice.Text       = post.Price.ToString();
                ltlSellPrice.Text   = post.SellPrice.ToString();
                ltlSummary.Text     = string.Empty;
                ltlHtmlContent.Text = post.HtmlContent;
                ltlFbComments.Text  = string.Format("<div class='fb-comments' data-href=\"http://p-like.com.tw/product.aspx?id={0}\" data-width='1080' data-include-parent='false' data-numposts='5'></div>", id);

                if (!string.IsNullOrEmpty(post.Summary))
                {
                    StringBuilder sb       = new StringBuilder();
                    string[]      summarys = post.Summary.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
                    foreach (string s in summarys)
                    {
                        sb.AppendFormat("<li>{0}</li>", s);
                    }
                    ltlSummary.Text = sb.ToString();
                }
            }
        }
    }
Ejemplo n.º 3
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        PostVO postVO = new PostVO();

        UIHelper.FillVO(pnlContent, postVO);
        postVO.Node = m_PostService.GetNodeById(m_NodeId);
        //postVO.PicFileName = m_PicFileName;
        postVO.Flag        = 1;
        postVO.NeedUpdate  = true;
        postVO.CreatedBy   = m_SessionHelper.LoginUser.FullNameInChinese;
        postVO.UpdatedBy   = m_SessionHelper.LoginUser.FullNameInChinese;
        postVO.CreatedDate = DateTime.Now;
        postVO.UpdatedDate = DateTime.Now;
        //if (!string.IsNullOrEmpty(txtShowDate.Text.Trim()))
        //{
        //    postVO.ShowDate = DateTime.Parse(txtShowDate.Text.Trim());
        //}
        //if (!string.IsNullOrEmpty(txtCloseDate.Text.Trim()))
        //{
        //    postVO.ShowDate = DateTime.Parse(txtCloseDate.Text.Trim());
        //}
        m_PostService.CreatePost(postVO);
        m_WebLogService.AddSystemLog(MsgVO.Action.新增, postVO);
        new Thread(new ThreadStart(() => ApiUtil.UpdatePostToServer(2))).Start();
        ClearUI();
        fillGridView();
    }
Ejemplo n.º 4
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        PostVO postVO = new PostVO();

        postVO.Title       = txtTitle.Text.Trim();
        postVO.SortNo      = int.Parse(txtSortNo.Text.Trim());
        postVO.Node        = m_PostService.GetNodeById(m_NodeId);
        postVO.PicFileName = m_PicFileName;
        postVO.Flag        = int.Parse(ddlFlag.SelectedValue);
        postVO.ShowDate    = DateTime.Today;
        //if (!string.IsNullOrEmpty(txtShowDate.Text.Trim()))
        //{
        //    postVO.ShowDate = DateTime.Parse(txtShowDate.Text.Trim());
        //}
        postVO.LinkUrl = txtLinkUrl.Text.Trim();
        if (!string.IsNullOrEmpty(txtLinkUrl.Text.Trim()))
        {
            postVO.Type = 1;
        }
        else
        {
            postVO.Type = 0;
        }
        m_PostService.CreatePost(postVO);
        m_WebLogService.AddSystemLog(MsgVO.Action.新增, postVO);
        ClearUI();
        fillGridView();
    }
        public HttpResponseMessage Delete(string id)
        {
            int postId;

            if (!string.IsNullOrWhiteSpace(id) && int.TryParse(id, out postId))
            {
                try
                {
                    PostVO postVO = m_PostService.GetPostById(postId);
                    if (postVO != null)
                    {
                        postVO.NeedUpdate = false;
                        postVO.Flag       = 0;
                        postVO.UpdateId   = "系統API";
                        m_PostService.UpdatePost(postVO);

                        return(Request.CreateResponse(HttpStatusCode.OK));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.Gone));
                    }
                }
                catch (Exception ex)
                {
                    return(Request.CreateResponse(HttpStatusCode.NoContent, ex.ToString()));
                }
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.NoContent));
            }
        }
Ejemplo n.º 6
0
    private string Get4gPart(NodeVO vo)
    {
        StringBuilder sb = new StringBuilder();

        //搜尋條件
        Dictionary <string, string> conditions = new Dictionary <string, string>();

        conditions.Add("NodeId", "5");
        conditions.Add("WarrantySuppliers", vo.Name);
        conditions.Add("Type", "1");
        conditions.Add("Flag", "1");
        conditions.Add("Order", string.Format("order by {0}", "p.WarrantySuppliers, p.Type, p.SortNo, p.PostId"));

        IList <PostVO> list = m_PostService.GetPostList(conditions);

        if (list != null && list.Count > 0)
        {
            sb.AppendFormat("<tr class='discount_list_contant'><td rowspan='{0}' class='discount_list_type discount_list_type_4G' >4G</td></tr>"
                            , (list.Count + 1));

            for (int i = 0; i < list.Count; i++)
            {
                PostVO post    = list[i];
                string lastCss = "";
                if (i <= list.Count - 1)
                {
                    lastCss = " discount_list_contant-last";
                }
                sb.AppendFormat("<tr class='discount_list_contant {0}'><td class='discount_list_pro'>{1}</td><td class='discount_list_dis'>{2}</td><td class='discount_list_pre'>{3}</td><td class='discount_list_tran'>{4}</td><td class='discount_list_con'>{5}</td></tr>"
                                , lastCss, post.Title, post.CustomField1, post.CustomField2, post.Summary, post.HtmlContent);
            }
        }

        return(sb.ToString());
    }
Ejemplo n.º 7
0
    protected void gvList_RowCommand1(object sender, GridViewCommandEventArgs e)
    {
        string cmdName = e.CommandName;
        int    postId  = int.Parse(e.CommandArgument.ToString());
        PostVO postVO  = m_PostService.GetPostById(postId);

        switch (cmdName)
        {
        case "myModify":
            ClearUI();
            m_Mode = postId;
            //m_PicFileName = postVO.PicFileName;
            //ltlImg.Text = GetPic(m_PicFileName);
            UIHelper.FillUI(pnlContent, postVO);
            ShowMode();
            pnlContent.Visible = true;
            break;

        case "myDel":
            m_PostService.DeletePost(postVO);
            m_WebLogService.AddSystemLog(MsgVO.Action.刪除, postVO);
            break;

        default:
            break;
        }
        fillGridView();
    }
Ejemplo n.º 8
0
    private string GetProductList(NodeVO vo)
    {
        StringBuilder sb = new StringBuilder();

        //搜尋條件
        string keyword = Request["keyword"];
        Dictionary <string, string> conditions = new Dictionary <string, string>();

        conditions.Add("NodeId", "3");
        conditions.Add("Flag", "1");
        conditions.Add("ProductKeyWord", keyword);
        conditions.Add("WarrantySuppliers", vo.Name);
        conditions.Add("Order", string.Format("order by {0}", "p.WarrantySuppliers, p.SortNo, p.PostId"));

        IList <PostVO> list = m_PostService.GetPostList(conditions);

        if (list != null && list.Count > 0)
        {
            for (int i = 0; i < list.Count; i++)
            {
                PostVO post = list[i];
                sb.AppendFormat("<tr onclick=\"window.location='product.aspx?id={0}';\" style='cursor:pointer;'><td class='product_ov_type'>{1}</td><td class='product_ov_price'>${2}</td></tr>"
                                , post.PostId, post.Title, post.SellPrice);
            }
        }

        return(sb.ToString());
    }
Ejemplo n.º 9
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        DateTime date;

        if (DateTime.TryParse(txtDate.Text.Trim(), out date))
        {
            NodeVO nodeSpecial = m_PostService.GetNodeByName("#特別現金收支");

            PostVO postVO = new PostVO();
            postVO.Node      = nodeSpecial;
            postVO.CloseDate = date;
            postVO.Title     = txtTitle.Text.Trim();
            postVO.Type      = int.Parse(ddlType.SelectedValue);
            if (postVO.Type == 1)
            {
                postVO.Price = -1 * (int.Parse(txtPrice.Text.Trim()));
            }
            else
            {
                postVO.Price = (int.Parse(txtPrice.Text.Trim()));
            }
            m_PostService.CreatePost(postVO);

            UIHelper.ClearUI(pnlSpecialToday);
            ddlType.SelectedValue = "";
            LoadDataToUI();
        }

        else
        {
            ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS("日期格式錯誤!"), false);
            return;
        }
    }
Ejemplo n.º 10
0
        //// GET api/<controller>/5
        //public string Get(int id)
        //{
        //    return "value";
        //}

        // POST api/<controller>
        public HttpResponseMessage Post(MemberDto memberDto)
        {
            if (memberDto != null)
            {
                try
                {
                    MemberVO memberVO = null;

                    memberVO            = new MemberVO(memberDto);
                    memberVO.MemberId   = 0;
                    memberVO.ServerId   = 0;
                    memberVO.NeedUpdate = false;
                    memberVO.UpdateId   = "系統API";
                    FixTimeZone(memberVO);
                    memberVO          = m_MemberService.CreateMember(memberVO);
                    memberVO.ServerId = memberVO.MemberId;

                    //檢查是否有ServerId 有的話把狀態改成刪除, 重新建立一筆
                    if (memberDto.ServerId != 0)
                    {
                        MemberVO oldMemberVO = m_MemberService.GetMemberById(memberDto.ServerId);
                        if (oldMemberVO != null)
                        {
                            oldMemberVO.NeedUpdate = false;
                            oldMemberVO.Status     = "0";
                            oldMemberVO.UpdateId   = "系統API";
                            m_MemberService.UpdateMember(oldMemberVO);


                            //檢查庫存有沒有關聯這個memberid, 有的話庫存要更新memberid
                            Dictionary <string, string> conditions = new Dictionary <string, string>();
                            conditions.Add("Flag", "1");
                            conditions.Add("NodeId", "2");
                            conditions.Add("MemberId", memberVO.MemberId.ToString());

                            if (m_PostService.GetPostCount(conditions) > 0)
                            {
                                conditions.Add("PageIndex", "0");
                                conditions.Add("PageSize", "1");
                                IList <PostVO> postVOList = m_PostService.GetPostList(conditions);
                                PostVO         postVO     = m_PostService.GetPostById(postVOList[0].PostId);
                                postVO.MemberId = memberVO.MemberId.ToString();
                                m_PostService.UpdatePost(postVO);
                            }
                        }
                    }

                    return(Request.CreateResponse <MemberDto>(HttpStatusCode.Created, new MemberDto(memberVO)));
                }
                catch (Exception ex)
                {
                    return(Request.CreateResponse(HttpStatusCode.NoContent, ex.ToString()));
                }
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.NoContent));
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 新增Post
 /// </summary>
 /// <param name="postVO">被新增的Post</param>
 /// <returns>新增後的Post</returns>
 public PostVO CreatePost(PostVO postVO)
 {
     postVO = PostDao.CreatePost(postVO);
     if (postVO.SortNo == 0)
     {
         postVO.SortNo = postVO.PostId;
         postVO        = PostDao.UpdatePost(postVO);
     }
     return(postVO);
 }
Ejemplo n.º 12
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        PostVO postVO = new PostVO();

        UIHelper.FillVO(pnlContent, postVO);
        postVO.Node = m_PostService.GetNodeById(m_NodeId);
        m_PostService.CreatePost(postVO);
        m_WebLogService.AddSystemLog(MsgVO.Action.新增, postVO);
        ClearUI();
        fillGridView();
    }
Ejemplo n.º 13
0
    protected void btnSold_Click(object sender, EventArgs e)
    {
        try
        {
            PostVO postVO = m_PostService.GetPostById(m_Mode);

            //判斷數量大於1就另外增加一筆新的
            if (postVO.Quantity > 1)
            {
                PostVO newPostVO = new PostVO();
                UIHelper.FillVO(pnlContent, newPostVO);
                newPostVO.Node        = postVO.Node;
                newPostVO.Quantity    = 1;
                newPostVO.Type        = 1;
                newPostVO.NeedUpdate  = true;
                newPostVO.CreatedBy   = m_SessionHelper.LoginUser.FullNameInChinese;
                newPostVO.UpdatedBy   = m_SessionHelper.LoginUser.FullNameInChinese;
                newPostVO.CreatedDate = DateTime.Now;
                newPostVO.UpdatedDate = DateTime.Now;
                m_PostService.CreatePost(newPostVO);
                m_WebLogService.AddSystemLog(MsgVO.Action.售出, postVO, "", string.Format("單號:{0}", postVO.PostId));

                postVO.Quantity   -= 1;
                postVO.NeedUpdate  = true;
                postVO.UpdatedBy   = m_SessionHelper.LoginUser.FullNameInChinese;
                postVO.UpdatedDate = DateTime.Now;
                m_PostService.UpdatePost(postVO);
                new Thread(new ThreadStart(() => ApiUtil.UpdatePostToServer(2))).Start();
                fillGridView();
                ClearUI();
                ShowMode();
            }
            else
            {
                UIHelper.FillVO(pnlContent, postVO);
                postVO.Type        = 1;
                postVO.NeedUpdate  = true;
                postVO.UpdatedBy   = m_SessionHelper.LoginUser.FullNameInChinese;
                postVO.UpdatedDate = DateTime.Now;
                m_PostService.UpdatePost(postVO);
                m_WebLogService.AddSystemLog(MsgVO.Action.售出, postVO, "", string.Format("單號:{0}", postVO.PostId));
                new Thread(new ThreadStart(() => ApiUtil.UpdatePostToServer(2))).Start();
                fillGridView();
                ClearUI();
                ShowMode();
            }
        }
        catch (Exception ex)
        {
            m_Log.Error(ex);
            lblMsg.Text = ex.ToString();
        }
    }
Ejemplo n.º 14
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        PostVO postVO = m_PostService.GetPostById(m_Mode);

        UIHelper.FillVO(pnlContent, postVO);
        //postVO.PicFileName = m_PicFileName;
        m_PostService.UpdatePost(postVO);
        m_WebLogService.AddSystemLog(MsgVO.Action.修改, postVO);
        fillGridView();
        ClearUI();
        ShowMode();
    }
Ejemplo n.º 15
0
 private void LoadUI()
 {
     if (!string.IsNullOrEmpty(Request["id"]))
     {
         string id     = Request["id"];
         PostVO postVO = m_PostService.GetPostById(int.Parse(id));
         if (postVO != null && !string.IsNullOrEmpty(postVO.HtmlContent))
         {
             ltlMap.Text = string.Format("<iframe src=\"{0}\" width='800' height='800' frameborder='0' style='border:0' allowfullscreen></iframe>", postVO.HtmlContent);
         }
     }
 }
Ejemplo n.º 16
0
    protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        GridView gv = (GridView)sender;

        if (e.Row.RowIndex != -1)
        {
            Control ctrl   = e.Row;
            int     postId = int.Parse(UIHelper.FindHiddenValue(ref ctrl, "hdnPostId"));
            PostVO  postVO = m_PostService.GetPostById(postId);
            NodeVO  node   = m_PostService.GetNodeById(postVO.Node.NodeId);
        }
    }
Ejemplo n.º 17
0
        private void FixTimeZone(PostVO postVO)
        {
            int addHours = m_ConfigHelper.AddHours;

            if (postVO.ShowDate.HasValue)
            {
                postVO.ShowDate = postVO.ShowDate.Value.AddHours(addHours);
            }

            if (postVO.CloseDate.HasValue)
            {
                postVO.CloseDate = postVO.CloseDate.Value.AddHours(addHours);
            }
        }
Ejemplo n.º 18
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        PostVO postVO = m_PostService.GetPostById(m_Mode);

        postVO.Flag        = 0;
        postVO.NeedUpdate  = true;
        postVO.UpdatedBy   = m_SessionHelper.LoginUser.FullNameInChinese;
        postVO.UpdatedDate = DateTime.Now;
        m_PostService.UpdatePost(postVO);
        m_WebLogService.AddSystemLog(MsgVO.Action.刪除, postVO, "", string.Format("單號:{0}", postVO.PostId));
        new Thread(new ThreadStart(() => ApiUtil.UpdatePostToServer(2))).Start();
        ClearUI();
        fillGridView();
    }
Ejemplo n.º 19
0
    public string GetDefaultHeadMeta(PostVO postVO)
    {
        StringBuilder sb = new StringBuilder();

        //設定預設
        PostVO defaultMetaVO = m_PostService.GetPostById(m_DefaultMetaPostId);
        string title         = defaultMetaVO.PageTitle;
        string description   = defaultMetaVO.PageDescription;
        string keyWord       = defaultMetaVO.PageKeyWord;

        //傳入的Post,有值的話就替換
        if (postVO != null)
        {
            if (!string.IsNullOrEmpty(postVO.PageTitle))
            {
                title = postVO.PageTitle;
            }
            else
            {
                title = string.Format("{0} - {1}", GetContent(postVO, "Title"), defaultMetaVO.PageTitle);
            }

            if (!string.IsNullOrEmpty(postVO.PageDescription))
            {
                description = postVO.PageDescription;
            }

            if (!string.IsNullOrEmpty(postVO.PageKeyWord))
            {
                keyWord = postVO.PageKeyWord;
            }
        }

        if (!string.IsNullOrEmpty(title))
        {
            sb.Append(string.Format("<title>{0}</title>", title));
        }

        if (!string.IsNullOrEmpty(description))
        {
            sb.Append(string.Format("<META NAME=\"Description\" CONTENT=\"{0}\">", description));
        }

        if (!string.IsNullOrEmpty(keyWord))
        {
            sb.Append(string.Format("<META NAME=\"KeyWords\" CONTENT=\"{0}\">", keyWord));
        }

        return(sb.ToString());
    }
Ejemplo n.º 20
0
        private PostVO CreatePost(string title, NodeVO nodeVO, int sort)
        {
            PostVO postVO = new PostVO();

            postVO.Node        = nodeVO;
            postVO.Title       = title;
            postVO.SortNo      = sort;
            postVO.Flag        = 1;
            postVO.CreatedBy   = "admin";
            postVO.UpdatedBy   = "admin";
            postVO.CreatedDate = DateTime.Now;
            postVO.UpdatedDate = DateTime.Now;
            postVO.ShowDate    = DateTime.Today;

            return(m_PostService.CreatePost(postVO));
        }
Ejemplo n.º 21
0
    protected void txtPhoneSer_TextChanged(object sender, EventArgs e)
    {
        lblPhoneSerMsg.Text = string.Empty;
        hdnPhoneSerId.Value = string.Empty;

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

        conditions.Add("Flag", "1");
        conditions.Add("NodeId", "2");
        //conditions.Add("Type", "0");
        //conditions.Add("ProductSer", txtPhoneSer.Text.Trim());
        conditions.Add("KeyWord", txtPhoneSer.Text.Trim());
        conditions.Add("PageIndex", "0");
        conditions.Add("PageSize", "10");
        IList <PostVO> list = m_PostService.GetPostList(conditions);

        if (list != null)
        {
            list = list.Where(l => !string.IsNullOrEmpty(l.ProductSer)).ToList();
        }

        if (list == null || list.Count == 0)
        {
            lblPhoneSerMsg.Text = "查無此手機序號";
        }
        else
        {
            PostVO product = list[0];
            if (product.Type == 1)
            {
                lblPhoneSerMsg.Text = "此序號手機已售出";
            }
            else
            {
                if (!string.IsNullOrEmpty(product.ProductSer))
                {
                    hdnPhoneSerId.Value       = product.PostId.ToString();
                    txtPhoneSer.Text          = product.ProductSer;
                    txtProduct.Text           = product.Title;
                    txtPhonePrice.Text        = product.Price.ToString();
                    txtWarrantySuppliers.Text = product.WarrantySuppliers;
                    txtMobileWholesalers.Text = product.Wholesalers;
                }
            }
        }
    }
Ejemplo n.º 22
0
        private PostVO CreatePost(string title, NodeVO nodeVO, int sort, string linkUrl, string picFileName)
        {
            PostVO postVO = new PostVO();

            postVO.Node        = nodeVO;
            postVO.Title       = title;
            postVO.SortNo      = sort;
            postVO.Flag        = 1;
            postVO.CreatedBy   = "admin";
            postVO.UpdatedBy   = "admin";
            postVO.CreatedDate = DateTime.Now;
            postVO.UpdatedDate = DateTime.Now;
            postVO.ShowDate    = DateTime.Today;
            postVO.LinkUrl     = linkUrl;
            postVO.PicFileName = picFileName;

            return(m_PostService.CreatePost(postVO));
        }
Ejemplo n.º 23
0
    protected void gvSpecialToday_RowCommand1(object sender, GridViewCommandEventArgs e)
    {
        string cmdName = e.CommandName;
        int    postId  = int.Parse(e.CommandArgument.ToString());
        PostVO postVO  = m_PostService.GetPostById(postId);

        switch (cmdName)
        {
        case "myDel":
            postVO.Flag = 0;
            m_PostService.UpdatePost(postVO);
            m_WebLogService.AddSystemLog(MsgVO.Action.刪除, postVO, "", string.Format("單號:{0}", postVO.PostId));
            break;

        default:
            break;
        }
        LoadDataToUI();
    }
Ejemplo n.º 24
0
    protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        GridView gv = (GridView)sender;

        if (e.Row.RowIndex != -1)
        {
            Control ctrl   = e.Row;
            int     postId = int.Parse(UIHelper.FindHiddenValue(ref ctrl, "hdnPostId"));
            PostVO  postVO = m_PostService.GetPostById(postId);

            Dictionary <string, string> conditions = new Dictionary <string, string>();
            conditions.Add("Flag", "1");
            conditions.Add("Type", "0");
            conditions.Add("EqualTitle", postVO.Title);
            ////在庫總庫存
            int totalQuantity = m_PostService.GetTotalQuantity(conditions);
            UIHelper.SetLabelText(ref ctrl, "lblTotalQuantity", totalQuantity.ToString());
        }
    }
Ejemplo n.º 25
0
    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);
    }
Ejemplo n.º 26
0
        /// <summary>
        /// 取得Post By PostId No Lazy
        /// </summary>
        /// <param name="postId">PostId</param>
        /// <returns>Post</returns>
        public PostVO GetPostByIdNoLazy(int postId)
        {
            PostVO postVO = PostDao.GetPostById(postId);

            if (postVO != null && postVO.ParentPost != null)
            {
                NHibernateUtil.Initialize(postVO.ParentPost);

                if (postVO.ParentPost.ParentPost != null)
                {
                    NHibernateUtil.Initialize(postVO.ParentPost.ParentPost);
                }
            }

            if (postVO.Node != null)
            {
                NHibernateUtil.Initialize(postVO.Node);
            }

            return(postVO);
        }
Ejemplo n.º 27
0
    //private string GetPic(string fileName)
    //{
    //    return "<img src='../../upload/" + fileName + "' width='145' height='108' border='0'>";
    //}

    protected void gvList_RowCommand1(object sender, GridViewCommandEventArgs e)
    {
        string cmdName = e.CommandName;
        int    postId  = int.Parse(e.CommandArgument.ToString());
        PostVO postVO  = m_PostService.GetPostById(postId);

        switch (cmdName)
        {
        case "myModify":
            ClearUI();
            m_Mode = postId;
            InitDDL();
            UIHelper.FillUI(pnlContent, postVO);
            ShowMode();
            if (postVO.Type == 1)
            {
                btnSold.Visible = false;
            }
            else
            {
                txtCloseDate.Text = ConvertUtil.UtcDateTimeToTaiwanDateTime(DateTime.UtcNow).ToString("yyyy/MM/dd");
            }
            pnlContent.Visible     = true;
            rfCloseDate.Visible    = true;
            rfCustomField2.Visible = true;
            rfSellPrice.Visible    = true;
            txtTitle.Enabled       = false;
            ddlProductList.Visible = false;
            break;
        //case "myDel":
        //    postVO.Flag = 0;
        //    m_PostService.UpdatePost(postVO);
        //    m_WebLogService.AddSystemLog(MsgVO.Action.刪除, postVO, "", string.Format("單號:{0}", postVO.PostId));
        //    break;

        default:
            break;
        }
        fillGridView();
    }
Ejemplo n.º 28
0
        public void UpdateCashByPeriod(DateTime dateFrom, DateTime dateTo)
        {
            m_Log.Debug("UpdateCashByPeriod dateFrom: " + dateFrom.ToString("yyyy/MM/dd"));
            m_Log.Debug("UpdateCashByPeriod dateTo: " + dateTo.ToString("yyyy/MM/dd"));
            NodeVO node = PostService.GetNodeByName("#每日結帳");

            for (DateTime day = dateFrom; day.Date <= dateTo; day = day.AddDays(1))
            {
                m_Log.Debug("UpdateCashByPeriod day: " + day.ToString("yyyy/MM/dd"));
                CashStatisticsVO cashStatisticsVO = GetCashStatisticsVO(day);

                if (cashStatisticsVO != null)
                {
                    //找出有沒有這天的舊的結帳資料,有的話刪除
                    Dictionary <string, string> conditionsOldCash = new Dictionary <string, string>();
                    conditionsOldCash.Add("Flag", "1");
                    conditionsOldCash.Add("NodeId", node.NodeId.ToString());
                    conditionsOldCash.Add("CloseDate", day.ToString("yyyy/MM/dd"));
                    conditionsOldCash.Add("PageIndex", "0");
                    conditionsOldCash.Add("PageSize", "1");

                    IList <PostVO> cashList = PostService.GetPostList(conditionsOldCash);
                    if (cashList != null && cashList.Count > 0)
                    {
                        PostService.DeletePost(cashList[0]);
                    }

                    PostVO post = new PostVO();
                    post.Node      = node;
                    post.Title     = "每日結帳";
                    post.CreatedBy = "admin";
                    post.UpdatedBy = "admin";
                    post.CloseDate = cashStatisticsVO.CloseDate;
                    post.Price     = cashStatisticsVO.CashToday;

                    PostService.CreatePost(post);
                }
            }
        }
Ejemplo n.º 29
0
        private PostVO CreatePost(string title, NodeVO nodeVO, int sort, int type, string warrantySuppliers, string customField1, string customField2, string summary, string content)
        {
            PostVO postVO = new PostVO();

            postVO.Node              = nodeVO;
            postVO.Title             = title;
            postVO.SortNo            = sort;
            postVO.Type              = type;
            postVO.WarrantySuppliers = warrantySuppliers;
            postVO.CustomField1      = customField1;
            postVO.CustomField2      = customField2;
            postVO.Summary           = summary;
            postVO.HtmlContent       = content;
            postVO.Flag              = 1;
            postVO.CreatedBy         = "admin";
            postVO.UpdatedBy         = "admin";
            postVO.CreatedDate       = DateTime.Now;
            postVO.UpdatedDate       = DateTime.Now;
            postVO.ShowDate          = DateTime.Today;

            return(m_PostService.CreatePost(postVO));
        }
Ejemplo n.º 30
0
    protected void gvList_RowCommand1(object sender, GridViewCommandEventArgs e)
    {
        string cmdName = e.CommandName;
        int    postId  = int.Parse(e.CommandArgument.ToString());
        PostVO postVO  = m_PostService.GetPostById(postId);

        switch (cmdName)
        {
        case "myModify":
            ClearUI();
            m_Mode                = postId;
            m_PicFileName         = postVO.PicFileName;
            ltlImg.Text           = GetPic(m_PicFileName);
            txtTitle.Text         = postVO.Title;
            txtSortNo.Text        = postVO.SortNo.ToString();
            ddlFlag.SelectedValue = postVO.Flag.ToString();
            //if (postVO.ShowDate != null)
            //{
            //    txtShowDate.Text = postVO.ShowDate.Value.ToShortDateString();
            //}
            if (postVO.Type == 1)
            {
                txtLinkUrl.Text = postVO.LinkUrl;
            }
            ShowMode();
            pnlContent.Visible = true;
            break;

        case "myDel":
            m_PostService.DeletePost(postVO);
            m_WebLogService.AddSystemLog(MsgVO.Action.刪除, postVO);
            break;

        default:
            break;
        }
        fillGridView();
    }