public JsonResult GetContractForActivity(string customerId,string serviceID,string projectId,string fromMonth,string toMonth) { BCBSClient client = new BCBSClient(); string result = client.GetContractDetailForActivity(Convert.ToInt64(projectId), Convert.ToInt64(serviceID), Convert.ToInt64(customerId),fromMonth,toMonth,DateTime.Now.Year.ToString()); List<ContractInvoiceModel> ContractList = JsonConvert.DeserializeObject<List<ContractInvoiceModel>>(result); return Json(ContractList, JsonRequestBehavior.AllowGet); }
public ActionResult AcknowledgementForm() { BCBSClient client = new BCBSClient(); string customerlist = client.GetcustomerList(); if (!string.IsNullOrEmpty(customerlist)) { ViewBag.Customers = JsonConvert.DeserializeObject<List<CustomerModel>>(customerlist).Select(x => new { x.Id, x.Name }); } else { ViewBag.Customers = ""; } //string servicelist = client.GetServiceTypeList(); //if (!string.IsNullOrEmpty(servicelist)) //{ // ViewBag.Services = JsonConvert.DeserializeObject<List<ServiceModel>>(servicelist).Select(x => new { x.Id, x.Name }); //} //else //{ // ViewBag.Services = ""; //} 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 = ""; } return View(); }
public ActionResult Activities(long? id) { if (id > 0) { BCBSClient client = new BCBSClient(); ViewBag.ContractId = id; } return View(); }
public JsonResult CustomerByServiceAndProjectId(string serviceId, string projectId) { string customers = string.Empty; if ((!string.IsNullOrEmpty(projectId)) && (!string.IsNullOrEmpty(serviceId))) { BCBSClient client = new BCBSClient(); customers = client.GetCustomerByServiceAndProjectId(Convert.ToInt64(serviceId),Convert.ToInt64(projectId)); } return Json(customers, JsonRequestBehavior.AllowGet); }
public JsonResult CheckStatusIsActive(string tableName, string Id) { bool isAvtive = false; if ((!string.IsNullOrEmpty(Id)) && (!string.IsNullOrEmpty(tableName))) { BCBSClient client = new BCBSClient(); isAvtive = client.CheckStausIsActive(Convert.ToInt64(Id), tableName); } return Json(isAvtive, JsonRequestBehavior.AllowGet); }
public JsonResult DeleteContractById(string id) { bool isdeleted = false; if (!string.IsNullOrEmpty(id)) { BCBSClient client = new BCBSClient(); isdeleted = client.DeleteContractById(id); } return Json(isdeleted, JsonRequestBehavior.AllowGet); }
public JsonResult GetContractListbyProjectId(string id) { string result = string.Empty; BCBSClient client = new BCBSClient(); List<ContractListModel> ContractList = new List<ContractListModel>(); result = client.GetcontractListByProjectId(Convert.ToInt64(id)); if (!string.IsNullOrEmpty(result)) { ContractList = JsonConvert.DeserializeObject<List<ContractListModel>>(result).ToList(); } return Json(ContractList, JsonRequestBehavior.AllowGet); }
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); }
public ActionResult AccuralWorkShhet() { ViewBag.currentMonth = DateTime.Now.Month.ToString(); ViewBag.currentYear = DateTime.Now.Year.ToString(); ViewBag.Months = new List<SelectListItem> { new SelectListItem { Text = "January", Value = "1" }, new SelectListItem { Text = "February", Value = "2" }, new SelectListItem { Text = "March", Value = "3" }, new SelectListItem{Text="April",Value="4"}, new SelectListItem{Text="May",Value="5"}, new SelectListItem{Text="June",Value="6"}, new SelectListItem{Text="July",Value="7"}, new SelectListItem{Text="August",Value="8"}, new SelectListItem{Text="September",Value="9"}, new SelectListItem{Text="October",Value="10"}, new SelectListItem{Text="November",Value="11"}, new SelectListItem{Text="December",Value="12"} }; BCBSClient client = new BCBSClient(); string years = client.GetAccuralReportMonthYear(); List<MonthYear> ContractList = new List<MonthYear>(); if (!string.IsNullOrEmpty(years)) { ContractList = JsonConvert.DeserializeObject<List<MonthYear>>(years); int currentexist = ContractList.Where(x => x.Year == DateTime.Now.Year.ToString()).Count(); if (!(currentexist > 0)) { MonthYear monthYear = new MonthYear(); monthYear.Year = DateTime.Now.Year.ToString(); monthYear.Month = ""; ContractList.Add(monthYear); } } else { ContractList = JsonConvert.DeserializeObject<List<MonthYear>>(years); MonthYear monthYear = new MonthYear(); monthYear.Year = DateTime.Now.Year.ToString(); monthYear.Month = ""; ContractList.Add(monthYear); } ViewBag.Years = ContractList.Select(x => new MonthYear { Year = x.Year }); return View(); }
public ActionResult Edit(long id) { ProjectModel project = new ProjectModel(); if (id > 0) { BCBSClient client = new BCBSClient(); string projectData = client.GetProjectById(id); if (!string.IsNullOrEmpty(projectData)) { project = JsonConvert.DeserializeObject<ProjectModel>(projectData); } else { TempData["Error"] = "Requested project not available!!"; return RedirectToAction("Index", "Project"); } } return View(project); }
public ActionResult Edit(long id) { BCBSClient client = new BCBSClient(); ServiceModel serviceType = new ServiceModel(); if (id > 0) { string serviceData = client.GetServiceTypeById(id); if (!string.IsNullOrEmpty(serviceData)) { serviceType = JsonConvert.DeserializeObject<ServiceModel>(serviceData); //string feestype = client.GetServiceFeesTypeByServiceId(id); //List<ServiceFeesTypeModel> servicefeestype = new List<ServiceFeesTypeModel>(); //servicefeestype = JsonConvert.DeserializeObject<List<ServiceFeesTypeModel>>(feestype); //ViewBag.Fees = feestype; } else { TempData["Error"] = "Requested service not available!!"; return RedirectToAction("Index", "Service"); } } 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 = ""; } //string servicelist = client.GetProjectList(); //if (!string.IsNullOrEmpty(servicelist)) //{ // List<ProjectModel> services = new List<ProjectModel>(); // ViewBag.Projects = JsonConvert.DeserializeObject<List<ProjectModel>>(servicelist).Select(x => new { x.Id, x.Name }); //} //else //{ // ViewBag.Projects = null; //} return View(serviceType); }
public ActionResult Edit(ServiceModel serviceType) { if (ModelState.IsValid) { BCBSClient client = new BCBSClient(); long Id = 0; Id = client.UpdateServiceTypeById(serviceType.Id, serviceType.Name,serviceType.ProjectId,serviceType.Status,serviceType.Notes); if (Id > 0) { //if (!string.IsNullOrEmpty(serviceType.FeesType)) //{ // //bool deletefees = client.DeleteServiceFeesTypeByServiceId(Id.ToString()); // //List<string> selectedFees = serviceType.FeesType.Split(',').ToList(); // foreach (string feestype in selectedFees) // { // var fees = feestype.Split('='); // string type = fees[0].ToString(); // double amount = Convert.ToDouble(fees[1].ToString()); // long resultid = client.InsertServiceFeesType(Id, type, amount); // if (!(resultid > 0)) // { // TempData["Error"] = "Service Updating failed..!"; // return RedirectToAction("Index", "Service"); // } // } //} TempData["Message"] = "Service Updated successfully..!"; } else { TempData["Error"] = "Service Update failed..!"; } ModelState.Clear(); return RedirectToAction("Index", "Service"); } else { return View(serviceType); } }
public ActionResult Edit(ProjectModel project) { if (ModelState.IsValid) { BCBSClient client = new BCBSClient(); long Id = 0; Id = client.UpdateProjectById(project.Id, project.Name, project.ChargeCode, project.HighLevelBudget.ToString(), project.Status, project.Description, project.RC, project.GLAccount); if (Id > 0) { TempData["Message"] = "Project Updated successfully..!"; } else { TempData["Error"] = "Project Update failed..!"; } ModelState.Clear(); return RedirectToAction("Index", "Project"); } else { return View(project); } }
public ActionResult New(ContractModel contract, HttpPostedFileBase file) { if (ModelState.IsValid) { BCBSClient client = new BCBSClient(); long Id = 0; string fname = string.Empty; if (file != null && file.ContentLength > 0) { byte[] imgarray; using (var binaryReader = new BinaryReader(Request.Files[0].InputStream)) { imgarray = binaryReader.ReadBytes(Request.Files[0].ContentLength); string logodata = Convert.ToBase64String(imgarray); string lg = "data:image/*;base64," + logodata; } try { // extract only the fielname var fileName = Path.GetFileName(file.FileName); string ext = Path.GetExtension(file.FileName); Guid g = Guid.NewGuid(); fname = g.ToString() + ext; // store the file inside ~/UploadDocuments/uploads folder var path = Path.Combine(Server.MapPath("~/UploadDocuments/Contracts"), fname); file.SaveAs(path); contract.FileName = fname; } catch (Exception ex) { } } Id = client.Insertcontract(contract.CustomerId, contract.ServiceId, contract.FromDate, contract.EndDate, contract.Dirrection, contract.Estimate, contract.Status, contract.Volume, contract.Amount, contract.ProjectId, contract.Description, contract.ContractCode, contract.FileName,contract.FeesType); if (Id > 0) { TempData["Message"] = "Contract Added successfully..!"; } else { TempData["Error"] = "Contract Adding failed..!"; } ModelState.Clear(); return RedirectToAction("Index", "Contract"); } else { return View(contract); } }
public ActionResult New() { BCBSClient client = new BCBSClient(); string customerlist = client.GetcustomerList(); ContractModel contract = new ContractModel(); contract.FromDate = DateTime.Now; contract.EndDate = DateTime.Now; contract.ContractCode = GenerateUniqueContractCode().ToUpper(); if (!string.IsNullOrEmpty(customerlist)) { ViewBag.Customers = JsonConvert.DeserializeObject<List<CustomerModel>>(customerlist).Select(x => new { x.Id, x.Name }); } else { ViewBag.Customers = ""; } //string servicelist = client.GetServiceTypeList(); //if (!string.IsNullOrEmpty(servicelist)) //{ // ViewBag.Services = JsonConvert.DeserializeObject<List<ServiceModel>>(servicelist).Select(x => new { x.Id, x.Name }); //} //else //{ // ViewBag.Services = ""; //} 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 = ""; } return View(contract); }
public JsonResult IsContractCodeExist(string ContractCode) { bool isexist = false; if (!string.IsNullOrEmpty(ContractCode)) { //if (!string.IsNullOrEmpty(existCode)) //{ //if (ChargeCode.ToLower() != existCode.ToLower()) //{ BCBSClient client = new BCBSClient(); isexist = client.CheckIsContractCodeExist(ContractCode); // } //} } return Json(!isexist, JsonRequestBehavior.AllowGet); }
public JsonResult IsActivityCodeExist(string ActivityCode) { bool isexist = false; if (!string.IsNullOrEmpty(ActivityCode)) { BCBSClient client = new BCBSClient(); isexist = client.CheckIsActivityCodeExist(ActivityCode); } return Json(!isexist, JsonRequestBehavior.AllowGet); }
public JsonResult GetServiceTypeByServiceID(string serviceId) { string feestype = string.Empty; if (!string.IsNullOrEmpty(serviceId)) { BCBSClient client = new BCBSClient(); feestype = client.GetServiceTypeById(Convert.ToInt64(serviceId)); } return Json(feestype, JsonRequestBehavior.AllowGet); }
public ActionResult EditActivity(string Id) { BCBSClient client = new BCBSClient(); ActivityModel activity = new ActivityModel(); if (!string.IsNullOrEmpty(Id)) { if (Convert.ToInt64(Id) > 0) { string ActivityData = client.GetActivityById(Convert.ToInt64(Id)); if (!string.IsNullOrEmpty(ActivityData)) { activity = JsonConvert.DeserializeObject<ActivityModel>(ActivityData); ViewBag.AvailableBalance = client.GetContractAvailableBalance(activity.ContractId); } else { TempData["Error"] = "Requested Activity not available!!"; return RedirectToAction("Index", "Contract"); } } else { TempData["Error"] = "Requested Activity not available!!"; return RedirectToAction("Index", "Contract"); } } else { TempData["Error"] = "Requested Activity not available!!"; return RedirectToAction("Index", "Contract"); } return View(activity); }
public ActionResult NewActivity(ActivityModel activity, HttpPostedFileBase file) { if (ModelState.IsValid) { BCBSClient client = new BCBSClient(); string fname = string.Empty; if (file != null && file.ContentLength > 0) { // extract only the fielname var fileName = Path.GetFileName(file.FileName); string ext = Path.GetExtension(file.FileName); Guid g = Guid.NewGuid(); fname = g.ToString() + ext; // store the file inside ~/UploadDocuments/uploads folder var path = Path.Combine(Server.MapPath("~/UploadDocuments/Activity"), fname); file.SaveAs(path); activity.FileName = fname; } long id = client.InsertContractActivity(activity.ContractId, activity.FromDate, activity.EndDate, activity.Volume, activity.Amount, activity.Charges, activity.Estimate, activity.Description, activity.Status, activity.FileName, activity.ContractCode + "-" + activity.ActivityCode); if (id > 0) { TempData["Message"] = "Activity Added successfully..!"; ModelState.Clear(); return RedirectToAction("Activities", "Contract"); } else { TempData["Error"] = "Activity Adding failed..!"; } } return View(activity); }
public JsonResult GetContractList() { try { BCBSClient client = new BCBSClient(); string result = client.GetcontractList(); //List<ContractModel> ContractList = JsonConvert.DeserializeObject<List<ContractModel>>(result); List<ContractListModel> ContractList = JsonConvert.DeserializeObject<List<ContractListModel>>(result); return Json(ContractList, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return Json(ex.Message, JsonRequestBehavior.AllowGet); } }
public ActionResult Invoice(InvoiceViewModel invoiceModel, HttpPostedFileBase file, FormCollection fc) { BCBSClient client = new BCBSClient(); //ModelState.Where(m => m.Key == "CustomerCode").FirstOrDefault().Value.Errors.Clear(); //if (ModelState.IsValid) //{ long Id = 0; string fname = string.Empty; if (file != null && file.ContentLength > 0) { // extract only the fielname var fileName = Path.GetFileName(file.FileName); string ext = Path.GetExtension(file.FileName); Guid g = Guid.NewGuid(); fname = g.ToString() + ext; // store the file inside ~/UploadDocuments/uploads folder var path = Path.Combine(Server.MapPath("~/UploadDocuments/uploads"), fname); file.SaveAs(path); invoiceModel.SupportingDocuments = fname; } //string csv = string.Empty; Id = client.InsertCustomerInvoice(invoiceModel.InvoiceNumber, invoiceModel.CustomerId, invoiceModel.InvoiceDate, invoiceModel.PrepareBy, invoiceModel.PrepareByExt, invoiceModel.AuthorizedBy, invoiceModel.AuthorizedByExt, invoiceModel.Division, invoiceModel.IsDeffered, invoiceModel.DefferedAccount, invoiceModel.FromDate, invoiceModel.ToDate, invoiceModel.SpecialInstuction, invoiceModel.SupportingDocuments, invoiceModel.TotalAmount); if (Id > 0) { //csv += "Invoice Number," + invoiceModel.InvoiceNumber + "\n"; //csv += "Invoice Date," + invoiceModel.InvoiceDate.ToString("MM/dd/yyyy") + "\n"; //csv += "Prepared by," + invoiceModel.PrepareBy + ", Authorized By," + invoiceModel.AuthorizedBy + "\n"; //csv += "Devision," + invoiceModel.Division + "\n\n"; //csv += "Customer Name," + invoiceModel.Customer.Name + "\n"; //csv += "Address\n"; //csv += invoiceModel.Customer.CustomerAddress + " " + invoiceModel.Customer.City + " " + invoiceModel.Customer.State + " " + invoiceModel.Customer.PostalCode + "\n"; //csv += "Contact Name," + invoiceModel.Customer.FirstName + " " + invoiceModel.Customer.LastName + "\n"; //csv += "Phone," + invoiceModel.Customer.Phone + "\n\n"; SBFEmailViewModel sbfemail = new SBFEmailViewModel(); //mailer.SBF(); string fcActivities = fc["Activities"].ToString(); List<string> activities = new List<string>(); if (!string.IsNullOrEmpty(fcActivities)) { bool isbilled = client.SetActivityBilled(fcActivities); if (isbilled) { var activityIds = fcActivities.Split(','); foreach (var x in activityIds) { if (!string.IsNullOrEmpty(x)) { long activityId = Convert.ToInt64(x); long sbfActivityId = client.InsertSBFActivity(Id, activityId); if (sbfActivityId > 0) { activities.Add(activityId.ToString()); continue; } else { break; } } } } } if (activities != null && activities.Count > 0) { string ids = string.Join(",", activities.ToArray()); string result = client.GetActivitiesByActivityIds(ids); List<ActivityListModel> activity = JsonConvert.DeserializeObject<List<ActivityListModel>>(result); if (sbfemail.ActivityList == null) { //csv += "Contract -Activity\n\n"; //csv += "Project Name,Service Type,From Date,End Date,Charges,Value,Amount\n"; sbfemail.ActivityList = new List<ActivityListModel>(); } if (activity != null) { foreach (ActivityListModel x in activity) { string charge = string.Empty; if (x.Charges == true) { charge = "Expense"; } else { charge = "Revenue"; } string estimate = string.Empty; if (x.Estimate == true) { estimate = "Real"; } else { estimate = "Estimate"; } //csv += x.ProjectName + "," + x.Service + "," + x.FromDate.ToString("MM/dd/yyyy") + "," + x.EndDate.ToString("MM/dd/yyyy") + "," + charge + "," + estimate + "," + x.Amount + "\n"; } //csv += ",,,,,Total," + invoiceModel.TotalAmount + "\n\n"; //if (invoiceModel.IsDeffered == true) //{ //csv += "Deffered Account," + invoiceModel.DefferedAccount + "\n"; //} //csv += "From Date," + invoiceModel.FromDate.ToString("MM/dd/yyyy") + ",,End Date," + invoiceModel.ToDate.ToString("MM/dd/yyyy") + "\n"; sbfemail.ActivityList = activity; } } IUserMailer mailer = new UserMailer(); sbfemail.Invoice = invoiceModel; string CustomerData = client.GetcustomerById(invoiceModel.CustomerId); if (!string.IsNullOrEmpty(CustomerData)) { sbfemail.Customer = JsonConvert.DeserializeObject<CustomerModel>(CustomerData); } string ContractData = client.GetcontractById(invoiceModel.ContractId); ContractModel contract = new ContractModel(); if (!string.IsNullOrEmpty(ContractData)) { contract = JsonConvert.DeserializeObject<ContractModel>(ContractData); sbfemail.Contract = contract; } string fileName = "SBF_" + sbfemail.Invoice.InvoiceNumber + "_" + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss"); string excelFileName = CreatExcel(sbfemail, fileName); mailer.SBF(sbfemail, file, "SBF Invoice - BCBS Acc Sys").Send(); if (!string.IsNullOrEmpty(excelFileName)) { string path = Path.Combine(Server.MapPath("~/UploadDocuments/uploads/xlsx"), excelFileName); return File(path, "text/csv", excelFileName); } else { TempData["Message"] = "Customer Invoice generated successfully..!"; //string fileName = "SBF_" + invoiceModel.InvoiceNumber + "_" + DateTime.Now.ToString("MM-dd-yyyy"); // return RedirectToAction("Index", "Customer"); } } else { string fullPath = Request.MapPath("~/UploadDocuments/uploads/" + fname); if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } TempData["Error"] = "Customer Invoice generation failed..!"; return View(invoiceModel); } ModelState.Clear(); //} //else //{ // string customerlist = client.GetcustomerList(); // if (!string.IsNullOrEmpty(customerlist)) // { // ViewBag.Customers = JsonConvert.DeserializeObject<List<CustomerModel>>(customerlist).Select(x => new { x.Id, x.Name }); // } // else // { // ViewBag.Customers = ""; // } // return View(invoiceModel); //} }
public JsonResult GetBalanceForProject(string projectId) { string balance = string.Empty; if (!string.IsNullOrEmpty(projectId)) { BCBSClient client = new BCBSClient(); balance = client.GetProjectAvailableBalance(Convert.ToInt64(projectId)); } return Json(balance, JsonRequestBehavior.AllowGet); }
public ActionResult New() { BCBSClient client = new BCBSClient(); string customerlist = client.GetcustomerList(); string servicelist = client.GetServiceTypeList(); if (!string.IsNullOrEmpty(customerlist)) { ViewBag.Customers = JsonConvert.DeserializeObject<List<CustomerModel>>(customerlist).Select(x => new { x.Id, x.Name }); } else { ViewBag.Customers = ""; } if (!string.IsNullOrEmpty(servicelist)) { ViewBag.Services = JsonConvert.DeserializeObject<List<ServiceModel>>(servicelist).Select(x => new { x.Id, x.Name }); } else { ViewBag.Services = ""; } 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 = ""; } string contractList = client.GetcontractList(); if (!string.IsNullOrEmpty(contractList)) { ViewBag.Contracts = JsonConvert.DeserializeObject<List<ContractModel>>(contractList).Select(x => new { x.Id, x.ContractCode }); } else { ViewBag.Contracts = ""; } ViewBag.Months = new List<SelectListItem> { new SelectListItem { Text = "January", Value = "1" }, new SelectListItem { Text = "February", Value = "2" }, new SelectListItem { Text = "March", Value = "3" }, new SelectListItem{Text="April",Value="4"}, new SelectListItem{Text="May",Value="5"}, new SelectListItem{Text="June",Value="6"}, new SelectListItem{Text="July",Value="7"}, new SelectListItem{Text="August",Value="8"}, new SelectListItem{Text="September",Value="9"}, new SelectListItem{Text="October",Value="10"}, new SelectListItem{Text="November",Value="11"}, new SelectListItem{Text="December",Value="12"} }; string years = client.GetAccuralReportMonthYear(); List<MonthYear> ContractList = new List<MonthYear>(); if (!string.IsNullOrEmpty(years)) { ContractList = JsonConvert.DeserializeObject<List<MonthYear>>(years); int currentexist = ContractList.Where(x => x.Year == DateTime.Now.Year.ToString()).Count(); if (!(currentexist > 0)) { MonthYear monthYear = new MonthYear(); monthYear.Year = DateTime.Now.Year.ToString(); monthYear.Month = ""; ContractList.Add(monthYear); } } else { ContractList = JsonConvert.DeserializeObject<List<MonthYear>>(years); MonthYear monthYear = new MonthYear(); monthYear.Year = DateTime.Now.Year.ToString(); monthYear.Month = ""; ContractList.Add(monthYear); } ViewBag.Years = ContractList.GroupBy(cust => cust.Year).Select(grp => grp.First()); return View(); }
public ActionResult EditActivity(ActivityModel activity) { if (ModelState.IsValid) { BCBSClient client = new BCBSClient(); long Id = 0; Id = client.UpdateContractActivity(activity.Id, activity.ContractId, activity.FromDate, activity.EndDate, activity.Volume, activity.Amount, activity.Charges, activity.Estimate, activity.Description, activity.Status); if (Id > 0) { TempData["Message"] = "Contract Updated successfully..!"; } else { TempData["Error"] = "Contract Update failed..!"; } ModelState.Clear(); return RedirectToAction("Activities", "Contract"); } else { return View(activity); } }
public ActionResult NewActivity(string Id) { ActivityModel activity = new ActivityModel(); activity.FromDate = DateTime.Now; activity.EndDate = DateTime.Now; activity.ActivityCode = GenerateUniqueActivityCode(); if (!string.IsNullOrEmpty(Id)) { BCBSClient client = new BCBSClient(); ContractModel contract = new ContractModel(); string result = client.GetcontractById(Convert.ToInt64(Id)); if (!string.IsNullOrEmpty(result)) { contract = JsonConvert.DeserializeObject<ContractModel>(result); activity.ContractCode = contract.ContractCode; } activity.ContractId = Convert.ToInt64(Id); ViewBag.AvailableBalance = client.GetContractAvailableBalance(Convert.ToInt64(Id)); } return View(activity); }
public JsonResult GetLastContractActivity(string contractId) { try { BCBSClient client = new BCBSClient(); string result = client.GetLastContractActivity(Convert.ToInt64(contractId)); //List<ContractModel> ContractList = JsonConvert.DeserializeObject<List<ContractModel>>(result); ActivityModel activity = JsonConvert.DeserializeObject<ActivityModel>(result); return Json(activity, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return Json(ex.Message, JsonRequestBehavior.AllowGet); } }
//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); }
public string GenerateUniqueContractCode() { string Result = string.Empty; Guid g = Guid.NewGuid(); Result = g.ToString().Substring(0, g.ToString().IndexOf('-')); BCBSClient client = new BCBSClient(); bool isexist = client.CheckIsContractCodeExist(Result); if (isexist) { GenerateUniqueContractCode(); } return Result; }
public ActionResult Edit(ContractModel contract, FormCollection fc) { if (ModelState.IsValid) { BCBSClient client = new BCBSClient(); long Id = 0; string oldDescription = fc["OldDescription"].ToString(); contract.Description += System.Environment.NewLine + System.Environment.NewLine + oldDescription; contract.Description = contract.Description.Replace("'", "''"); Id = client.UpdatecontractById(contract.Id, contract.EndDate, contract.Status, contract.Description); if (Id > 0) { TempData["Message"] = "Contract Updated successfully..!"; } else { TempData["Error"] = "Contract Update failed..!"; } ModelState.Clear(); return RedirectToAction("Index", "Contract"); } else { return View(contract); } }