Ejemplo n.º 1
0
        // GET: Admin/Home
        public ActionResult Index()
        {
            var model = new CMSHomeModels();

            try
            {
                var _Path = HostingEnvironment.MapPath("~/Uploads/Silder/");
                var list  = Directory.GetFiles(_Path).Select(x => Path.GetFileName(x)).ToList();

                if (list != null && list.Count > 0)
                {
                    // var index = 1;
                    for (var i = 0; i < list.Count; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            model.Silder.ImageURL1 = list[i];
                            break;

                        case 1:
                            model.Silder.ImageURL2 = list[i];
                            break;

                        case 2:
                            model.Silder.ImageURL3 = list[i];
                            break;

                        case 3:
                            model.Silder.ImageURL4 = list[i];
                            break;

                        case 4:
                            model.Silder.ImageURL5 = list[i];
                            break;

                        case 5:
                            model.Silder.ImageURL6 = list[i];
                            break;
                        }
                    }
                }


                /* get com info */
                var listCom = _factory.GetList();
                if (listCom != null && listCom.Count > 0)
                {
                    model.ComInfo = listCom.FirstOrDefault();
                }
                else
                {
                    model.ComInfo = new CMS_CompanyModels();
                }
            }
            catch (Exception ex) { }
            return(View(model));
        }
Ejemplo n.º 2
0
        // GET: Clients/Home
        public ActionResult Index()
        {
            try
            {
                ProductViewModels model = new ProductViewModels();

                //Company
                model.Company = _facCom.GetList().FirstOrDefault();

                //Category
                model.ListCate = _facCate.GetList().Where(o => o.ProductTypeCode == (int)Commons.EProductType.Procudure).OrderByDescending(x => x.CreatedDate).Skip(0).Take(3).ToList();

                //Product
                var productType = (byte)Commons.EProductType.Product;
                model.ListProduct = _fac.GetList(productType).Where(o => !string.IsNullOrEmpty(o.ImageURL)).OrderByDescending(x => x.CreatedDate).Skip(0).Take(8).ToList();

                //Procedures
                model.ListProcedures = _facProce.GetList().OrderBy(o => o.CreatedDate).Skip(0).Take(3).ToList();
                //News
                model.ListNews = _facNews.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(3).ToList();
                if (model.ListNews != null && model.ListNews.Any())
                {
                    model.ListNews.ForEach(x =>
                    {
                        if (!string.IsNullOrEmpty(x.ImageURL))
                        {
                            x.ImageURL = "~/Uploads/News/" + x.ImageURL;
                        }
                    });
                }

                model.ListEmployee = _facEmp.GetList().OrderBy(o => o.CreatedDate).Skip(0).Take(10).ToList();
                if (model.ListEmployee != null)
                {
                    model.ListEmployee.ForEach(o =>
                    {
                        o.ImageURL = !string.IsNullOrEmpty(o.ImageURL) ? Commons._PublicImages + "Employees/" + o.ImageURL : Commons._ImageDefault;
                    });
                }

                model.LstDiscount = _facDis.GetList(true);

                return(View(model));
            }
            catch (Exception ex)
            {
                // NSLog.Logger.Error("Index: ", ex);
                return(new HttpStatusCodeResult(400, ex.Message));
            }
        }
Ejemplo n.º 3
0
        // GET: PerfectMoney
        public ActionResult Index(decimal?price)
        {
            PerfectMoneyModel model = new PerfectMoneyModel();

            if (TempData["ErrorMessage"] != null)
            {
                ViewData["ErrorMessage"] = TempData["ErrorMessage"].ToString();
            }
            if (TempData["SuccessMessage"] != null)
            {
                ViewData["SuccessMessage"] = TempData["SuccessMessage"].ToString();
            }
            if (TempData["DataReturnError"] != null)
            {
                model = (PerfectMoneyModel)TempData["DataReturnError"];
                return(View(model));
            }
            try
            {
                List <CMS_DepositTransactionsModel> models = new List <CMS_DepositTransactionsModel>();
                var Config   = fac_C.GetList().Where(x => x.ValueType == (int)Commons.ConfigType.USD).FirstOrDefault();
                var customer = Session["UserC"] as UserSession;
                CMS_DepositTransactionsModel _data = new CMS_DepositTransactionsModel();
                _data.PaymentMethodName = "Perfect money";
                _data.WalletMoney       = Commons.APIType.APIPerfectMonney.ToString();
                _data.ExchangeRate      = Config != null ? Config.Value : 0;
                _data.PayCoin           = price == 0 ? price.Value : price.Value;
                _data.CustomerId        = customer.UserId;
                _data.CustomerName      = customer.UserName;
                _data.DepositNo         = CommonHelper.RandomDepositNo();
                models.Add(_data);
                //Set account information of admin to perfect payment
                var payPerfect = facP.GetList().Where(o => o.ReferenceExchange.Equals((int)Commons.ExchangeType.None)).FirstOrDefault();
                var adminInfo  = fac_Co.GetList().Select(o => o.Name).FirstOrDefault();;
                model.PAYEE_ACCOUNT  = payPerfect.WalletMoney;
                model.PAYEE_NAME     = adminInfo;
                model.PAYMENT_AMOUNT = price == 0 ? price.Value : price.Value;
                model.PAYMENT_AMOUNT = Math.Round(model.PAYMENT_AMOUNT.Value, 2);
                model.PAYMENT_UNITS  = "USD";
                var req = Request.Params.AllKeys;
                var msg = "";
                if (req != null && req.Count() > 0)
                {
                    var Paymnet_Batch_Num = Request.Params["PAYMENT_BATCH_NUM"];
                    if (Paymnet_Batch_Num == "0" && Paymnet_Batch_Num != null)
                    {
                        models[0].Status = (int)Commons.DepositStatus.Cancel;
                        var result = facT.CreateDepositTransaction(models, ref msg, null);
                        NSLog.Logger.Info("Perface_Payment", "Perfect payment Cancel");
                        // cancel
                    }
                    else if (Paymnet_Batch_Num != "0" && Paymnet_Batch_Num != null)
                    {
                        models[0].Status      = (int)Commons.DepositStatus.Completed;
                        models[0].CustomerId  = customer.UserId;
                        models[0].CreatedDate = DateTime.Now;
                        models[0].UpdatedDate = DateTime.Now;;
                        models[0].CreatedBy   = customer.UserName;
                        models[0].PackageSMS  = price.Value;
                        List <string> lstID = new List <string>();
                        lstID.Add(models[0].CustomerId);
                        var result = facT.CreateDepositTransaction(models, ref msg, lstID);
                        //Success change status
                        CMS_DepositTransactionsModel inputModel = new CMS_DepositTransactionsModel();
                        inputModel.UpdatedBy  = CurrentUser.UserId;
                        inputModel.Status     = (int)Commons.DepositStatus.Completed;
                        inputModel.Id         = lstID[0];
                        inputModel.CustomerId = customer.UserId;
                        var outPut = facT.ChangeStatus(inputModel, CurrentUser.UserId);
                    }
                }
            }
            catch (Exception ex)
            {
                NSLog.Logger.Info("Perface_Payment", "Perfect payment no successfully");
            }
            return(View(model));
        }
Ejemplo n.º 4
0
        // GET: Clients/Home
        public ActionResult Index()
        {
            try
            {
                ProductViewModels model = new ProductViewModels();

                //Company
                model.Company = _facCom.GetList().FirstOrDefault();

                //Category
                model.ListCate = _facCate.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(4).ToList();
                if (model.ListCate != null && model.ListCate.Any())
                {
                    model.ListCate.ForEach(x =>
                    {
                        if (!string.IsNullOrEmpty(x.ImageURL))
                        {
                            x.ImageURL = "~/Uploads/Categories/" + x.ImageURL;
                        }
                    });
                }

                //Product
                model.ListProduct = _fac.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(8).ToList();
                var dataImage = _fac.GetListImage();
                if (model.ListProduct != null && model.ListProduct.Any())
                {
                    model.ListProduct.ForEach(x =>
                    {
                        var _Image = dataImage.FirstOrDefault(z => z.ProductId.Equals(x.Id));
                        if (_Image != null)
                        {
                            x.ImageURL = _Image.ImageURL;
                            if (!string.IsNullOrEmpty(x.ImageURL))
                            {
                                x.ImageURL = "~/Uploads/Products/" + x.ImageURL;
                            }
                            else
                            {
                                x.ImageURL = "";
                            }
                        }
                    });
                }

                //News
                model.ListNews = _facNews.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(3).ToList();
                if (model.ListNews != null && model.ListNews.Any())
                {
                    model.ListNews.ForEach(x =>
                    {
                        if (!string.IsNullOrEmpty(x.ImageURL))
                        {
                            x.ImageURL = "~/Uploads/News/" + x.ImageURL;
                        }
                    });
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                // NSLog.Logger.Error("Index: ", ex);
                return(new HttpStatusCodeResult(400, ex.Message));
            }
        }