コード例 #1
0
        public static Dictionary <string, object> GeSalePriceAll(string productId, string brandId, DateTime fromDate, DateTime toDate)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            SalesPriceBLL          pcBll = new SalesPriceBLL();
            IList <PNK_SalesPrice> lst   = pcBll.GetList(productId, brandId, fromDate, toDate, 1, 1, out total);

            if (lst.Count > 0)
            {
                dic.Add("OriginPrice", lst[0].OriginPrice);
                dic.Add("DealPrice", lst[0].DealPrice);
                dic.Add("UnitPrice", lst[0].UnitPrice);
            }
            //Lấy giá theo khu vực tỉnh thành
            else
            {
                lst = pcBll.GetList(productId, brandId, DateTime.MinValue, DateTime.MinValue, 1, 1, out total);
                if (lst.Count > 0)
                {
                    dic.Add("OriginPrice", lst[0].OriginPrice);
                    dic.Add("DealPrice", lst[0].DealPrice);
                    dic.Add("UnitPrice", lst[0].UnitPrice);
                }
                else
                {
                    Generic <PNK_Product> genericBLL = new Generic <PNK_Product>();
                    IList <PNK_Product>   lstProduct = genericBLL.GetAllBy(new PNK_Product(), "WHERE ID=" + productId + "", null);
                }
            }

            return(dic);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="productId"></param>
        /// <param name="type">==NULL mặc định hình</param>
        /// <param name="type">==1:map</param>
        private void BindData()
        {
            SalesPriceBLL bll = new SalesPriceBLL();

            lst = bll.GetList(ProductId, string.Empty, DateTime.MinValue, DateTime.MinValue, 1, 1000, out total);
            if (lst.Count() > 0)
            {
                grdSalesPrice.DataSource = lst;
                grdSalesPrice.DataBind();
            }
            else
            {
                PNK_SalesPrice pnk = new PNK_SalesPrice();
                DataTable      dt  = Common.UtilityLocal.ObjectToData(pnk);
                grdSalesPrice.DataSource = dt;
                grdSalesPrice.DataBind();

                //grdSalesPrice.Columns[4].Visible = false;
                //foreach (GridViewRow row in grdSalesPrice.Rows)
                //{
                //    if (row.RowType == DataControlRowType.DataRow)
                //    {
                //        LinkButton lb = ((LinkButton)row.FindControl("lnkRemove"));
                //        if (lb != null)
                //        {
                //            lb.Visible = false;
                //        }
                //    }
                //}
            }
        }
コード例 #3
0
        public static Dictionary <string, object> GetProductPrice(string productId, string brandId, DateTime fromDate, DateTime toDate, CultureInfo Ci)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            string                 result = string.Empty;
            SalesPriceBLL          pcBll  = new SalesPriceBLL();
            IList <PNK_SalesPrice> lst    = pcBll.GetList(productId, string.Empty, fromDate, toDate, 1, 9999, out total);
            StringBuilder          sb     = new StringBuilder();

            if (total > 0)
            {
                sb.Append("<span class=\"price text-left center-block\">");
                sb.Append(" <ins><span class=\"woocommerce-Price-amount amount amountdis\">");
                sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", FormatHelper.FormatDonviTinh(DBConvert.ParseDouble(lst[0].DealPrice), enuCostId.dong, Ci));
                //sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", lst[0].DealPrice.ToString("#,###") + " đ");
                sb.Append("</ins>");
                sb.Append("<del>");
                sb.Append("<span class=\"woocommerce-Price-amount amount amountdis\">");
                sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", FormatHelper.FormatDonviTinh(DBConvert.ParseDouble(lst[0].OriginPrice), enuCostId.dong, Ci));
                //sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", lst[0].OriginPrice.ToString("#,###" + " đ"));
                sb.Append("</span>");
                sb.Append("</del>");

                sb.Append("<ins>");
                sb.Append("<span class=\"woocommerce-Price-amount amount amountper\">");
                sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0} %", Convert.ToInt32(((lst[0].OriginPrice - lst[0].DealPrice) / lst[0].OriginPrice) * 100));
                sb.Append("</span>");
                sb.Append("</ins>");
                sb.Append(" </span>");

                dic.Add("isPrice", true);
                dic.Add("isSale", true);
                dic.Add("OriginPrice", lst[0].OriginPrice);
                dic.Add("DealPrice", lst[0].DealPrice);
                dic.Add("UnitPrice", lst[0].UnitPrice);
                //result = string.Format("<div><span>Giá gốc: </span><span style='font-size:11pt;font-weight:bold; text-decoration: line-through;'> {0} VND </span></div><span>Tiết kiệm: </span> <span style='font-size:11pt;font-weight:bold'>{1}%</span>", lst[0].OriginPrice.ToString("#,###"), Convert.ToInt32(((lst[0].OriginPrice - lst[0].DealPrice) / lst[0].OriginPrice) * 100));
            }
            //Lấy giá theo khu vực tỉnh thành
            else
            {
                lst = pcBll.GetList(productId, brandId, DateTime.MinValue, DateTime.MinValue, 1, 1, out total);
                if (lst.Count > 0)
                {
                    sb.Append("<span class=\"price text-left center-block\">");
                    sb.Append(" <ins><span class=\"woocommerce-Price-amount amount amountdis\">");
                    sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", FormatHelper.FormatDonviTinh(DBConvert.ParseDouble(lst[0].DealPrice), enuCostId.dong, Ci));
                    //sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", lst[0].DealPrice.ToString("#,###") + " đ");
                    sb.Append("</ins>");
                    sb.Append("<del>");
                    sb.Append("<span class=\"woocommerce-Price-amount amount amountdis\">");
                    sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", FormatHelper.FormatDonviTinh(DBConvert.ParseDouble(lst[0].OriginPrice), enuCostId.dong, Ci));
                    //sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", lst[0].OriginPrice.ToString("#,###" + " đ"));
                    sb.Append("</span>");
                    sb.Append("</del>");
                    sb.Append("<ins>");
                    sb.Append("<span class=\"woocommerce-Price-amount amount amountper\">");
                    sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0} %", Convert.ToInt32(((lst[0].OriginPrice - lst[0].DealPrice) / lst[0].OriginPrice) * 100));
                    sb.Append("</span>");
                    sb.Append("</ins>");
                    sb.Append(" </span>");

                    dic.Add("isPrice", true);
                    dic.Add("isSale", true);
                    dic.Add("OriginPrice", lst[0].OriginPrice);
                    dic.Add("DealPrice", lst[0].DealPrice);
                    dic.Add("UnitPrice", lst[0].UnitPrice);
                }
                else
                {
                    Generic <PNK_Product> genericBLL = new Generic <PNK_Product>();
                    IList <PNK_Product>   lstProduct = genericBLL.GetAllBy(new PNK_Product(), "WHERE ID=" + productId + "", null);
                    if (lstProduct.Count > 0)
                    {
                        string price = (lstProduct[0].Price == "0" || lstProduct[0].Price == "" || lstProduct[0].Price == null) ? "Call" : FormatHelper.FormatDonviTinh(DBConvert.ParseDouble(lstProduct[0].Price), enuCostId.dong, Ci);

                        sb.Append("<span class=\"price text-center center-block\">");
                        sb.Append(" <ins>");
                        sb.Append("<span class=\"woocommerce-Price-amount amount amountdis\">");
                        sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", price);
                        sb.Append("</ins>");
                        sb.Append("</span>");

                        dic.Add("isPrice", false);
                        dic.Add("isSale", false);
                    }
                    else
                    {
                        sb.Append("<span class=\"woocommerce-Price-amount amount amountper\">");
                        sb.AppendFormat("<span class=\"woocommerce-Price-currencySymbol\"></span>{0}", "Call");
                        sb.Append("</span>");

                        dic.Add("isPrice", true);
                        dic.Add("isSale", true);
                    }
                }
            }

            dic.Add("Price", sb.ToString());

            return(dic);
        }