public ActionResult AddSacCodes()
        {
            var           SessionModel = Session["User"] as SessionModel;
            SacCodesModel sm           = new SacCodesModel
            {
                CountryList           = new SelectList(dropdown.BindCountry(), "Value", "Text"),
                StateList             = new SelectList(Enumerable.Empty <SelectList>()),
                GstList               = new SelectList(dropdown.BindGst(null), "Value", "Text"),
                AplicationTaxTypeList = new SelectList(CommonModel.GetApplicationTax(), "Value", "Text"),
            };

            return(View(sm));
        }
        public ActionResult AddGst()
        {
            GstTaxModel gm = new GstTaxModel();

            gm.CountryList           = new SelectList(dropdown.BindCountry(), "Value", "Text");
            gm.StateList             = new SelectList(Enumerable.Empty <SelectList>());
            gm.GstcategoryList       = new SelectList(dropdown.BindGst(null), "Value", "Text");
            gm.DeviceCategoryList    = new SelectList(dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text");
            gm.DeviceSubCategoryList = new SelectList(Enumerable.Empty <SelectList>());
            gm.ApplicableTaxTypeList = new SelectList(CommonModel.GetApplicationTax(), "Value", "Text");
            gm.GstHSNCodeList        = new SelectList(dropdown.BindGstHsnCode(), "Value", "Text");
            gm.SACList       = new SelectList(CommonModel.SAC_NumberList(), "Text", "Text");
            gm.CTHNumberList = new SelectList(CommonModel.CTH_NumberList(), "Text", "Text");
            return(View(gm));
        }
        private async Task <ClientModel> GetClient(Guid?clientId)
        {
            var Client = await _client.GetClientByClientId(clientId);

            Client.Path = _path;

            if (Client.Organization == null)
            {
                Client.Organization = new OrganizationModel();
            }


            Client.Organization.GstCategoryList = new SelectList(dropdown.BindGst(null), "Value", "Text");
            var statutory = await CommonModel.GetStatutoryType();

            Client.Organization.StatutoryList = new SelectList(statutory, "Value", "Text");
            var applicationTaxTypeList = await CommonModel.GetApplicationTaxType();

            Client.Organization.AplicationTaxTypeList = new SelectList(applicationTaxTypeList, "Value", "Text");

            Client.Bank.BankList           = new SelectList(await CommonModel.GetLookup("Bank"), "Value", "Text");
            Client.Contact.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "value", "Text");
            Client.Contact.CountryList     = new SelectList(dropdown.BindCountry(), "Value", "Text");
            Client.Contact.StateList       = new SelectList(Enumerable.Empty <SelectList>());
            Client.Contact.CityList        = new SelectList(Enumerable.Empty <SelectList>());
            Client.Contact.LocationList    = new SelectList(Enumerable.Empty <SelectList>());
            Client.Service = new ServiceViewModel
            {
                SupportedCategoryList    = new SelectList(dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text"),
                SupportedSubCategoryList = new SelectList(Enumerable.Empty <SelectList>()),
                ServiceList = new SelectList(await doorserve.CommonModel.GetServiceType(new FilterModel {
                    CompId = CurrentUser.CompanyId
                }), "Value", "Text"),
                DeliveryServiceList = new SelectList(await doorserve.CommonModel.GetDeliveryServiceType(new FilterModel {
                    CompId = CurrentUser.CompanyId
                }), "Value", "Text"),
                RefKey = clientId
            };

            if (CurrentUser.UserTypeName.ToLower().Contains("super admin"))
            {
                Client.CompanyList = new SelectList(await CommonModel.GetCompanies(), "Name", "Text");
                if (Client.CompanyId != null)
                {
                    Client.ProcessList = new SelectList(await CommonModel.GetProcesses(Client.CompanyId), "Value", "Text");
                }
                else
                {
                    Client.ProcessList = new SelectList(Enumerable.Empty <SelectList>());
                }
                Client.IsSuperAdmin = true;
            }
            else
            {
                Client.CompanyList = new SelectList(Enumerable.Empty <SelectList>());
                if (clientId == null)
                {
                    Client.ProcessList = new SelectList(await CommonModel.GetProcesses(CurrentUser.CompanyId), "Value", "Text");
                    Client.CompanyId   = CurrentUser.CompanyId;
                }
                else
                {
                    Client.ProcessList = new SelectList(await CommonModel.GetProcesses(Client.CompanyId), "Value", "Text");
                }
            }
            if (clientId != null)
            {
                Client.action = 'U';
            }
            else
            {
                Client.action = 'I';
            }


            return(Client);
        }
        private async Task <ServiceCenterModel> GetCenter(Guid?centerId)
        {
            var Center = await _Center.GetCenterById(centerId);

            Center.Path = _path;

            if (CurrentUser.UserRole.ToLower().Contains("provider"))
            {
                var providerId = CurrentUser.RefKey;
                var provider   = await _Provider.GetProviderById(providerId);

                Center.IsProvider = true;
            }

            else if (CurrentUser.UserRole.ToLower().Contains("company"))
            {
                Center.IsCompany    = true;
                Center.ProviderList = new SelectList(await CommonModel.GetServiceProviders(CurrentUser.CompanyId), "Name", "Text");
            }
            else
            {
                Center.IsProvider  = false;
                Center.IsCompany   = false;
                Center.CompanyList = new SelectList(await CommonModel.GetCompanies(), "Name", "Text");
                if (Center.CenterId != null)
                {
                    Center.ProviderList = new SelectList(await CommonModel.GetServiceProviders(Center.CompanyId), "Name", "Text");
                }
                else
                {
                    Center.ProviderList = new SelectList(Enumerable.Empty <SelectList>());
                }
            }

            if (Center.Organization == null)
            {
                Center.Organization = new OrganizationModel();
            }
            Center.SupportedCategoryList        = new SelectList(dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text");
            Center.Organization.GstCategoryList = new SelectList(dropdown.BindGst(null), "Value", "Text");
            var statutory = await CommonModel.GetStatutoryType();

            Center.Organization.StatutoryList = new SelectList(statutory, "Value", "Text");
            var applicationTaxTypeList = await CommonModel.GetApplicationTaxType();

            Center.Organization.AplicationTaxTypeList = new SelectList(applicationTaxTypeList, "Value", "Text");
            Center.ServiceList = await doorserve.CommonModel.GetServiceType(new FilterModel { CompId = CurrentUser.CompanyId, RefKey = Center.CenterId });

            Center.DeliveryServiceList = await doorserve.CommonModel.GetDeliveryServiceType(new FilterModel { CompId = CurrentUser.CompanyId, RefKey = Center.CenterId });

            Center.Bank.BankList           = new SelectList(await CommonModel.GetLookup("Bank"), "Value", "Text");
            Center.Contact.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "value", "Text");
            Center.Contact.CountryList     = new SelectList(dropdown.BindCountry(), "Value", "Text");
            Center.Contact.StateList       = new SelectList(Enumerable.Empty <SelectList>());
            Center.Contact.CityList        = new SelectList(Enumerable.Empty <SelectList>());
            Center.Contact.LocationList    = new SelectList(Enumerable.Empty <SelectListItem>());

            if (centerId != null)
            {
                Center.action = 'U';
            }

            else
            {
                Center.action = 'I';
            }
            List <int> List = new List <int>();

            if (!string.IsNullOrEmpty(Center._deviceCategories))
            {
                var _deviceCat = Center._deviceCategories.Split(',');
                for (int i = 0; i < _deviceCat.Length; i++)
                {
                    List.Add(Convert.ToInt16(_deviceCat[i]));
                }
            }
            if (!string.IsNullOrEmpty(Center.ServiceDeliveryTypes))
            {
                var _DeliveryService = Center.ServiceDeliveryTypes.Split(',');
                for (int i = 0; i < _DeliveryService.Length; i++)
                {
                    var item = Center.DeliveryServiceList.Where(x => x.Value == Convert.ToInt32(_DeliveryService[i])).FirstOrDefault();
                    if (item != null)
                    {
                        item.IsChecked = true;
                    }
                }
            }
            if (!string.IsNullOrEmpty(Center.ServiceTypes))
            {
                var _serviceType = Center.ServiceTypes.Split(',');
                for (int i = 0; i < _serviceType.Length; i++)
                {
                    var item = Center.ServiceList.Where(x => x.Value == Convert.ToInt32(_serviceType[i])).FirstOrDefault();
                    if (item != null)
                    {
                        item.IsChecked = true;
                    }
                }
            }
            Center.DeviceCategories = List;
            return(Center);
        }
        public async Task <ActionResult> AddorEditServiceProvider(ServiceProviderModel provider)
        {
            var statutory = await CommonModel.GetStatutoryType();

            var applicationTaxTypeList = await CommonModel.GetApplicationTaxType();

            var cltns = TempData["provider"] as ServiceProviderModel;

            provider.Organization = new OrganizationModel();


            provider.Organization.GstCategoryList       = new SelectList(dropdown.BindGst(null), "Value", "Text");
            provider.Organization.StatutoryList         = new SelectList(statutory, "Value", "Text");
            provider.Organization.AplicationTaxTypeList = new SelectList(applicationTaxTypeList, "Value", "Text");
            provider.Bank.BankList           = new SelectList(await CommonModel.GetLookup("Bank"), "Value", "Text");
            provider.Contact.AddressTypelist = new SelectList(await CommonModel.GetLookup("Address"), "value", "Text");
            provider.Contact.CountryList     = new SelectList(dropdown.BindCountry(), "Value", "Text");
            provider.Contact.StateList       = new SelectList(dropdown.BindState(), "Value", "Text");
            provider.Contact.CityList        = new SelectList(await CommonModel.GetLookup("City"), "Value", "Text");
            //provider.Contact.LocationList = new SelectList(dropdown.BindLocation(), "Value", "Text");
            provider.Contact.LocationList = new SelectList(dropdown.BindLocationByPinCode(provider.Contact.PinNumber), "Value", "Text");
            provider.Service = new ServiceOfferedModel
            {
                SupportedCategoryList    = new SelectList(dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text"),
                SupportedSubCategoryList = new SelectList(dropdown.BindCountry(), "Value", "Text"),
                ServiceList = new SelectList(await doorserve.CommonModel.GetServiceType(new FilterModel {
                    CompId = CurrentUser.CompanyId
                }), "Value", "Text"),
                DeliveryServiceList = new SelectList(await doorserve.CommonModel.GetDeliveryServiceType(new FilterModel {
                    CompId = CurrentUser.CompanyId
                }), "Value", "Text"),
                LocationList = new SelectList(Enumerable.Empty <SelectList>()),
            };

            if (TempData["provider"] != null)
            {
                cltns.CompanyId = provider.CompanyId;
                provider        = cltns;
            }
            else
            {
                provider.Activetab = "tab-1";
                provider.CreatedBy = CurrentUser.UserId;
            }

            if (CurrentUser.UserTypeName.ToLower().Contains("super admin"))
            {
                provider.CompanyList  = new SelectList(await CommonModel.GetCompanies(), "Name", "Text");
                provider.IsSuperAdmin = true;
            }
            else
            {
                provider.CompanyId = CurrentUser.CompanyId;
            }
            provider.UserId    = CurrentUser.UserId;
            provider.Activetab = "tab-1";
            var response = await _provider.AddUpdateDeleteProvider(provider);

            _provider.Save();
            provider.ProviderId     = new Guid(response.result);
            provider.Service.RefKey = provider.ProviderId;
            TempData["response"]    = response;
            provider.Activetab      = "tab-2";

            if (provider.action == 'I')
            {
                TempData["provider"] = provider;
                return(View("Create", provider));
            }
            else
            {
                return(View("Edit", provider));
            }
        }