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));
        }
Пример #2
0
        public MainClientDataModel GetUploadedList(FilterModel filterModel)
        {
            var mainModel = new MainClientDataModel();
            var param     = new SqlParameter("@ClientId", ToDBNull(filterModel.ClientId));

            using (var connection = _context.Database.Connection)
            {
                connection.Open();
                var command = connection.CreateCommand();
                command.CommandText = "GETDATAUPLOADEDBYCLIENT";
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(param);
                command.Parameters.Add(new SqlParameter("@IsExport", ToDBNull(false)));
                command.Parameters.Add(new SqlParameter("@Type", ToDBNull('A')));
                command.Parameters.Add(new SqlParameter("@CompId", ToDBNull(filterModel.CompId)));
                using (var reader = command.ExecuteReader())
                {
                    mainModel.UploadedFiles =
                        ((IObjectContextAdapter)_context)
                        .ObjectContext
                        .Translate <FileDetailModel>(reader)
                        .ToList();
                    reader.NextResult();

                    mainModel.UploadedData =
                        ((IObjectContextAdapter)_context)
                        .ObjectContext
                        .Translate <UploadedExcelModel>(reader)
                        .ToList();
                    reader.NextResult();
                    mainModel.Calls           = new CallsViewModel();
                    mainModel.Calls.OpenCalls =
                        ((IObjectContextAdapter)_context)
                        .ObjectContext
                        .Translate <UploadedExcelModel>(reader)
                        .ToList();
                    reader.NextResult();
                    mainModel.Calls.CloseCalls =
                        ((IObjectContextAdapter)_context)
                        .ObjectContext
                        .Translate <UploadedExcelModel>(reader)
                        .ToList();
                }
            }
            return(mainModel);
        }
Пример #3
0
        public async Task <MainClientDataModel> GetExportAssingedCalls(FilterModel filterModel)
        {
            MainClientDataModel main = new MainClientDataModel();
            var sp     = new List <SqlParameter>();
            var pararm = new SqlParameter("@ClientId", ToDBNull(filterModel.ClientId));

            sp.Add(pararm);
            pararm = new SqlParameter("@IsExport", true);
            sp.Add(pararm);
            pararm = new SqlParameter("@Type", ToDBNull(filterModel.tabIndex));
            sp.Add(pararm);
            pararm = new SqlParameter("@CompId", ToDBNull(filterModel.CompId));
            sp.Add(pararm);
            main.Calls = new CallsViewModel();
            var query = "GETDATAUPLOADEDBYCLIENT @ClientId, @IsExport , @Type,@CompId";

            if (filterModel.tabIndex == 'O')
            {
                try
                {
                    main.Calls.OpenCalls = await _context.Database.SqlQuery <UploadedExcelModel>(query, sp.ToArray()).ToListAsync();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else if (filterModel.tabIndex == 'C')
            {
                main.Calls.CloseCalls = await _context.Database.SqlQuery <UploadedExcelModel>(query, sp.ToArray()).ToListAsync();
            }
            else if (filterModel.tabIndex == 'D')
            {
                main.UploadedData = await _context.Database.SqlQuery <UploadedExcelModel>(query, sp.ToArray()).ToListAsync();
            }
            else
            {
                main.UploadedFiles = await _context.Database.SqlQuery <FileDetailModel>(query, sp.ToArray()).ToListAsync();
            }
            return(main);
        }
        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));
            };
        }