Ejemplo n.º 1
0
        public ActionResult Edit(long id)
        {
            BCBSClient client = new BCBSClient();
            string customerlist = client.GetcustomerList();
            ContractModel contract = new ContractModel();
            contract.FromDate = DateTime.Now;
            contract.EndDate = DateTime.Now;
            if (!string.IsNullOrEmpty(customerlist))
            {
                ViewBag.Customers = JsonConvert.DeserializeObject<List<CustomerModel>>(customerlist).Select(x => new { x.Id, x.Name });
            }
            else
            {
                ViewBag.Customers = "";
            }

            string projectList = client.GetProjectList();
            if (!string.IsNullOrEmpty(projectList))
            {
                ViewBag.Projects = JsonConvert.DeserializeObject<List<ProjectModel>>(projectList).Select(x => new { x.Id, x.Name });
            }
            else
            {
                ViewBag.Projects = "";
            }
            if (id > 0)
            {
                string ContractData = client.GetcontractById(id);
                if (!string.IsNullOrEmpty(ContractData))
                {
                    contract = JsonConvert.DeserializeObject<ContractModel>(ContractData);
                    string servicelist = client.GetServiceTypesByProjectId(contract.ProjectId);
                    if (!string.IsNullOrEmpty(servicelist))
                    {
                        ViewBag.Services = JsonConvert.DeserializeObject<List<ServiceModel>>(servicelist).Select(x => new { x.Id, x.Name });
                    }
                    else
                    {
                        ViewBag.Services = "";
                    }
                }
                else
                {
                    TempData["Error"] = "Requested contract not available!!";
                    return RedirectToAction("Index", "Contract");
                }
            }

            return View(contract);
        }
Ejemplo n.º 2
0
 //public JsonResult GetFeesTypeByServiceID(string serviceId)
 //{
 //    string feestype = string.Empty;
 //    if (!string.IsNullOrEmpty(serviceId))
 //    {
 //        BCBSClient client = new BCBSClient();
 //        feestype = client.GetServiceFeesTypeByServiceId(Convert.ToInt64(serviceId));
 //    }
 //    return Json(feestype, JsonRequestBehavior.AllowGet);
 //}
 public JsonResult GetServiceTypeByProjectID(string projectId)
 {
     string servicetype = string.Empty;
     if (!string.IsNullOrEmpty(projectId))
     {
         BCBSClient client = new BCBSClient();
         servicetype = client.GetServiceTypesByProjectId(Convert.ToInt64(projectId));
     }
     return Json(servicetype, JsonRequestBehavior.AllowGet);
 }