public ActionResult Edit(EditCart editCart, string notices) { try { var old = Carts.GetByID(editCart.ID); Cart cart = new Cart { ID = editCart.ID, CartStatus = editCart.CartStatus, SendStatus = editCart.SendStatus, SendDate = editCart.SendDate, DeliveryDate = editCart.DeliveryDate, ConfirmationStatus = editCart.ConfirmationStatus, ConfirmationDate = editCart.ConfirmationDate, BillNumber = editCart.BillNumber, Description = editCart.Description, LastUpdate = DateTime.Now, }; SaveNotes(editCart, editCart.ID, UserID); ViewBag.Success = true; Carts.UpdateByAdmin(cart); #region User Info var user = OSUsers.GetByID(old.UserID); #endregion User Info if (notices == "on") { #region Send Messages // تاییدیه مالی if (old.ConfirmationStatus != ConfirmationStatus.Approved && editCart.ConfirmationStatus == ConfirmationStatus.Approved) { SMSServices.FinancialConfirmation(user.Firstname, user.Lastname, user.Mobile, user.Id); EmailServices.FinancialConfirmation(user.Firstname, user.Lastname, user.Email, user.Id); } // بررسی شده if (old.SendStatus == SendStatus.NotChecked && cart.SendStatus == SendStatus.Checked) { SMSServices.CheckeProduct(user.Firstname, user.Lastname, user.Mobile, user.Id); EmailServices.CheckeProduct(user.Firstname, user.Lastname, user.Email, user.Id); } // ارسال کالا if (old.SendStatus == SendStatus.Checked && cart.SendStatus == SendStatus.Sent) { SMSServices.SendProduct(user.Firstname, user.Lastname, user.Mobile, user.Id, editCart.BillNumber); EmailServices.SendProduct(user.Firstname, user.Lastname, user.Email, user.Id, editCart.BillNumber); } // تحویل کالا if (old.SendStatus != SendStatus.Delivered && cart.SendStatus == SendStatus.Delivered) { SMSServices.DliverProduct(user.Firstname, user.Lastname, user.Mobile, user.Id); EmailServices.DliverProduct(user.Firstname, user.Lastname, user.Email, user.Id); } #endregion Send Messages } } catch (Exception ex) { SetErrors(ex); } return(RedirectToAction("Index")); }