Example #1
0
        public async Task <ActionResult> Index()
        {
            var filter = new FilterModel();

            if (CurrentUser.UserTypeName.ToLower().Contains("provider"))
            {
                filter.ProviderId = CurrentUser.RefKey;
            }

            filter.CompId   = CurrentUser.CompanyId;
            filter.IsExport = false;
            var calls = await _customerSupport.GetASCCalls(filter);

            calls.ClientList          = new SelectList(await CommonModel.GetClientData(CurrentUser.CompanyId), "Name", "Text");
            calls.ServiceTypeList     = new SelectList(await CommonModel.GetServiceType(filter), "Value", "Text");
            calls.ServiceProviderList = new SelectList(await CommonModel.GetServiceProviders(CurrentUser.CompanyId), "Name", "Text");
            if (CurrentUser.UserTypeName.ToLower().Contains("provider"))
            {
                calls.CallAllocate = new Models.Customer_Support.AllocateCallModel {
                    ToAllocateList = new SelectList(await CommonModel.GetServiceCenters(CurrentUser.RefKey), "Name", "Text")
                }
            }
            ;
            else
            {
                calls.CallAllocate = new Models.Customer_Support.AllocateCallModel {
                    ToAllocateList = new SelectList(await CommonModel.GetServiceComp(CurrentUser.CompanyId), "Name", "Text")
                }
            };

            return(View(calls));
        }
        public async Task <ActionResult> Create()
        {
            var clientDate = new ClientDataModel();

            clientDate.ClientList      = new SelectList(await CommonModel.GetClientData(CurrentUser.CompanyId), "Name", "Text");
            clientDate.ServiceTypeList = new SelectList(await CommonModel.GetServiceType(new FilterModel {
                CompId = CurrentUser.CompanyId, RefKey = CurrentUser.RefKey
            }), "Value", "Text");
            return(View(clientDate));
        }
        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> Index()
        {
            var filter = new FilterModel {
                CompId = CurrentUser.CompanyId, IsExport = false
            };
            var calls = await _customerSupport.GetASPCalls(filter);

            calls.ClientList      = new SelectList(await CommonModel.GetClientData(CurrentUser.CompanyId), "Name", "Text");
            calls.ServiceTypeList = new SelectList(await CommonModel.GetServiceType(new FilterModel {
                CompId = CurrentUser.CompanyId
            }), "Value", "Text");
            calls.CallAllocate = new Models.Customer_Support.AllocateCallModel {
                ToAllocateList = new SelectList(await CommonModel.GetServiceProviders(CurrentUser.CompanyId), "Name", "Text")
            };
            return(View(calls));
        }
        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(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));
            };
        }