public async Task <ActionResult> Edit(CallDetailsModel Appointment) { if (ModelState.IsValid) { var response = await _centerRepo.EditCallAppointment(Appointment); TempData["response"] = response; return(RedirectToAction("Index")); } else { var filter = new FilterModel { CompId = CurrentUser.CompanyId }; Appointment.BrandList = new SelectList(_dropdown.BindBrand(CurrentUser.CompanyId), "Value", "Text"); Appointment.CategoryList = new SelectList(_dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text"); Appointment.ProductList = new SelectList(_dropdown.BindProduct(Appointment.DeviceBrandId), "Value", "Text"); Appointment.ServiceTypeList = new SelectList(await CommonModel.GetServiceType(filter), "Value", "Text"); Appointment.DeliveryTypeList = new SelectList(await CommonModel.GetDeliveryServiceType(filter), "Value", "Text"); Appointment.CustomerTypeList = new SelectList(await CommonModel.GetLookup("Customer Type"), "Value", "Text"); Appointment.ConditionList = new SelectList(await CommonModel.GetLookup("Device Condition"), "Value", "Text"); Appointment.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "Value", "Text"); Appointment.CountryList = new SelectList(_dropdown.BindCountry(), "Value", "Text"); Appointment.StatusList = new SelectList(_dropdown.BindCallStatusNew(), "Value", "Text"); return(View(Appointment)); } }
public async Task <ActionResult> Create() { var filter = new FilterModel { CompId = CurrentUser.CompanyId, IsExport = false }; // var Newcalls = await _customerSupport.GetASPCalls(filter); var Newcalls = new CallDetailsModel(); Newcalls.ServiceTypeList = new SelectList(await CommonModel.GetServiceType(filter), "Value", "Text"); // IsAssingedCall = true, Newcalls.DeliveryTypeList = new SelectList(await CommonModel.GetDeliveryServiceType(filter), "Value", "Text"); Newcalls.BrandList = new SelectList(_dropdown.BindBrand(CurrentUser.CompanyId), "Value", "Text"); Newcalls.CategoryList = new SelectList(_dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text"); Newcalls.SubCategoryList = new SelectList(Enumerable.Empty <SelectListItem>()); Newcalls.ProductList = new SelectList(Enumerable.Empty <SelectListItem>()); Newcalls.CustomerTypeList = new SelectList(await CommonModel.GetLookup("Customer Type"), "Value", "Text"); Newcalls.ConditionList = new SelectList(await CommonModel.GetLookup("Device Condition"), "Value", "Text"); // calls.IsClient = IsClient, Newcalls.StatusList = new SelectList(await CommonModel.GetStatusTypes("Customer support"), "Value", "Text"); Newcalls.AddressTypelist = new SelectList(await CommonModel.GetLookup("ADDRESS"), "Value", "Text"); Newcalls.LocationList = new SelectList(Enumerable.Empty <SelectListItem>()); //Newcalls.ClientId = 101; Newcalls.DataSourceId = 102; return(View(Newcalls)); }
public async Task <ActionResult> Index() { ViewBag.PageNumber = (Request.QueryString["grid-page"] == null) ? "1" : Request.QueryString["grid-page"]; bool IsClient = false; var filter = new FilterModel { CompId = CurrentUser.CompanyId }; if (CurrentUser.UserTypeName.ToLower().Contains("client")) { filter.ClientId = CurrentUser.RefKey; filter.RefKey = CurrentUser.RefKey; IsClient = true; } var clientData = new MainClientDataModel(); var serviceType = await CommonModel.GetServiceType(filter); var deliveryType = await CommonModel.GetDeliveryServiceType(filter); clientData.Client = new FileDetailModel(); clientData.Client.IsClient = IsClient; clientData.Client.ClientId = filter.ClientId; clientData.Client.ClientList = new SelectList(await CommonModel.GetClientData(CurrentUser.CompanyId), "Name", "Text"); clientData.Client.ServiceTypeList = new SelectList(serviceType, "Value", "Text"); clientData.Client.DeliveryTypeList = new SelectList(deliveryType, "Value", "Text"); // new call Log clientData.NewCallLog = new CallDetailsModel { DataSourceId = 101, IsAssingedCall = true, ClientList = clientData.Client.ClientList, ServiceTypeList = clientData.Client.ServiceTypeList, DeliveryTypeList = clientData.Client.DeliveryTypeList, BrandList = new SelectList(_dropdown.BindBrand(CurrentUser.CompanyId), "Value", "Text"), CategoryList = new SelectList(_dropdown.BindCategory(filter), "Value", "Text"), SubCategoryList = new SelectList(Enumerable.Empty <SelectListItem>()), ProductList = new SelectList(Enumerable.Empty <SelectListItem>()), CustomerTypeList = new SelectList(await CommonModel.GetLookup("Customer Type"), "Value", "Text"), ConditionList = new SelectList(await CommonModel.GetLookup("Device Condition"), "Value", "Text"), IsClient = IsClient, StatusList = new SelectList(await CommonModel.GetStatusTypes("Client"), "Value", "Text"), // address=new AddressDetail //{ AddressTypelist = new SelectList(await CommonModel.GetLookup("ADDRESS"), "Value", "Text"), LocationList = new SelectList(Enumerable.Empty <SelectListItem>()), // } }; clientData.tab_index = "tab-5"; return(View(clientData)); }
public async Task <ActionResult> AddOrEditCompany(CompanyModel comp) { comp.CreatedBy = CurrentUser.UserId; if (comp.CompanyLogo != null && comp.CompanyPath != null) { if (System.IO.File.Exists(Server.MapPath(_path + "Logo/" + comp.CompanyLogo))) { System.IO.File.Delete(Server.MapPath(_path + "Logo/" + comp.CompanyLogo)); } } if (comp.CompanyPath != null) { comp.CompanyLogo = SaveImageFile(comp.CompanyPath, "Logo"); } var response = await _compRepo.AddUpdateDeleteCompany(comp); comp.ActiveTab = "tab-2"; TempData["response"] = response; comp.CompanyId = new Guid(response.result); comp.CompanyTypeList = new SelectList(await CommonModel.GetLookup("Company Type"), "Value", "Text"); comp.Organization.GstCategoryList = new SelectList(await CommonModel.GetGstCategory(), "Value", "Text"); comp.Organization.AplicationTaxTypeList = new SelectList(await CommonModel.GetLookup("Application Tax Type"), "Value", "Text"); comp.Organization.StatutoryList = new SelectList(await CommonModel.GetLookup("Statutory Type"), "Value", "Text"); comp.BankDetail.BankList = new SelectList(await CommonModel.GetLookup("Bank"), "Value", "Text"); comp.Contact.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "value", "Text"); comp.Contact.CountryList = new SelectList(_dropdown.BindCountry(), "Value", "Text"); comp.Contact.StateList = new SelectList(Enumerable.Empty <SelectList>()); comp.Contact.CityList = new SelectList(Enumerable.Empty <SelectList>()); comp.Contact.LocationList = new SelectList(_dropdown.BindLocation(), "Value", "Text"); comp.Agreement.ServiceList = await CommonModel.GetServiceType(new FilterModel { CompId = comp.CompanyId }); comp.Agreement.DeliveryServiceList = await CommonModel.GetDeliveryServiceType(new FilterModel { CompId = comp.CompanyId }); if (comp.Action == 'I') { comp.ActiveTab = "tab-2"; comp.Organization.RefKey = comp.CompanyId; TempData["Comp"] = comp; TempData.Keep("Comp"); return(View("Create", comp)); } else { comp = await GetCompany(comp.CompanyId); comp.ActiveTab = "tab-2"; return(View("Edit", comp)); } }
public async Task <ActionResult> Edit(string Crn, string Type) { var CallDetailsModel = await _centerRepo.GetCallsDetailsById(Crn); CallDetailsModel.Type = Type; if (CallDetailsModel.ClientId != null) { CallDetailsModel.StatusList = new SelectList(await CommonModel.GetStatusTypes("Client"), "Value", "Text"); CallDetailsModel.Remarks = CallDetailsModel.CRemark; } else { CallDetailsModel.StatusList = new SelectList(await CommonModel.GetStatusTypes("Customer support"), "Value", "Text"); CallDetailsModel.Remarks = CallDetailsModel.Remarks; } if (CallDetailsModel.ClientId != null) { CallDetailsModel.IsClientAddedBy = true; } else { CallDetailsModel.IsClientAddedBy = false; } CallDetailsModel.IsAssingedCall = true; CallDetailsModel.ClientList = new SelectList(await CommonModel.GetClientData(CurrentUser.CompanyId), "Name", "Text"); CallDetailsModel.CategoryList = new SelectList(_dropdown.BindCategory(new FilterModel { CompId = CallDetailsModel.CompanyId, ClientId = CallDetailsModel.ClientId }), "Value", "Text"); CallDetailsModel.BrandList = new SelectList(_dropdown.BindBrand(CurrentUser.CompanyId), "Value", "Text"); CallDetailsModel.SubCategoryList = new SelectList(_dropdown.BindSubCategory(new FilterModel { CategoryId = CallDetailsModel.DeviceCategoryId, ClientId = CallDetailsModel.ClientId }), "Value", "Text"); CallDetailsModel.ProductList = new SelectList(_dropdown.BindProduct(CallDetailsModel.DeviceBrandId.ToString() + "," + CallDetailsModel.DeviceSubCategoryId.ToString()), "Value", "Text"); CallDetailsModel.ServiceTypeList = new SelectList(await CommonModel.GetServiceType(new FilterModel { CompId = CurrentUser.CompanyId, RefKey = CallDetailsModel.ClientId }), "Value", "Text"); CallDetailsModel.DeliveryTypeList = new SelectList(await CommonModel.GetDeliveryServiceType(new FilterModel { CompId = CurrentUser.CompanyId, RefKey = CallDetailsModel.ClientId }), "Value", "Text"); CallDetailsModel.CustomerTypeList = new SelectList(await CommonModel.GetLookup("Customer Type"), "Value", "Text"); CallDetailsModel.ConditionList = new SelectList(await CommonModel.GetLookup("Device Condition"), "Value", "Text"); CallDetailsModel.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "Value", "Text"); CallDetailsModel.LocationList = new SelectList(_dropdown.BindLocationByPinCode(CallDetailsModel.PinNumber), "Value", "Text"); return(View(CallDetailsModel)); }
public async Task <ActionResult> Edit(string CRN) { var filter = new FilterModel { CompId = CurrentUser.CompanyId }; var CalAppintmentModel = await _centerRepo.GetCallsDetailsById(CRN); CalAppintmentModel.BrandList = new SelectList(_dropdown.BindBrand(CurrentUser.CompanyId), "Value", "Text"); CalAppintmentModel.CategoryList = new SelectList(_dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text"); CalAppintmentModel.ProductList = new SelectList(_dropdown.BindProduct(CalAppintmentModel.DeviceBrandId), "Value", "Text"); CalAppintmentModel.ServiceTypeList = new SelectList(await CommonModel.GetServiceType(filter), "Value", "Text"); CalAppintmentModel.DeliveryTypeList = new SelectList(await CommonModel.GetDeliveryServiceType(filter), "Value", "Text"); CalAppintmentModel.CustomerTypeList = new SelectList(await CommonModel.GetLookup("Customer Type"), "Value", "Text"); CalAppintmentModel.ConditionList = new SelectList(await CommonModel.GetLookup("Device Condition"), "Value", "Text"); CalAppintmentModel.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "Value", "Text"); CalAppintmentModel.CountryList = new SelectList(_dropdown.BindCountry(), "Value", "Text"); CalAppintmentModel.StatusList = new SelectList(_dropdown.BindCallStatusNew(), "Value", "Text"); return(PartialView(Mapper.Map <CallDetailsModel>(CalAppintmentModel))); //UpdateAppointmentDetail }
public async Task <ActionResult> Create() { var CompanyData = new CompanyModel(); CompanyData.Path = _path; CompanyData.ActiveTab = "tab-1"; CompanyData.Action = 'I'; CompanyData.CompanyTypeList = new SelectList(await CommonModel.GetLookup("Company Type"), "Value", "Text"); CompanyData.Organization.GstCategoryList = new SelectList(await CommonModel.GetGstCategory(), "Value", "Text"); CompanyData.Organization.AplicationTaxTypeList = new SelectList(await CommonModel.GetLookup("Application Tax Type"), "Value", "Text"); CompanyData.Organization.StatutoryList = new SelectList(await CommonModel.GetLookup("Statutory Type"), "Value", "Text"); CompanyData.BankDetail.BankList = new SelectList(await CommonModel.GetLookup("Bank"), "Value", "Text"); CompanyData.Contact.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "value", "Text"); CompanyData.Contact.CountryList = new SelectList(_dropdown.BindCountry(), "Value", "Text"); CompanyData.Contact.StateList = new SelectList(Enumerable.Empty <SelectList>()); CompanyData.Contact.CityList = new SelectList(Enumerable.Empty <SelectList>()); CompanyData.Contact.LocationList = new SelectList(Enumerable.Empty <SelectListItem>()); CompanyData.Agreement.ServiceList = await CommonModel.GetServiceType(new FilterModel()); CompanyData.Agreement.DeliveryServiceList = await CommonModel.GetDeliveryServiceType(new FilterModel()); return(View(CompanyData)); }
public async Task <ActionResult> ManageServiceProvidersDetails(string CRN, string Param) { var CallDetailsModel = await _centerRepo.GetCallsDetailsById(CRN); CallDetailsModel.BrandList = new SelectList(_dropdown.BindBrand(CurrentUser.CompanyId), "Value", "Text"); CallDetailsModel.CategoryList = new SelectList(_dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text"); CallDetailsModel.SubCategoryList = new SelectList(_dropdown.BindSubCategory(CallDetailsModel.DeviceCategoryId), "Value", "Text"); CallDetailsModel.ProductList = new SelectList(_dropdown.BindProduct(CallDetailsModel.DeviceBrandId.ToString() + "," + CallDetailsModel.DeviceSubCategoryId.ToString()), "Value", "Text"); CallDetailsModel.ServiceTypeList = new SelectList(await CommonModel.GetServiceType(new FilterModel { CompId = CallDetailsModel.CompanyId, RefKey = CallDetailsModel.ClientId }), "Value", "Text"); CallDetailsModel.DeliveryTypeList = new SelectList(await CommonModel.GetDeliveryServiceType(new FilterModel { CompId = CallDetailsModel.CompanyId, RefKey = CallDetailsModel.ClientId }), "Value", "Text"); CallDetailsModel.CustomerTypeList = new SelectList(await CommonModel.GetLookup("Customer Type"), "Value", "Text"); CallDetailsModel.ConditionList = new SelectList(await CommonModel.GetLookup("Device Condition"), "Value", "Text"); CallDetailsModel.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "Value", "Text"); CallDetailsModel.LocationList = new SelectList(dropdown.BindLocationByPinCode(CallDetailsModel.PinNumber), "Value", "Text"); var providerList = dropdown.BindServiceProvider(CallDetailsModel.PinNumber, CRN); CallDetailsModel.CompLogo = CurrentUser.LogoUrl; if (Convert.ToBoolean(CallDetailsModel.IsRepeat)) { var prvList = providerList.Where(x => x.Value == CallDetailsModel.PrvProviderId.ToString()).ToList(); if (prvList != null) { CallDetailsModel.ProviderList = new SelectList(prvList, "Value", "Text"); } else { CallDetailsModel.ProviderList = new SelectList(dropdown.BindServiceProvider(CallDetailsModel.PinNumber, CRN), "Value", "Text"); } } else { CallDetailsModel.ProviderList = new SelectList(dropdown.BindServiceProvider(CallDetailsModel.PinNumber, CRN), "Value", "Text"); } CallDetailsModel.Param = Param; CallDetailsModel.Files = new List <ProviderFileModel>(); if (Param == "A") { if (CallDetailsModel.EmpId != null) { CallDetailsModel.Employee = await _empRepo.GetEmployeeById(CallDetailsModel.EmpId); } else { CallDetailsModel.Employee = new EmployeeModel(); } CallDetailsModel.StatusList = new SelectList(dropdown.BindCallAppointmentStatus("ASP"), "Value", "Text"); CallDetailsModel.AppointmentStatus = CallDetailsModel.ASPStatus; CallDetailsModel.Remarks = CallDetailsModel.AspRemark; } else { if (Param == "P") { CallDetailsModel.CStatus = 11; } CallDetailsModel.AppointmentStatus = CallDetailsModel.CStatus; CallDetailsModel.StatusList = new SelectList(dropdown.BindCallAppointmentStatus("Customer support"), "Value", "Text"); CallDetailsModel.Remarks = CallDetailsModel.CRemark; } if (CurrentUser.UserTypeName.ToLower().Contains("company")) { CallDetailsModel.IsCompany = true; } return(View(CallDetailsModel)); }
public async Task <ActionResult> AddorEditAgreement(AgreementModel agreement) { CompanyModel comp = new CompanyModel(); if (ModelState.IsValid) { if (TempData["Comp"] != null) { comp = TempData["Comp"] as CompanyModel; comp.ActiveTab = "tab-6"; comp.Agreement = agreement; TempData["Comp"] = comp; comp.Action = 'I'; if (agreement.ServiceList.Where(x => x.IsChecked).Count() == 0 || agreement.DeliveryServiceList.Where(x => x.IsChecked).Count() == 0) { return(View("create", comp)); } } else { comp = await GetCompany(agreement.RefKey); comp.Action = 'U'; comp.ActiveTab = "tab-5"; if (agreement.ServiceList.Where(x => x.IsChecked).Count() == 0 || agreement.DeliveryServiceList.Where(x => x.IsChecked).Count() == 0) { return(View("edit", comp)); } } if (agreement.CancelledChequeFile != null && agreement.CancelledChequeFile != null) { if (System.IO.File.Exists(Server.MapPath(_path + "Cheques/" + agreement.CancelledChequeFile))) { System.IO.File.Delete(Server.MapPath(_path + "Cheques/" + agreement.CancelledChequeFile)); } } if (agreement.AgreementFile != null && agreement.AgreementPath != null) { if (System.IO.File.Exists(Server.MapPath(_path + "Agreements/" + agreement.AgreementFile))) { System.IO.File.Delete(Server.MapPath(_path + "Agreements/" + agreement.AgreementFile)); } } if (agreement.CancelledChequePath != null) { agreement.CancelledChequeFile = SaveImageFile(agreement.CancelledChequePath, "Cheques/"); } if (agreement.AgreementPath != null) { agreement.AgreementFile = SaveImageFile(agreement.AgreementPath, "Agreements/"); } if (agreement.AGRId == null) { agreement.Action = 'I'; } else { agreement.Action = 'U'; } foreach (var item in agreement.ServiceList) { if (item.IsChecked) { agreement.ServiceTypes = agreement.ServiceTypes + "," + item.Value; } } agreement.ServiceTypes = agreement.ServiceTypes.Trim(','); foreach (var item in agreement.DeliveryServiceList) { if (item.IsChecked) { agreement.DeliveryTypes = agreement.DeliveryTypes + "," + item.Value; } } agreement.DeliveryTypes = agreement.DeliveryTypes.Trim(','); agreement.CreatedBy = CurrentUser.UserId; var response = await _compRepo.AddOrEditAgreeement(agreement); TempData["response"] = response; if (comp.Action == 'I') { return(View("Create", comp)); } else { comp = await GetCompany(agreement.RefKey); comp.ActiveTab = "tab-6"; return(View("Edit", comp)); } } else { if (TempData["Comp"] != null) { comp = TempData["Comp"] as CompanyModel; comp.ActiveTab = "tab-5"; comp.Agreement = agreement; TempData["Comp"] = comp; comp.Action = 'I'; if (agreement.ServiceList.Where(x => x.IsChecked).Count() == 0 || agreement.DeliveryServiceList.Where(x => x.IsChecked).Count() == 0) { return(View("create", comp)); } } else { comp = await GetCompany(agreement.RefKey); comp.ActiveTab = "tab-5"; comp.Agreement = agreement; comp.Agreement.ServiceList = await CommonModel.GetServiceType(new FilterModel()); comp.Agreement.DeliveryServiceList = await CommonModel.GetDeliveryServiceType(new FilterModel()); return(View("Edit", comp)); } } return(View()); }
public async Task <ActionResult> AddOrEditBank(BankDetailModel bank) { if (bank.BankCancelledChequeFileName != null && bank.BankCancelledChequeFilePath != null) { if (System.IO.File.Exists(Server.MapPath(_path + "Cheques/" + bank.BankCancelledChequeFileName))) { System.IO.File.Delete(Server.MapPath(_path + "Cheques/" + bank.BankCancelledChequeFileName)); } } if (bank.BankCancelledChequeFilePath != null) { bank.BankCancelledChequeFileName = SaveImageFile(bank.BankCancelledChequeFilePath, "Cheques/"); } if (bank.bankId == null) { bank.EventAction = 'I'; } else { bank.EventAction = 'U'; } CompanyModel comp = new CompanyModel(); if (TempData["Comp"] != null) { comp = TempData["Comp"] as CompanyModel; comp.ActiveTab = "tab-5"; comp.Action = 'I'; comp.BankDetails.Add(bank); comp.Agreement = new AgreementModel { ServiceList = await CommonModel.GetServiceType(new FilterModel()), DeliveryServiceList = await CommonModel.GetDeliveryServiceType(new FilterModel()) }; comp.BankDetail = new BankDetailModel { RefKey = comp.CompanyId, BankList = new SelectList(await CommonModel.GetLookup("Bank"), "Value", "Text") }; TempData["Comp"] = comp; } else { comp.Action = 'U'; } bank.UserId = CurrentUser.UserId; var response = await _BankRepo.AddUpdateBankDetails(bank); TempData["response"] = response; if (comp.Action == 'I') { return(View("Create", comp)); } else { comp = await GetCompany(bank.RefKey); comp.ActiveTab = "tab-4"; return(View("Edit", comp)); } }
private async Task <CompanyModel> GetCompany(Guid?CompanyId) { var comp = await _compRepo.GetCompanyDetailByCompanyId(CompanyId); comp.CompanyFile = _path + "Logo/" + comp.CompanyLogo; comp.Action = 'U'; comp.Path = _path; comp.CompanyTypeList = new SelectList(await CommonModel.GetLookup("Company Type"), "Value", "Text"); comp.Organization = await _OrgRepo.GetOrganizationByRefKey(CompanyId); if (comp.Organization == null) { comp.Organization = new OrganizationModel(); } if (!string.IsNullOrEmpty(comp.Organization.OrgGSTFileName)) { comp.Organization.OrgGSTFileUrl = _path + "Gsts/" + comp.Organization.OrgGSTFileName; } if (!string.IsNullOrEmpty(comp.Organization.OrgPanFileName)) { comp.Organization.OrgPanFileUrl = _path + "PanCards/" + comp.Organization.OrgPanFileName; } comp.Organization.GstCategoryList = new SelectList(await CommonModel.GetGstCategory(), "Value", "Text"); comp.Organization.AplicationTaxTypeList = new SelectList(await CommonModel.GetLookup("Application Tax Type"), "Value", "Text"); comp.Organization.StatutoryList = new SelectList(await CommonModel.GetLookup("Statutory Type"), "Value", "Text"); comp.Contacts = await _ContactPersonRepo.GetContactPersonsByRefKey(comp.CompanyId); comp.Contact.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "value", "Text"); comp.Contact.LocationList = new SelectList(Enumerable.Empty <SelectList>()); comp.BankDetails = await _BankRepo.GetBanksByRefKey(CompanyId); comp.BankDetail.BankList = new SelectList(await CommonModel.GetLookup("Bank"), "Value", "Text"); comp.Agreement = await _compRepo.GetAgreement(CompanyId); if (comp.Agreement == null) { comp.Agreement = new AgreementModel(); } comp.Agreement.ServiceList = await CommonModel.GetServiceType(new FilterModel()); comp.Agreement.DeliveryServiceList = await CommonModel.GetDeliveryServiceType(new FilterModel()); if (!string.IsNullOrEmpty(comp.Agreement.AgreementFile)) { comp.Agreement.AgreementFileUrl = _path + "Agreements/" + comp.Agreement.AgreementFile; } if (!string.IsNullOrEmpty(comp.Agreement.CancelledChequeFile)) { comp.Agreement.CancelledChequeFileUrl = _path + "Cheques/" + comp.Agreement.CancelledChequeFile; } if (!string.IsNullOrEmpty(comp.Agreement.DeliveryTypes)) { var _DeliveryService = comp.Agreement.DeliveryTypes.Split(','); for (int i = 0; i < _DeliveryService.Length; i++) { var item = comp.Agreement.DeliveryServiceList.Where(x => x.Value == Convert.ToInt32(_DeliveryService[i])).FirstOrDefault(); if (item != null) { item.IsChecked = true; } } } if (!string.IsNullOrEmpty(comp.Agreement.ServiceTypes)) { var _serviceType = comp.Agreement.ServiceTypes.Split(','); for (int i = 0; i < _serviceType.Length; i++) { var item = comp.Agreement.ServiceList.Where(x => x.Value == Convert.ToInt32(_serviceType[i])).FirstOrDefault(); if (item != null) { item.IsChecked = true; } } } return(comp); }
public async Task <ActionResult> AddOrEditService(ServiceViewModel service) { var Client = new ClientModel(); if (!ModelState.IsValid) { if (TempData["client"] != null) { return(View("Create", Client)); } else { Client = await GetClient(service.RefKey); Client.action = 'U'; Client.Activetab = "tab-5"; return(View("Edit", Client)); } } else { if (service.ServiceId != null) { service.EventAction = 'U'; } else { service.EventAction = 'I'; } Client = TempData["client"] as ClientModel; if (TempData["client"] != null) { service.RefKey = Client.ClientId; } var response = await _service.AddEditServices(service); TempData["response"] = response; if (TempData["client"] != null) { service.ServiceId = new Guid(response.result); service.Category = dropdown.BindCategory(CurrentUser.CompanyId).Where(x => Convert.ToInt32(x.Value) == service.CategoryId).FirstOrDefault().Text; service.SubCategory = dropdown.BindSubCategory(service.CategoryId).Where(x => x.Value == service.SubCategoryId.ToString()).FirstOrDefault().Text; var services = await CommonModel.GetServiceType(new FilterModel { CompId = CurrentUser.CompanyId }); service.ServiceType = services.Where(x => x.Value == service.ServiceTypeId).FirstOrDefault().Text; var Deliveries = await CommonModel.GetDeliveryServiceType(new FilterModel { CompId = CurrentUser.CompanyId }); service.ServiceType = Deliveries.Where(x => Convert.ToInt32(x.Value) == service.DeliveryTypeId).FirstOrDefault().Text; Client.Services.Add(service); Client.action = 'I'; Client.Activetab = "tab-6"; TempData["client"] = Client; return(View("Create", Client)); } else { Client = await GetClient(service.RefKey); Client.action = 'U'; Client.Activetab = "tab-5"; return(View("Edit", Client)); } } }
public async Task <ActionResult> Edit(CallDetailsModel CallDetailsModel) { if (!ModelState.IsValid) { //IEnumerable<ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors); bool IsClient = false; var filter = new FilterModel { CompId = CurrentUser.CompanyId }; if (CurrentUser.UserTypeName.ToLower().Contains("client")) { filter.ClientId = CurrentUser.RefKey; filter.RefKey = CurrentUser.RefKey; IsClient = true; } var serviceType = await CommonModel.GetServiceType(filter); var deliveryType = await CommonModel.GetDeliveryServiceType(filter); CallDetailsModel.ClientList = new SelectList(await CommonModel.GetClientData(CurrentUser.CompanyId), "Name", "Text"); CallDetailsModel.ServiceTypeList = new SelectList(serviceType, "Value", "Text"); CallDetailsModel.DeliveryTypeList = new SelectList(deliveryType, "Value", "Text"); // new call Log CallDetailsModel.BrandList = new SelectList(_dropdown.BindBrand(CurrentUser.CompanyId), "Value", "Text"); CallDetailsModel.CategoryList = new SelectList(_dropdown.BindCategory(new FilterModel { CompId = CurrentUser.CompanyId, ClientId = CallDetailsModel.ClientId }), "Value", "Text"); CallDetailsModel.SubCategoryList = new SelectList(_dropdown.BindSubCategory(new FilterModel { CategoryId = CallDetailsModel.DeviceCategoryId, ClientId = CallDetailsModel.ClientId }), "Value", "Text"); CallDetailsModel.ProductList = new SelectList(_dropdown.BindProduct(CallDetailsModel.DeviceBrandId.ToString() + "," + CallDetailsModel.DeviceSubCategoryId.ToString()), "Value", "Text"); CallDetailsModel.CustomerTypeList = new SelectList(await CommonModel.GetLookup("Customer Type"), "Value", "Text"); CallDetailsModel.ConditionList = new SelectList(await CommonModel.GetLookup("Device Condition"), "Value", "Text"); CallDetailsModel.IsClient = IsClient; if (CallDetailsModel.ClientId != null) { CallDetailsModel.StatusList = new SelectList(await CommonModel.GetStatusTypes("Client"), "Value", "Text"); } else { CallDetailsModel.StatusList = new SelectList(await CommonModel.GetStatusTypes("Customer support"), "Value", "Text"); } CallDetailsModel.ServiceTypeList = new SelectList(serviceType, "Value", "Text"); CallDetailsModel.DeliveryTypeList = new SelectList(deliveryType, "Value", "Text"); // address=new AddressDetail //{ CallDetailsModel.AddressTypelist = new SelectList(await CommonModel.GetLookup("ADDRESS"), "Value", "Text"); CallDetailsModel.LocationList = new SelectList(_dropdown.BindLocationByPinCode(CallDetailsModel.PinNumber), "Value", "Text"); // } return(View("edit", CallDetailsModel)); } else { CallDetailsModel.UserId = CurrentUser.UserId; CallDetailsModel.CompanyId = CurrentUser.CompanyId; CallDetailsModel.EventAction = 'U'; if (CallDetailsModel.ClientId == null) { CallDetailsModel.CRemark = CallDetailsModel.Remarks; } var response = await _RepoCallLog.AddOrEditCallLog(CallDetailsModel); TempData["response"] = response; if (!string.IsNullOrEmpty(CallDetailsModel.Type)) { return(RedirectToAction("Index", "PendingCalls")); } else { return(RedirectToAction("Index")); } } }
public async Task <ActionResult> NewCallLog(CallDetailsModel uploads) { if (ModelState.IsValid) { uploads.UserId = CurrentUser.UserId; uploads.CompanyId = CurrentUser.CompanyId; if (CurrentUser.UserTypeName.ToLower().Contains("client")) { uploads.ClientId = CurrentUser.RefKey; } uploads.EventAction = 'I'; var response = await _RepoCallLog.AddOrEditCallLog(uploads); if (response.IsSuccess) { var Templates = await _templateRepo.GetTemplateByActionId((int)EmailActions.CALL_REGISTRATION, CurrentUser.CompanyId); CurrentUser.Email = uploads.CustomerEmail; var WildCards = CommonModel.GetWildCards(CurrentUser.CompanyId); var U = WildCards.Where(x => x.Text.ToUpper() == "NAME").FirstOrDefault(); U.Val = uploads.CustomerName; U = WildCards.Where(x => x.Text.ToUpper() == "CALL ID").FirstOrDefault(); U.Val = response.result; U = WildCards.Where(x => x.Text.ToUpper() == "CUSTOMER SUPPORT NUMBER").FirstOrDefault(); U.Val = CurrentUser.CustomerCareNumber; U = WildCards.Where(x => x.Text.ToUpper() == "CUSTOMER SUPPORT EMAIL").FirstOrDefault(); U.Val = CurrentUser.ContactCareEmail; CurrentUser.Mobile = uploads.CustomerContactNumber; var c = WildCards.Where(x => x.Val != string.Empty).ToList(); if (Templates.Count > 0) { await _emailSmsServices.Send(Templates, c, CurrentUser); } } TempData["response"] = response; return(RedirectToAction("Index")); } else { bool IsClient = false; var filter = new FilterModel { CompId = CurrentUser.CompanyId }; if (CurrentUser.UserTypeName.ToLower().Contains("client")) { filter.ClientId = CurrentUser.RefKey; filter.RefKey = CurrentUser.RefKey; IsClient = true; } var clientData = new MainClientDataModel(); var serviceType = await CommonModel.GetServiceType(filter); var deliveryType = await CommonModel.GetDeliveryServiceType(filter); clientData.Client = new FileDetailModel(); clientData.Client.IsClient = IsClient; clientData.Client.ClientId = filter.ClientId; clientData.Client.ClientList = new SelectList(await CommonModel.GetClientData(CurrentUser.CompanyId), "Name", "Text"); clientData.Client.ServiceTypeList = new SelectList(serviceType, "Value", "Text"); clientData.Client.DeliveryTypeList = new SelectList(deliveryType, "Value", "Text"); // new call Log clientData.NewCallLog = uploads; clientData.NewCallLog.BrandList = new SelectList(_dropdown.BindBrand(CurrentUser.CompanyId), "Value", "Text"); clientData.NewCallLog.CategoryList = new SelectList(_dropdown.BindCategory(new FilterModel { CompId = CurrentUser.CompanyId, ClientId = uploads.ClientId }), "Value", "Text"); clientData.NewCallLog.SubCategoryList = new SelectList(_dropdown.BindSubCategory(new FilterModel { CategoryId = uploads.DeviceCategoryId, ClientId = uploads.ClientId }), "Value", "Text"); clientData.NewCallLog.ProductList = new SelectList(_dropdown.BindProduct(uploads.DeviceBrandId.ToString() + "," + uploads.DeviceSubCategoryId.ToString()), "Value", "Text"); clientData.NewCallLog.CustomerTypeList = new SelectList(await CommonModel.GetLookup("Customer Type"), "Value", "Text"); clientData.NewCallLog.ConditionList = new SelectList(await CommonModel.GetLookup("Device Condition"), "Value", "Text"); clientData.NewCallLog.IsClient = IsClient; clientData.NewCallLog.StatusList = new SelectList(await CommonModel.GetStatusTypes("Client"), "Value", "Text"); clientData.NewCallLog.ServiceTypeList = new SelectList(serviceType, "Value", "Text"); clientData.NewCallLog.DeliveryTypeList = new SelectList(deliveryType, "Value", "Text"); // address=new AddressDetail //{ clientData.NewCallLog.AddressTypelist = new SelectList(await CommonModel.GetLookup("ADDRESS"), "Value", "Text"); clientData.NewCallLog.LocationList = new SelectList(_dropdown.BindLocationByPinCode(clientData.NewCallLog.PinNumber), "Value", "Text"); clientData.tab_index = "tab-7"; // } return(View("Index", clientData)); }; }