public ActionResult Category(int id)
        {
            int page = 1;

            if (Request.QueryString["page"] != null)
            {
                page = Convert.ToInt32(Request.QueryString["page"]);
            }
            AnperoService        sv = new AnperoService();
            SearchArticleResults s  = new SearchArticleResults();

            s = sv.SearchArticle(StoreID, TokenKey, id, page, 12, 0);
            ViewData["ArticleList"] = s;
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 14, s.ResultsCount, 11, "?page=");
            //seo
            ViewBag.Description = "Tin tức VinFish - Blog tin chia sẽ các bài viết liên quan đến sản phẩm của VinFish. Các kinh nghiệm, mẹo vắt lựa chọn thực phẩm sạch, cá sạch. Công thức chế biến các món ăn ngon, cá nướng ngon.";
            ViewBag.Keywords    = "Kinh nghiệm lựa chọn thực phẩm sạch, Kinh nghiệm lựa chọn cá sạch, Công thức nấu ăn.";
            ViewBag.WebsiteUrl  = Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host + "/blog";
            if (id == 0)
            {
                ViewBag.CategoryName = "Blog";
                ViewBag.Title        = "Tin tức | VinFish";
            }
            else
            {
                if (s.ItemList.Length > 0)
                {
                    ViewBag.Title        = s.ItemList[0].CategoryName;
                    ViewBag.CategoryName = s.ItemList[0].CategoryName;
                }
            }
            SetUpCommonArticle();
            return(View());
        }
Example #2
0
        public ActionResult Category(int id)
        {
            int page = 1;

            if (Request.QueryString["page"] != null)
            {
                page = Convert.ToInt32(Request.QueryString["page"]);
            }
            AnperoService        sv = new AnperoService();
            SearchArticleResults s  = new SearchArticleResults();

            s = sv.SearchArticle(StoreID, TokenKey, id, page, 12, 0);
            ViewData["ArticleList"] = s;
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 14, s.ResultsCount, 11, "?page=");
            ViewBag.WebsiteUrl      = Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host + "/blog";
            if (id == 0)
            {
                ViewBag.CategoryName = "Blog";
                ViewBag.Title        = "Tin tức";
            }
            else
            {
                if (s.ItemList.Length > 0)
                {
                    ViewBag.Title        = s.ItemList[0].CategoryName;
                    ViewBag.CategoryName = s.ItemList[0].CategoryName;
                }
            }
            SetUpCommonArticle();
            return(View());
        }
        public ActionResult SearchAjax(Models.SearchModel model)
        {
            model.StoreId = StoreID;
            string pageQuery = Request.QueryString["page"];

            WebService.SearchResult rs = new WebService.SearchResult();
            int page = 1;

            if (!string.IsNullOrEmpty(pageQuery))
            {
                page = Convert.ToInt32(pageQuery);
            }
            AnperoService sv = new AnperoService();

            //if (!string.IsNullOrEmpty(model.ParentCategory) && model.ParentCategory!="0")
            //{
            //    rs = sv.GetProductByParentCategory(StoreID, TokenKey, Convert.ToInt32(model.ParentCategory), model.Page, model.PageSize, 0);
            //}
            //else if (!string.IsNullOrEmpty(model.Category) && model.Category != "0")
            //{
            //    rs = sv.GetProductByCategory(StoreID, TokenKey, Convert.ToInt32(model.Category), model.Page, model.PageSize, 0);
            //}
            //else
            //{
            rs = sv.SearchProduct(StoreID, TokenKey, model.Category.ToString(), model.ParentCategory, model.GroupId, model.PriceFrom, model.PriceTo, model.Page, model.PageSize, model.KeyWord, model.SortBy, 0, string.Empty);
            //}
            ViewData["productList"] = rs;
            if (rs != null)
            {
                ViewBag.page = Anpero.Paging.setupAjaxPage(model.Page, model.PageSize, rs.ResultCount, 10, "Search.Products", model.SortBy);
            }
            return(PartialView("SearchAjax"));
        }
Example #4
0
        public ActionResult Category(int id)
        {
            int page = 1;

            if (Request.QueryString["page"] != null)
            {
                page = Convert.ToInt32(Request.QueryString["page"]);
            }
            AnperoService        sv = new AnperoService();
            SearchArticleResults s  = new SearchArticleResults();

            s = sv.SearchArticle(StoreID, TokenKey, id, page, 12, 0);
            ViewData["ArticleList"] = s;
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 14, s.ResultsCount, 11, "?page=");
            //seo

            if (id == 0)
            {
                ViewBag.CategoryName = "";
                ViewBag.Title        = "Tin tức";
            }
            else
            {
                if (s.ItemList.Length > 0)
                {
                    ViewBag.Title        = s.ItemList[0].CategoryName;
                    ViewBag.CategoryName = s.ItemList[0].CategoryName;
                }
            }
            ViewBag.Category = id;
            //  GetTopArticle();
            SetUpCommonArticle();
            return(View());
        }
Example #5
0
        public ActionResult Index(int id)
        {
            SetUpCommonArticle();
            AnperoService ws = new AnperoService();
            BlogItem      rs = ws.GetArticleById(StoreID, TokenKey, id);

            ViewBag.Title           = rs.Title;
            ViewBag.WebsiteUrl      = Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host + Anpero.StringHelpper.GetArticleLink(rs.Title, rs.Id);
            ViewData["blogdeltail"] = rs;
            GetTopArticle();
            return(View());
        }
        public ActionResult Index(int id)
        {
            SetUpCommonArticle();
            AnperoService ws = new AnperoService();
            BlogItem      rs = ws.GetArticleById(StoreID, TokenKey, id);

            ViewBag.Title           = rs.Title;
            ViewData["blogdeltail"] = rs;
            SearchArticleResults s = new SearchArticleResults();

            s = ws.SearchArticle(StoreID, TokenKey, rs.CategoryId, 1, 5, 0);
            ViewData["ArticleList"] = s;
            return(View());
        }
Example #7
0
        public ActionResult AlepayCallback(string transactionCode, string errorCode, string cancel)
        {
            AnperoService ws = new AnperoService();

            PaymentConfig[] pc = ws.GetPaymentAPIConfig(StoreID, TokenKey);
            if (pc != null && pc.Length > 0)
            {
                for (int i = 0; i < pc.Length; i++)
                {
                    if (pc[i].Name.ToUpper() == "AL")
                    {
                        AlepayCheckout checkout          = new AlepayCheckout();
                        var            transactionDetail = checkout.GetTransactionDetail(transactionCode, pc[i].Token, pc[i].ChecksumKey);
                        if (Convert.ToInt32(transactionDetail.code) == 0)
                        {
                            //ResponseCheckOrder result = objNLChecout.GetTransactionDetail(info);
                            string rs = "Giao dịch Thành công, đơn hàng của quý khách đang được xử lý nhanh chóng";
                            rs += "<br>";
                            rs += "Trạng thái: " + transactionDetail.reason;
                            rs += "<br>";
                            rs += "Số tiền thanh toán: " + Anpero.StringHelpper.ConVertToMoneyFormatInt(transactionDetail.amount);
                            rs += "<br>";

                            rs += "Phí thanh toán: " + Anpero.StringHelpper.ConVertToMoneyFormatInt((int)transactionDetail.payerFee);
                            rs += "<br>";
                            rs += "Mã giao dịch Alepay: " + transactionDetail.transactionCode;
                            rs += "<br>";
                            rs += "Mã đơn hàng: " + transactionDetail.orderCode;
                            rs += "<br>";
                            rs += "Tên người thanh toán: " + transactionDetail.buyerName;
                            rs += "<br>";
                            rs += "Số điện thoại: " + transactionDetail.buyerPhone;
                            rs += "<br>";
                            rs += "Chu kỳ trả góp: " + transactionDetail.month;
                            rs += "<br>";
                            rs += "Tên ngân hàng trả góp: " + transactionDetail.bankName;


                            //update and add cash book
                            ws.UpdateOrderStatus(StoreID, TokenKey, Convert.ToInt32(transactionDetail.orderCode), Convert.ToInt32(transactionDetail.amount), "Alepay (Mã giao dịch " + transactionDetail.transactionCode + ")<br />" + rs);
                            ViewBag.Msg = rs;
                        }
                    }
                }
            }

            return(View("Index"));
        }
        public ActionResult Checkout()
        {
            AnperoService ws = new AnperoService();

            PaymentConfig[] pa = ws.GetPaymentAPIConfig(StoreID, TokenKey);
            if (pa != null && pa.Length > 0)
            {
                for (int i = 0; i < pa.Length; i++)
                {
                    if (pa[i].Isdefault && pa[i].PaymentCode.ToUpper() == "NL")
                    {
                        ViewBag.PaymentType = "NL";
                    }
                }
            }
            return(View());
        }
Example #9
0
        public InstallmentModel GetInstallmentInfo(double amount)
        {
            AnperoService ws = new AnperoService();

            PaymentConfig[] pc = ws.GetPaymentAPIConfig(StoreID, TokenKey);

            if (pc != null && pc.Length > 0)
            {
                for (int i = 0; i < pc.Length; i++)
                {
                    if (pc[i].Name.ToUpper() == "AL")
                    {
                        AlepayCheckout checkout = new AlepayCheckout();
                        return(checkout.GetInstallmentInfo(amount, pc[i].Token, pc[i].ChecksumKey));
                    }
                }
            }
            return(null);
        }
Example #10
0
        public ActionResult NLCallback(String Token)
        {
            AnperoService ws = new AnperoService();

            PaymentConfig[] pc = ws.GetPaymentAPIConfig(StoreID, TokenKey);
            if (pc != null && pc.Length > 0)
            {
                for (int i = 0; i < pc.Length; i++)
                {
                    if (pc[i].Name.ToUpper() == "NL")
                    {
                        RequestCheckOrder info = new RequestCheckOrder();
                        //for test
                        //info.Merchant_id = "24338";
                        //info.Merchant_password = "******";
                        info.Merchant_id       = pc[i].MerchantId;
                        info.Merchant_password = pc[i].MerchantPassword;
                        info.Token             = Token;
                        APICheckoutV3      objNLChecout = new APICheckoutV3();
                        ResponseCheckOrder result       = objNLChecout.GetTransactionDetail(info);
                        string             rs           = "Giao dịch Thành công, đơn hàng của quý khách đang được xử lý nhanh chóng";
                        rs += result.description;
                        rs += "<br>";
                        rs += "Số tiền thanh toán: " + result.paymentAmount;
                        rs += "<br>";
                        rs += "Mã giao dịch Ngân Lượng: " + result.transactionId;
                        rs += "<br>";
                        rs += "Mã đơn hàng: " + result.order_code;
                        rs += "<br>";
                        rs += "Tên người thanh toán: " + result.payerName;
                        //update and add cash book
                        ws.UpdateOrderStatus(StoreID, TokenKey, Convert.ToInt32(result.order_code), Convert.ToInt32(result.paymentAmount), "Ngân Lượng (Mã giao dịch Ngân Lượng " + result.transactionId + ")<br />" + rs);
                        ViewBag.Msg = rs;
                    }
                }
            }

            return(View("Index"));
        }
        public void ProcessRequest(HttpContext context)
        {
            string rs = "0";

            try
            {
                string op      = context.Request["op"].ToLower();
                string captcha = context.Request["captcha"];
                int    price   = Convert.ToInt32(context.Request["price"].Replace(@".", string.Empty).Replace(@".", string.Empty));
                int    orderId = Convert.ToInt32(context.Request["orderId"].Replace(@",", string.Empty));

                string name       = context.Request["name"];
                string shipingFee = context.Request["shipingFee"];
                string email      = context.Request["email"];
                string phone      = context.Request["phone"];

                Boolean valid = true;

                if (price <= 0 || orderId <= 0)
                {
                    valid = false;
                    rs    = "Tiền thanh toán không hợp lệ";
                }
                if (String.IsNullOrEmpty(captcha) && valid)
                {
                    valid = false;
                    rs    = "Vui lòng click vào ô kiểm tra";
                }
                if (valid)
                {
                    AnperoService   ws       = new AnperoService();
                    int             st       = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["storeID"]);
                    string          TokenKey = System.Configuration.ConfigurationManager.AppSettings["storeTokenKey"];
                    PaymentConfig[] pa       = ws.GetPaymentAPIConfig(st, TokenKey);
                    switch (op.ToUpper())
                    {
                    case "LN":

                        if (pa != null && pa.Length > 0)
                        {
                            for (int i = 0; i < pa.Length; i++)
                            {
                                if (pa[i].Isdefault && pa[i].PaymentCode.ToUpper() == "NL")
                                {
                                    string payment_method    = context.Request["payment_method"];
                                    string str_bankcode      = context.Request["bankcode"];
                                    string order_description = context.Request["detail"];
                                    string DomainName        = HttpContext.Current.Request.Url.Scheme + @"://" + HttpContext.Current.Request.Url.Host;


                                    Anpero.PaymentApi.NganLuong.RequestInfo info = new Anpero.PaymentApi.NganLuong.RequestInfo();
                                    info.Merchant_id       = pa[i].MerchantId.ToString();
                                    info.Merchant_password = pa[i].MerchantPassword;

                                    //info.Merchant_id = "24338";
                                    //info.Merchant_password = "******";

                                    info.Receiver_email = pa[i].Email;

                                    info.cur_code  = "vnd";
                                    info.bank_code = str_bankcode;

                                    info.Order_code        = orderId.ToString();
                                    info.Total_amount      = price.ToString();
                                    info.fee_shipping      = "0";
                                    info.Discount_amount   = "0";
                                    info.order_description = order_description;
                                    info.return_url        = DomainName + "/API/NLCallback";
                                    info.cancel_url        = DomainName + "/API/NLCancel";

                                    info.Buyer_fullname = name;
                                    info.Buyer_email    = email;
                                    info.Buyer_mobile   = phone;

                                    APICheckoutV3 objNLChecout = new APICheckoutV3();
                                    ResponseInfo  result       = objNLChecout.GetUrlCheckout(info, payment_method);

                                    if (result.Error_code == "00")
                                    {
                                        rs = result.Checkout_url;
                                    }
                                    else
                                    {
                                        rs = result.Description + " (" + result.Description + ")";
                                    }
                                }
                            }
                        }
                        break;

                    case "AL2":
                        if (pa != null && pa.Length > 0)
                        {
                            for (int i = 0; i < pa.Length; i++)
                            {
                                if (pa[i].Isdefault && pa[i].PaymentCode.ToUpper() == "AL")
                                {
                                    string order_description = context.Request["detail"];
                                    string DomainName        = HttpContext.Current.Request.Url.Scheme + @"://" + HttpContext.Current.Request.Url.Host;
                                    //DomainName = "https://demo3.anpero.com";

                                    AlepayCheckout client            = new AlepayCheckout();
                                    AlepayInstallmentOrderModel data = new AlepayInstallmentOrderModel();
                                    //AlepayOrderModel data = new AlepayOrderModel();
                                    int month = 0;
                                    int.TryParse(context.Request["month"], out month);
                                    data.paymentMethod = context.Request["paymentMethod"];
                                    if (month != 0)
                                    {
                                        data.month = month;
                                    }
                                    data.bankCode = context.Request["bankCode"];

                                    data.amount           = Convert.ToInt32(price);
                                    data.tokenKey         = pa[i].Token;
                                    data.checkoutType     = 2;
                                    data.returnUrl        = DomainName + "/API/AlepayCallback";
                                    data.orderCode        = orderId.ToString();
                                    data.orderDescription = order_description;
                                    data.cancelUrl        = DomainName + "/API/NLCancel";
                                    data.buyerEmail       = email;
                                    data.buyerName        = name;
                                    data.buyerAddress     = context.Request["Address"];
                                    data.buyerCountry     = "Viet Nam";
                                    data.buyerCity        = "Viet Nam";
                                    data.buyerPhone       = phone;
                                    data.customMerchantId = orderId.ToString();
                                    data.allowDomestic    = false;
                                    data.installment      = true;
                                    AlepayUltil alepayUltil = new AlepayUltil();
                                    data.signature = alepayUltil.GetSignature(data, pa[i].ChecksumKey);
                                    var postData = client.GetRedirectUrl(data);
                                    if (!string.IsNullOrEmpty(postData.code) && Convert.ToInt32(postData.code) == 0)
                                    {
                                        rs = postData.checkoutUrl;
                                    }
                                    else
                                    {
                                        rs = postData.message;
                                    }
                                }
                            }
                        }
                        break;

                    case "AL":
                        if (pa != null && pa.Length > 0)
                        {
                            for (int i = 0; i < pa.Length; i++)
                            {
                                if (pa[i].Isdefault && pa[i].PaymentCode.ToUpper() == "AL")
                                {
                                    string order_description = context.Request["detail"];
                                    string DomainName        = HttpContext.Current.Request.Url.Scheme + @"://" + HttpContext.Current.Request.Url.Host;
                                    //DomainName = "https://demo3.anpero.com";

                                    AlepayCheckout   client = new AlepayCheckout();
                                    AlepayOrderModel data   = new AlepayOrderModel();


                                    data.amount           = Convert.ToInt32(price);
                                    data.tokenKey         = pa[i].Token;
                                    data.checkoutType     = 4;
                                    data.returnUrl        = DomainName + "/API/AlepayCallback";
                                    data.orderCode        = orderId.ToString();
                                    data.orderDescription = order_description;
                                    data.cancelUrl        = DomainName + "/API/NLCancel";
                                    data.buyerEmail       = email;
                                    data.buyerName        = name;
                                    data.buyerAddress     = context.Request["Address"];
                                    data.buyerCountry     = "Viet Nam";
                                    data.buyerCity        = "Viet Nam";
                                    data.buyerPhone       = phone;
                                    data.customMerchantId = orderId.ToString();
                                    data.allowDomestic    = true;
                                    AlepayUltil alepayUltil = new AlepayUltil();
                                    data.signature = alepayUltil.GetSignature(data, pa[i].ChecksumKey);
                                    var postData = client.GetRedirectUrl(data);
                                    if (!string.IsNullOrEmpty(postData.code) && Convert.ToInt32(postData.code) == 0)
                                    {
                                        rs = postData.checkoutUrl;
                                    }
                                    else
                                    {
                                        rs = postData.message;
                                    }
                                }
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
            }


            context.Response.ContentType = "text/plain";
            context.Response.Write(rs);
        }
        public void ProcessRequest(HttpContext context)
        {
            string rs = "0";

            try
            {
                string op      = context.Request["op"].ToLower();
                string captcha = context.Request["captcha"];
                int    price   = Convert.ToInt32(context.Request["price"].Replace(@".", string.Empty).Replace(@".", string.Empty));
                int    orderId = Convert.ToInt32(context.Request["orderId"].Replace(@",", string.Empty));

                string name       = context.Request["name"];
                string shipingFee = context.Request["shipingFee"];
                string email      = context.Request["email"];
                string phone      = context.Request["phone"];

                Boolean valid = true;
                if (price <= 0 || orderId <= 0)
                {
                    valid = false;
                    rs    = "Tiền thanh toán không hợp lệ";
                }
                if (String.IsNullOrEmpty(captcha) && valid)
                {
                    valid = false;
                    rs    = "Vui lòng click vào ô kiểm tra";
                }
                if (valid)
                {
                    switch (op)
                    {
                    case "nlcheckout":
                        AnperoService   ws       = new AnperoService();
                        int             st       = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["storeID"]);
                        string          TokenKey = System.Configuration.ConfigurationManager.AppSettings["storeTokenKey"];
                        PaymentConfig[] pa       = ws.GetPaymentAPIConfig(st, TokenKey);
                        if (pa != null && pa.Length > 0)
                        {
                            for (int i = 0; i < pa.Length; i++)
                            {
                                if (pa[i].Isdefault && pa[i].PaymentCode.ToUpper() == "NL")
                                {
                                    string payment_method    = context.Request["payment_method"];
                                    string str_bankcode      = context.Request["bankcode"];
                                    string order_description = context.Request["detail"];
                                    string DomainName        = HttpContext.Current.Request.Url.Scheme + @"://" + HttpContext.Current.Request.Url.Host;

                                    Anpero.PaymentApi.NganLuong.RequestInfo info = new Anpero.PaymentApi.NganLuong.RequestInfo();
                                    //info.Merchant_id = pa[i].MerchantId.ToString();
                                    //info.Merchant_password = pa[i].MerchantPassword;

                                    info.Merchant_id       = "24338";
                                    info.Merchant_password = "******";

                                    info.Receiver_email = pa[i].Email;

                                    info.cur_code  = "vnd";
                                    info.bank_code = str_bankcode;

                                    info.Order_code        = orderId.ToString();
                                    info.Total_amount      = price.ToString();
                                    info.fee_shipping      = "0";
                                    info.Discount_amount   = "0";
                                    info.order_description = order_description;
                                    info.return_url        = DomainName + "/API/NLCallback";
                                    info.cancel_url        = DomainName + "/API/NLCancel";

                                    info.Buyer_fullname = name;
                                    info.Buyer_email    = email;
                                    info.Buyer_mobile   = phone;

                                    APICheckoutV3 objNLChecout = new APICheckoutV3();
                                    ResponseInfo  result       = objNLChecout.GetUrlCheckout(info, payment_method);

                                    if (result.Error_code == "00")
                                    {
                                        rs = result.Checkout_url;
                                    }
                                    else
                                    {
                                        rs = result.Description + " (" + result.Description + ")";
                                    }
                                }
                            }
                        }

                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
            }


            context.Response.ContentType = "text/plain";
            context.Response.Write(rs);
        }