public ActionResult EditCreditVolume(CreditVolumesModel model)
 {
     if (ModelState.IsValid)
     {
         CreditVolumeRepository.Update(model);
         return RedirectToAction("AddCredit");
     }
     model.ProcessorTypes = GetProcessors();
     return PartialView("EditCredit", model);
 }
 public ActionResult AddCredit(CreditVolumesModel model)
 {
     if (ModelState.IsValid)
     {
         CreditVolumeRepository.Add(model);
         return RedirectToAction("AddCredit");
     }
     /*model.ProcessorTypes = GetProcessors();
      model.ListMonths = GetMonths();
      model.ListYears = GetYears();
      model.ProcessorByMerchants = GetProcessorByMerchants();*/
     return PartialView("AddCredit", model);
 }
        public static void Add(CreditVolumesModel model)
        {
            var data = GetAll();

            if (model.creditcardActivityId == 0)
            {
                if (data.Count > 0)
                    model.creditcardActivityId = data.Max(a => a.creditcardActivityId) + 1;
                else
                    model.creditcardActivityId = 100000;
            }
            model.isActive = 1;
            data.Add(model);
            HttpContext.Current.Session[SessionCreditVolumesModelList] = data;
        }
 public static void Update(CreditVolumesModel model)
 {
     Delete(model.creditcardActivityId);
     Add(model);
     //var data = GetOwnersFromSession();
     //var oUpdate=  data.Where(a => a.OwnerId == owner.OwnerId).FirstOrDefault();
     //oUpdate.OwnerLastName = owner.OwnerLastName;
     //oUpdate.OwnerFirstName= owner.OwnerFirstName;
     //oUpdate.OwnerFirstName = owner.OwnerFirstName;
     //HttpContext.Current.Session[SessionOwnerList] = data;
 }
        public ActionResult Index(CreditVolumesModel model, FormCollection obj, string submit)
        {
            if (ModelState.IsValid)
            {
                List<CreditVolumesModel> volume = CreditVolumeRepository.GetAll();
                var apiMethod = "";
                var counts = volume.GroupBy(x => x.processorId)
                      .Select(g => g.Count());

                var isValid4Monts = false;
                foreach (var c in counts)
                {
                    isValid4Monts = true;
                    if (c < 4)
                    {
                        isValid4Monts = false;
                        break;
                    }
                }

                if (!CheckProcessorDetails(volume))
                {
                    ModelState.AddModelError("Err", "Please enter processor information of all the processors");
                    //    TempData["SuccessMsg"] = "Please enter processor information of all the processors";
                }
                else if (!isValid4Monts)
                {
                    ModelState.AddModelError("Err", "Please enter 4 months data");
                }
                else
                {
                    if (submit == "Save")
                    {
                        apiMethod = string.Format("merchants/profiles/create?merchantid={0}&iscompleted={1}&contractid={2}", CurrentMerchantID, 0, ContractID);
                        BaseApiData.PostAPIData<List<CreditVolumesModel>>(apiMethod, volume);
                        TempData["SuccessMsg"] = "Data Updated.";
                    }
                    else if (submit == "Complete")
                    {
                        apiMethod = string.Format("merchants/profiles/create?merchantid={0}&iscompleted={1}&contractid={2}", CurrentMerchantID, 0, ContractID);
                        BaseApiData.PostAPIData<List<CreditVolumesModel>>(apiMethod, volume);

                        string apiData = string.Format("Contracts/CompContractTask?merchantId={0}&taskTypeId={1}&workflowId={2}&contractId={3}",
            CurrentMerchantID, (int)TaskTypes.PQMonthlyCreditCardVolumes, 1, ContractID);
                        BaseApiData.GetAPIResult<object>(apiData, () => new object());
                        //  TempData["SuccessMsg"] = "Data Updated.";
                        base.SetSuccessMessage("Data Updated.");
                    }
                    else if (submit == "Decline")
                    {
                        //apiMethod = string.Format("merchants/profiles/create?merchantid={0}&iscompleted=1", CurrentMerchantID);
                        // BaseApiData.PostAPIData<List<CreditVolumesModel>>(apiMethod, volume);
                        base.SetSuccessMessage("Data Updated.");
                        //    TempData["SuccessMsg"] = "Data Updated.";
                    }
                    return RedirectToAction("Index");

                }
            }

            model.ProcessorByMerchants = GetProcessorByMerchants();
            model.ProcessorTypes = GetProcessors();

            return View("Index", model);
        }