Ejemplo n.º 1
0
        public ActionResult SendBackLinkSms()
        {
            try
            {
                string   message        = @"کاربر گرامی وب سایت راش وب، برای تمدید بک لینک به وب سایت راش وب مراجعه نمایید";
                DateTime threeDaysAgo   = DateTime.Now.Date.AddDays(+3);
                Guid     backLinkTypeId = new Guid("D2C2BF40-DAA8-41E5-A68C-859526DEC369");

                List <OrderDetailInformation> orderDetailInfo = db.OrderDetailInformations.Where(current => current.Product.ProductTypeId == backLinkTypeId &&
                                                                                                 current.IsActive && !current.IsDeleted &&
                                                                                                 DbFunctions.TruncateTime(current.FinishDate) == threeDaysAgo.Date
                                                                                                 ).ToList();
                foreach (var item in orderDetailInfo)
                {
                    Order order = db.Orders.Where(current => current.IsActive && !current.IsDeleted &&
                                                  current.Id == item.OrderDetail.OrderId
                                                  ).FirstOrDefault();

                    SendSms.SendCommonSms(order.User.CellNum, message);
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public ActionResult Edit(Product product, HttpPostedFileBase fileupload)
        {
            if (ModelState.IsValid)
            {
                #region Upload and resize image if needed
                if (fileupload != null)
                {
                    string filename    = Path.GetFileName(fileupload.FileName);
                    string newFilename = Guid.NewGuid().ToString().Replace("-", string.Empty)
                                         + Path.GetExtension(filename);

                    string newFilenameUrl   = "/Uploads/product/" + newFilename;
                    string physicalFilename = Server.MapPath(newFilenameUrl);
                    fileupload.SaveAs(physicalFilename);
                    product.ImageUrl = newFilenameUrl;
                }
                #endregion
                //Guid userId = new Guid(User.Identity.Name);
                //Seller seller = db.Sellers.Where(current => current.UserId == userId).FirstOrDefault();
                //product.Seller = seller;
                product.IsDeleted       = false;
                product.IsActive        = false;
                product.IsInHome        = false;
                db.Entry(product).State = EntityState.Modified;
                db.SaveChanges();
                string msg = "محصول کد " + product.Code + " در وب سایت آرتبللو ویرایش شد";
                SendSms.SendCommonSms("09123964937", msg);
                return(RedirectToAction("Index"));
            }
            ViewBag.ProductColorId       = new SelectList(db.ProductColors, "Id", "Title", product.ProductColorId);
            ViewBag.ProductGroupId       = new SelectList(db.ProductGroups, "Id", "Title", product.ProductGroupId);
            ViewBag.ProductMediumId      = new SelectList(db.ProductMediums, "Id", "Title", product.ProductMediumId);
            ViewBag.ProductOrientationId = new SelectList(db.ProductOrientations, "Id", "Title", product.ProductOrientationId);
            ViewBag.ProductThemeId       = new SelectList(db.ProductThemes, "Id", "Title", product.ProductThemeId);
            ViewBag.ProductTypeId        = new SelectList(db.ProductTypes, "Id", "Title", product.ProductTypeId);
            //ViewBag.SellerId = new SelectList(db.Sellers, "Id", "Title", product.SellerId);
            return(View(product));
        }
Ejemplo n.º 3
0
        public ActionResult SendPublishMessage(string orderDetailInfoId)
        {
            try
            {
                Guid id = new Guid(orderDetailInfoId);

                OrderDetailInformation orderDetailInformation = db.OrderDetailInformations.Find(id);

                if (orderDetailInformation == null)
                {
                    return(Json("false", JsonRequestBehavior.AllowGet));
                }


                if (string.IsNullOrEmpty(orderDetailInformation.PublishLink))
                {
                    return(Json("notPublished", JsonRequestBehavior.AllowGet));
                }


                string msg = "کاربر گرامی رپورتاژ شما در وب سایت " +
                             GetReportageNameByProductId(orderDetailInformation) + " منتشر شد. راش وب";


                SendSms.SendCommonSms(orderDetailInformation.OrderDetail.Order.User.CellNum, msg);

                orderDetailInformation.IsSendPublishSms = true;
                db.SaveChanges();

                return(Json("true", JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json("false", JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 4
0
        public ActionResult CallBack(string authority, string status)
        {
            String            Status   = status;
            CallBackViewModel callBack = new CallBackViewModel()
            {
                Menu       = menuHelper.ReturnMenu(),
                FooterLink = menuHelper.GetFooterLink()
            };

            if (Status != "OK")
            {
                callBack.IsSuccess = false;
            }

            else
            {
                try
                {
                    var zarinpal = ZarinPal.ZarinPal.Get();
                    zarinpal.DisableSandboxMode();
                    String Authority = authority;
                    long   Amount    = GetAmountByAuthority(Authority);

                    var verificationRequest  = new ZarinPal.PaymentVerification(MerchantId, Amount, Authority);
                    var verificationResponse = zarinpal.InvokePaymentVerification(verificationRequest);
                    if (verificationResponse.Status == 100 || verificationResponse.Status == 101)
                    {
                        Order order = GetOrderByAuthority(authority);
                        if (order != null)
                        {
                            order.IsPaid      = true;
                            order.PaymentDate = DateTime.Now;
                            order.RefId       = verificationResponse.RefID;

                            db.SaveChanges();

                            callBack.IsSuccess  = true;
                            callBack.OrderCode  = order.Code.ToString();
                            callBack.RefrenceId = verificationResponse.RefID;

                            // UpdateUserPoint(order);

                            OrderDetail orderDetail = db.OrderDetails.FirstOrDefault(current => current.OrderId == order.Id);

                            if (orderDetail != null)
                            {
                                Product product = db.Products.Find(orderDetail.ProductId);

                                if (product != null)
                                {
                                    User   user    = db.Users.Find(order.UserId);
                                    string message = "سفارش شما با شماره پیگیری " + callBack.RefrenceId + " در وب سایت راش وب ثبت گردید ";
                                    SendSms.SendCommonSms(user.CellNum, message);
                                    List <User> admins = db.Users.Where(current => current.IsActive && !current.IsDeleted && current.Role.Name == "Administrator").ToList();
                                    foreach (User admin in admins)
                                    {
                                        message = "یک سفارش با کد " + order.Code + " در وب سایت راش وب ثبت شده است.";
                                        SendSms.SendCommonSms(admin.CellNum, message);
                                    }
                                    //ViewBag.Email = order.DeliverEmail;

                                    //CreateEmail(order.Email, fileLink, orderType);
                                }
                            }
                        }
                        else
                        {
                            callBack.IsSuccess  = false;
                            callBack.RefrenceId = "سفارش پیدا نشد";
                        }
                    }
                    else
                    {
                        callBack.IsSuccess  = false;
                        callBack.RefrenceId = verificationResponse.Status.ToString();
                    }
                }
                catch (Exception e)
                {
                    callBack.IsSuccess  = false;
                    callBack.RefrenceId = "خطا سیستمی. لطفا با پشتیبانی سایت تماس بگیرید";
                }
            }
            return(View(callBack));
        }