public string GetAccountId(Guid Id)
        {
            DropDownService           ddService           = new DropDownService();
            List <EntityHierarchyDTO> EntityHierarchyDTOs = new List <EntityHierarchyDTO>();

            EntityHierarchyDTOs = ddService.GetEntityHierarchies(Id);

            var  TopFromHierarchy = EntityHierarchyDTOs.OrderByDescending(o => o.Customer_Level).FirstOrDefault();
            int  EntityId         = TopFromHierarchy.EntityId ?? 0;
            Guid ParentId         = TopFromHierarchy.CustomerId ?? Guid.Empty;

            if (EntityId == (int)EMPConstants.Entity.SVB || EntityId == (int)EMPConstants.Entity.MO)
            {
                var custinfo = db.emp_CustomerLoginInformation.Where(x => x.CustomerOfficeId == ParentId).FirstOrDefault();
                if (custinfo != null)
                {
                    if (string.IsNullOrEmpty(custinfo.CLAccountId))
                    {
                        return(custinfo.MasterIdentifier);
                    }
                    else
                    {
                        return(custinfo.CLAccountId);
                    }
                }
                else
                {
                    return("");
                }
            }
            else
            {
                return("");
            }
        }
Пример #2
0
        /// <summary>
        /// This Method is used to Get the Main Office Configuration Details
        /// </summary>
        /// <returns></returns>
        public IQueryable <SubSiteFeeDTO> GetSubSiteFeeById(Guid UserId)
        {
            try
            {
                DropDownService ddService = new DropDownService();

                List <EntityHierarchyDTO> EntityHierarchyDTOs = new List <EntityHierarchyDTO>();
                EntityHierarchyDTOs = ddService.GetEntityHierarchies(UserId);

                Guid TopParentId       = Guid.Empty;
                Guid FeeSourceParentId = Guid.Empty;

                if (EntityHierarchyDTOs.Count > 0)
                {
                    var TopFromHierarchy = EntityHierarchyDTOs.OrderByDescending(o => o.Customer_Level).FirstOrDefault();
                    TopParentId = TopFromHierarchy.CustomerId ?? Guid.Empty;

                    var FeeSource = EntityHierarchyDTOs.Where(o => o.EntityId == o.FeeSourceEntityId).FirstOrDefault();
                    if (FeeSource != null)
                    {
                        FeeSourceParentId = FeeSource.CustomerId ?? Guid.Empty;
                    }
                    else
                    {
                        FeeSourceParentId = TopParentId;
                    }
                }



                db = new DatabaseEntities();
                var DBQuery = (from sfc in db.SubSiteFeeConfigs
                               where (sfc.StatusCode == EMPConstants.Active) && sfc.emp_CustomerInformation_ID == TopParentId
                               select sfc);
                List <SubSiteFeeDTO> lstsbfee = new List <SubSiteFeeDTO>();
                foreach (var qr in DBQuery)
                {
                    SubSiteFeeDTO odto = new SubSiteFeeDTO();
                    odto.Id                    = qr.ID.ToString();
                    odto.refId                 = qr.emp_CustomerInformation_ID.ToString();
                    odto.IsAddOnFeeCharge      = qr.IsAddOnFeeCharge;
                    odto.IsSameforAll          = qr.IsSameforAll;
                    odto.IsSubSiteAddonFee     = qr.IsSubSiteAddonFee;
                    odto.ServiceorTransmission = qr.ServiceorTransmission;
                    odto.SubSiteBankFees       = db.SubSiteBankFeesConfigs.Where(a => a.SubSiteFeeConfig_ID == qr.ID).Select(a => new SubSiteBankFeesDTO
                    {
                        BankMaster_ID   = a.BankMaster_ID.ToString(),
                        BankMaxFees     = a.BankMaxFees,
                        BankMaxFees_MSO = a.BankMaxFees_MSO
                    }).ToList();
                    lstsbfee.Add(odto);
                }
                return(lstsbfee.AsQueryable());
            }
            catch (Exception ex)
            {
                EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "SubSiteFeeService/GetSubSiteFeeById", UserId);
                return(new List <SubSiteFeeDTO>().AsQueryable());
            }
        }
Пример #3
0
        /// <summary>
        /// Acessa a pagina de detalhes do funcionario selecionado
        /// </summary>
        /// <param name="id"></param>
        /// <param name="modo"></param>
        /// <returns></returns>
        public ActionResult FichaCadastral(int id, string modo)
        {
            //ViewBag.ComboPerfil =
            //PopulaCombos();
            bool editar = (modo == "edit");

            using (EntityApplication <Cargo> app = new EntityApplication <Cargo>())
            {
                ViewData["cmbCargos"] = new DropDownService().GerarComboSelect(fonte: app.ObterTodos(), campoValor: "Id", campoTexto: "Nome");
            }

            using (EntityApplication <Modalidade> app = new EntityApplication <Modalidade>())
            {
                ViewData["cmbModalidade"] = new DropDownService().GerarComboSelect(app.ObterTodos(), "Id", "NomeModalidade");
            }

            using (EntityApplication <EstadoCivil> app = new EntityApplication <EstadoCivil>())
            {
                ViewData["cmbEstadoCivil"] = new DropDownService().GerarComboSelect(app.ObterTodos(), "Id", "Nome");
            }

            ViewBag.TituloDaPagina = "Ficha Cadastral";
            ViewBag.Editar         = editar;
            ViewBag.Modo           = modo;

            FuncionarioViewModel funcionario;

            if (modo == "edit" || modo == "read")
            {
                funcionario = Mapper.Map <Funcionario, FuncionarioViewModel>(_app.ObtemFuncionario(id));
            }
            else
            {
                funcionario = new FuncionarioViewModel();
            }

            using (ContratoApplication cApp = new ContratoApplication())
            {
                funcionario.Contrato = cApp.RecuperaContratoPorFuncionario(funcionario.Id);
            }


            return(View(funcionario));
        }
Пример #4
0
        public bool setDefaultBank(Guid CustomerId, Guid UserId, Guid BankId)
        {
            DropDownService           ddService           = new DropDownService();
            List <EntityHierarchyDTO> EntityHierarchyDTOs = new List <EntityHierarchyDTO>();

            EntityHierarchyDTOs = ddService.GetEntityHierarchies(UserId);

            Guid TopParentId = Guid.Empty;

            if (EntityHierarchyDTOs.Count > 0)
            {
                var TopFromHierarchy = EntityHierarchyDTOs.OrderByDescending(o => o.Customer_Level).FirstOrDefault();
                TopParentId = TopFromHierarchy.CustomerId ?? Guid.Empty;
            }

            var result = db.SetDefaultBankSP(CustomerId.ToString(), UserId.ToString(), BankId.ToString());
            var res1   = db.OfficeManagementGridSP(CustomerId.ToString(), CustomerId.ToString(), TopParentId == Guid.Empty ? null : TopParentId.ToString());

            return(true);
        }
Пример #5
0
        public ActionResult FichaCadastral(int id, string modo)
        {
            //ViewBag.ComboPerfil =
            //PopulaCombos();
            bool editar = (modo == "edit");

            using (EntityApplication <Cargo> app = new EntityApplication <Cargo>())
            {
                ViewData["cmbCargos"] = new DropDownService().HtmlCombo(app.ObterTodos(), "Id", "Nome");
            }

            using (EntityApplication <Modalidade> app = new EntityApplication <Modalidade>())
            {
                ViewData["cmbModalidade"] = new DropDownService().HtmlCombo(app.ObterTodos(), "Id", "NomeModalidade");
            }

            using (EntityApplication <EstadoCivil> app = new EntityApplication <EstadoCivil>())
            {
                ViewData["cmbEstadoCivil"] = new DropDownService().HtmlCombo(app.ObterTodos(), "Id", "Nome");
            }


            ViewBag.TituloDaPagina = "Ficha Cadastral";
            ViewBag.Editar         = editar;
            ViewBag.Modo           = modo;
            Funcionario funcionario;

            if (modo == "edit" || modo == "read")
            {
                funcionario = _app.ObtemFuncionario(id);
            }
            else
            {
                funcionario = new Funcionario();
            }

            return(View(funcionario));
        }
        protected override async Task OnInitializedAsync()
        {
            Users = await UserService.GetUsersAsync();

            GenderEnumItems = await DropDownService.GetGenderEnumItemsAsync();

            IsEnabledEnumItems = await DropDownService.GetIsEnabledEnumItemsAsync();

            RoleEnumItems = await DropDownService.GetRoleEnumItemsAsync();

            //await BindItemQueryAsync(Users, new QueryPageOptions
            //{
            //    Filters = null,
            //    PageIndex = 1,
            //    PageItems = 10,
            //    Searchs = null,
            //    SearchText = null,
            //    SortName = null,
            //    SortOrder = SortOrder.Unset
            //});

            await base.OnInitializedAsync();
        }
Пример #7
0
        public List <FeeSetupReportDTO> GetNoBankAppSubmissionReport(string strguid)
        {
            try
            {
                db = new DatabaseEntities();
                List <string> lstCustGuid     = strguid.Split(',').ToList();
                List <Guid>   BE_CustomerList = db.BankEnrollments.Where(x => x.IsActive == true && x.StatusCode != EMPConstants.Ready && x.ArchiveStatusCode != EMPConstants.Archive).Select(a => a.CustomerId ?? Guid.Empty).ToList();
                //List<Guid> ES_CustomerList = (from be in db.EnrollmentBankSelections
                //                                  // join ssbc in db.SubSiteBankConfigs on new { x1 = be.BankId, x2 = be.CustomerId } equals new { x1 = ssbc.BankMaster_ID, x2 = ssbc.emp_CustomerInformation_ID }
                //                              where !BE_CustomerList.Contains(be.CustomerId) && be.StatusCode == EMPConstants.Active
                //                              select be.CustomerId).ToList();

                //var data = (from cu in db.emp_CustomerInformation
                //            join cl in db.emp_CustomerLoginInformation on cu.Id equals cl.CustomerOfficeId
                //            where ES_CustomerList.Contains(cu.Id) && cl.CrossLinkUserId != null
                //            select new { cu, cl }).Take(1);
                List <ReportCustomerModel> data = new List <ReportCustomerModel>();
                EnrollmentBankSelectionInfo.EnrollmentBankSelectionService oService = new EnrollmentBankSelectionInfo.EnrollmentBankSelectionService();
                if (db.emp_CustomerInformation.Any(a => lstCustGuid.Contains(a.Id.ToString())))
                {
                    List <string> lstGuids = GetChildData(lstCustGuid);

                    data = (from cu in db.emp_CustomerInformation
                            join cl in db.emp_CustomerLoginInformation on cu.Id equals cl.CustomerOfficeId
                            where !BE_CustomerList.Contains(cu.Id) && lstGuids.Contains(cu.Id.ToString()) && cl.CrossLinkUserId != null //&& ES_CustomerList.Contains(cu.Id)
                            select new ReportCustomerModel {
                        cu = cu, cl = cl
                    }).ToList();
                }
                else
                {
                    data = (from cu in db.emp_CustomerInformation
                            join cl in db.emp_CustomerLoginInformation on cu.Id equals cl.CustomerOfficeId
                            where !BE_CustomerList.Contains(cu.Id) && cl.CrossLinkUserId != null // && ES_CustomerList.Contains(cu.Id)
                            select new ReportCustomerModel {
                        cu = cu, cl = cl
                    }).ToList();
                }

                List <FeeSetupReportDTO> lstmodel   = new List <FeeSetupReportDTO>();
                DropDownService          _ddService = new DropDownService();
                //if (data.Count() > 0)
                {
                    foreach (var itm in data)
                    {
                        List <Guid> ES_BankList = (from be in db.EnrollmentBankSelections
                                                   // join ssbc in db.SubSiteBankConfigs on new { x1 = be.BankId, x2 = be.CustomerId } equals new { x1 = ssbc.BankMaster_ID, x2 = ssbc.emp_CustomerInformation_ID }
                                                   where be.CustomerId == itm.cu.Id && !BE_CustomerList.Contains(be.CustomerId) && be.StatusCode == EMPConstants.Active
                                                   select be.BankId).ToList();

                        if (ES_BankList.Count > 0)
                        {
                            if (itm.cu.EntityId != (int)EMPConstants.Entity.SO && itm.cu.EntityId != (int)EMPConstants.Entity.SOME && itm.cu.EntityId != (int)EMPConstants.Entity.SOME_SS)
                            {
                                List <EntityHierarchyDTO> EntityHierarchyDTOs = new List <EntityHierarchyDTO>();
                                EntityHierarchyDTOs = _ddService.GetEntityHierarchies(itm.cu.Id);

                                Guid TopParentId = Guid.Empty;
                                if (EntityHierarchyDTOs.Count > 0)
                                {
                                    var TopFromHierarchy = EntityHierarchyDTOs.OrderByDescending(o => o.Customer_Level).FirstOrDefault();
                                    TopParentId = TopFromHierarchy.CustomerId ?? Guid.Empty;

                                    var SubSiteBankConfigs = db.SubSiteBankConfigs.Where(o => o.emp_CustomerInformation_ID == TopParentId && ES_BankList.Contains(o.BankMaster_ID)).Select(o => o.BankMaster_ID).ToList();
                                    if (SubSiteBankConfigs.Count() == 0)
                                    {
                                        continue;
                                    }
                                    //  SubSiteBankConfigs
                                }
                                else
                                {
                                    var SubSiteBankConfigs = db.SubSiteBankConfigs.Where(o => o.emp_CustomerInformation_ID == itm.cu.Id && ES_BankList.Contains(o.BankMaster_ID)).Select(o => o.BankMaster_ID).ToList();
                                    if (SubSiteBankConfigs.Count() == 0)
                                    {
                                        continue;
                                    }
                                }
                            }

                            FeeSetupReportDTO omodel = new FeeSetupReportDTO();
                            omodel.UserID = itm.cl.EMPUserId;

                            if (itm.cu.ParentId != null)
                            {
                                omodel.ParentUserID = db.emp_CustomerLoginInformation.Where(a => a.CustomerOfficeId == itm.cu.ParentId).Select(a => a.CrossLinkUserId).FirstOrDefault();
                            }
                            else
                            {
                                omodel.ParentUserID = "";
                            }
                            omodel.CompanyName  = itm.cu.CompanyName;
                            omodel.Efin         = itm.cu.EFIN.ToString().PadLeft(6, '0');
                            omodel.MasterID     = itm.cl.MasterIdentifier;
                            omodel.AccountOwner = itm.cu.BusinessOwnerFirstName;
                            lstmodel.Add(omodel);
                        }
                    }
                }

                return(lstmodel.OrderBy(a => a.CompanyName).ToList());
            }
            catch (Exception ex)
            {
                EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "ReportsService/GetNoBankAppSubmissionReport", Guid.Empty);
                return(new List <FeeSetupReportDTO>());
            }
        }
        public IQueryable <SubSiteBankFeeConfigDTO> SubSiteOfficeBankFee(Guid UserId)
        {
            try
            {
                DropDownService           ddService           = new DropDownService();
                List <EntityHierarchyDTO> EntityHierarchyDTOs = new List <EntityHierarchyDTO>();
                EntityHierarchyDTOs = ddService.GetEntityHierarchies(UserId);

                Guid ParentId          = Guid.Empty;
                Guid FeeSourceParentId = Guid.Empty;

                if (EntityHierarchyDTOs.Count > 0)
                {
                    var TopFromHierarchy = EntityHierarchyDTOs.OrderByDescending(o => o.Customer_Level).FirstOrDefault();
                    ParentId = TopFromHierarchy.CustomerId ?? Guid.Empty;
                }

                db = new DatabaseEntities();
                List <int> FeeFor = new List <int>();
                FeeFor.Add((int)EMPConstants.FeesFor.SVBFees);
                FeeFor.Add((int)EMPConstants.FeesFor.TransmissionFees);
                List <SubSiteBankFeeConfigDTO> ListDTO = new List <SubSiteBankFeeConfigDTO>();

                if (EntityHierarchyDTOs.Count <= 1)
                {
                    var data = (from fee in db.FeeMasters
                                                                        //join cust in db.CustomerAssociatedFees on fee.Id equals cust.FeeMaster_ID
                                where FeeFor.Contains(fee.FeesFor ?? 0) //&& cust.emp_CustomerInformation_ID == ParentId
                                select new { fee.FeesFor, fee.Amount }).ToList();

                    var dataa = (from s in data
                                 group s by s.FeesFor into g
                                 select new
                    {
                        feesfor = g.Key,
                        Amount = g.Sum(x => x.Amount)
                    }).ToList();



                    foreach (var itm in dataa.ToList())
                    {
                        SubSiteBankFeeConfigDTO SubSiteBankFeeConfig = new SubSiteBankFeeConfigDTO();
                        SubSiteBankFeeConfig.ServiceorTransmitter = itm.feesfor ?? 0;
                        SubSiteBankFeeConfig.AmountDSK            = itm.Amount ?? 0;
                        ListDTO.Add(SubSiteBankFeeConfig);
                    }
                }
                else
                {
                    var data = (from fee in db.FeeMasters
                                join cust in db.CustomerAssociatedFees on fee.Id equals cust.FeeMaster_ID
                                where FeeFor.Contains(fee.FeesFor ?? 0) && cust.emp_CustomerInformation_ID == ParentId
                                select new { fee.FeesFor, cust.Amount }).ToList();

                    var dataa = (from s in data
                                 group s by s.FeesFor into g
                                 select new
                    {
                        feesfor = g.Key,
                        Amount = g.Sum(x => x.Amount)
                    }).ToList();



                    foreach (var itm in dataa.ToList())
                    {
                        SubSiteBankFeeConfigDTO SubSiteBankFeeConfig = new SubSiteBankFeeConfigDTO();
                        SubSiteBankFeeConfig.ServiceorTransmitter = itm.feesfor ?? 0;
                        SubSiteBankFeeConfig.AmountDSK            = itm.Amount;
                        ListDTO.Add(SubSiteBankFeeConfig);
                    }
                }

                return(ListDTO.AsQueryable());
            }
            catch (Exception ex)
            {
                EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "CustomerPaymentOptionsService/SubSiteOfficeBankFee", UserId);
                return(null);
            }
        }
        /// <summary>
        /// This Method is used to Get SubSite Office Configuration Details
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public async Task <SubSiteOfficeConfigDTO> GetSubSiteOfficeConfigById(Guid userid, Guid parentId)
        {
            try
            {
                DropDownService           ddService           = new DropDownService();
                List <EntityHierarchyDTO> EntityHierarchyDTOs = new List <EntityHierarchyDTO>();
                EntityHierarchyDTOs = ddService.GetEntityHierarchies(userid);

                Guid ParentId = Guid.Empty;

                if (EntityHierarchyDTOs.Count > 2)
                {
                    var LevelOne = EntityHierarchyDTOs.Where(o => o.Customer_Level == 1).FirstOrDefault();
                    if (LevelOne != null)
                    {
                        ParentId = LevelOne.CustomerId ?? Guid.Empty;
                    }
                    else
                    {
                        ParentId = EntityHierarchyDTOs.Where(o => o.Customer_Level == 0).Select(o => o.CustomerId).FirstOrDefault() ?? Guid.Empty;
                    }
                }


                db = new DatabaseEntities();
                var data = await db.SubSiteOfficeConfigs.Where(o => o.RefId == userid).Select(o => new SubSiteOfficeConfigDTO
                {
                    Id    = o.Id.ToString(),
                    RefId = o.RefId.ToString(),
                    EFINListedOtherOffice       = o.EFINListedOtherOffice,
                    SiteOwnthisEFIN             = o.SiteOwnthisEFIN,
                    EFINOwnerSite               = o.EFINOwnerSite,
                    SOorSSorEFIN                = o.SOorSSorEFIN.ToString(),
                    SubSiteSendTaxReturn        = o.SubSiteSendTaxReturn,
                    SiteanMSOLocation           = o.SiteanMSOLocation,
                    IsMainSiteTransmitTaxReturn = o.IsMainSiteTransmitTaxReturn,
                    NoofTaxProfessionals        = o.NoofTaxProfessionals,
                    IsSoftwareOnNetwork         = o.IsSoftwareOnNetwork,
                    NoofComputers               = o.NoofComputers,
                    PreferredLanguage           = o.PreferredLanguage,
                    CanSubSiteLoginToEmp        = o.CanSubSiteLoginToEmp ?? false,
                    IsBusinessSoftware          = o.HasBusinessSoftware,
                    IsSharingEFIN               = o.IsSharingEFIN
                }).FirstOrDefaultAsync();

                if (data == null)
                {
                    if (EntityHierarchyDTOs.Count > 2)
                    {
                        SubSiteOfficeConfigDTO data1 = new SubSiteOfficeConfigDTO();
                        var subsiteconfig            = (from ssc in db.SubSiteOfficeConfigs where ssc.RefId == parentId select ssc).FirstOrDefault();
                        //  data1.Id = "0";
                        if (subsiteconfig != null)
                        {
                            data1.SubSiteSendTaxReturn = subsiteconfig.SubSiteSendTaxReturn;
                        }
                        else
                        {
                            data1.SubSiteSendTaxReturn = true;
                        }
                        data1.IsBusinessSoftware = db.emp_CustomerInformation.Where(x => x.Id == userid).Select(x => x.QuoteSoftwarePackage).FirstOrDefault() == EMPConstants.EnterprisePackage;
                        return(data1);
                    }
                    else
                    {
                        SubSiteOfficeConfigDTO data1 = new SubSiteOfficeConfigDTO();
                        var subsiteconfig            = (from ssc in db.SubSiteConfigurations where ssc.emp_CustomerInformation_ID == parentId select ssc).FirstOrDefault();
                        //  data1.Id = "0";
                        if (subsiteconfig != null)
                        {
                            data1.iIsSubSiteSendTaxReturn = subsiteconfig.SubSiteTaxReturn ?? 0;
                        }
                        else
                        {
                            data1.iIsSubSiteSendTaxReturn = 0;
                        }
                        data1.IsBusinessSoftware = db.emp_CustomerInformation.Where(x => x.Id == userid).Select(x => x.QuoteSoftwarePackage).FirstOrDefault() == EMPConstants.EnterprisePackage;
                        return(data1);
                    }
                }
                else
                {
                    if (EntityHierarchyDTOs.Count < 3)
                    {
                        var subsiteconfig = (from ssc in db.SubSiteConfigurations where ssc.emp_CustomerInformation_ID == parentId select ssc).FirstOrDefault();
                        if (subsiteconfig != null)
                        {
                            data.iIsSubSiteSendTaxReturn = subsiteconfig.SubSiteTaxReturn ?? 0;
                        }
                        else
                        {
                            data.iIsSubSiteSendTaxReturn = (data.SubSiteSendTaxReturn == true) ? 1 : 0;
                        }
                    }
                }
                return(data);
            }
            catch (Exception ex)
            {
                EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "CustomerPaymentOptionsService/GetSubSiteOfficeConfigById", Guid.Empty);
                return(null);
            }
        }
        /// <summary>
        /// This method is used to save and update the Sub Site Office Configuration Details
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public Guid SaveSubSiteOfficeConfigInfo(SubSiteOfficeConfigDTO dto)
        {
            db = new DatabaseEntities();
            Guid MyId                 = Guid.Empty;
            int  entityState          = 0;
            bool prevBS               = false;
            SubSiteOfficeConfig model = new SubSiteOfficeConfig();

            if (dto != null)
            {
                Guid Id, refId;
                if (Guid.TryParse(dto.Id, out Id))
                {
                    model = db.SubSiteOfficeConfigs.Where(a => a.Id == Id).FirstOrDefault();
                    if (model != null)
                    {
                        prevBS      = model.HasBusinessSoftware;
                        entityState = (int)System.Data.Entity.EntityState.Modified;
                    }
                    else
                    {
                        return(Guid.Empty);
                    }
                }
                else
                {
                    model.Id    = Guid.NewGuid();
                    entityState = (int)System.Data.Entity.EntityState.Added;
                }

                bool IsRefId = Guid.TryParse(dto.RefId, out refId);
                if (!IsRefId)
                {
                    return(Guid.Empty);
                }
                model.RefId = refId;
                model.EFINListedOtherOffice = dto.EFINListedOtherOffice ?? false;
                model.SiteOwnthisEFIN       = dto.SiteOwnthisEFIN ?? false;
                model.EFINOwnerSite         = dto.EFINOwnerSite;
                int SOorSSorEFIN = 0;
                if (int.TryParse(dto.SOorSSorEFIN, out SOorSSorEFIN))
                {
                    model.SOorSSorEFIN = SOorSSorEFIN;
                }
                else
                {
                    return(Guid.Empty);
                }

                model.CanSubSiteLoginToEmp = true;
                model.SubSiteSendTaxReturn = dto.SubSiteSendTaxReturn ?? false;
                model.SiteanMSOLocation    = dto.SiteanMSOLocation ?? false;
                model.LastUpdatedBy        = dto.UserId ?? Guid.Empty;
                model.LastUpdatedDate      = System.DateTime.Now;

                ///// Main Site Data
                model.IsMainSiteTransmitTaxReturn = dto.IsMainSiteTransmitTaxReturn;
                model.NoofTaxProfessionals        = dto.NoofTaxProfessionals;
                model.IsSoftwareOnNetwork         = dto.IsSoftwareOnNetwork;
                model.NoofComputers       = dto.NoofComputers;
                model.PreferredLanguage   = dto.PreferredLanguage;
                model.HasBusinessSoftware = dto.IsBusinessSoftware;
                model.IsSharingEFIN       = dto.IsSharingEFIN;

                if (entityState == (int)System.Data.Entity.EntityState.Added)
                {
                    model.CreatedBy   = dto.UserId ?? Guid.Empty;
                    model.CreatedDate = System.DateTime.Now;
                    db.SubSiteOfficeConfigs.Add(model);
                }
                else
                {
                    db.Entry(model).State = System.Data.Entity.EntityState.Modified;
                }

                //var enrollconfig = db.EnrollmentOfficeConfigurations.Where(x => x.CustomerId == refId && x.StatusCode == EMPConstants.Active).FirstOrDefault();
                //if (enrollconfig != null)
                //{
                //    enrollconfig.IsSoftwareOnNetwork = dto.IsSoftwareOnNetwork;
                //    enrollconfig.LastUpdatedBy = dto.UserId ?? Guid.Empty;
                //    enrollconfig.LastUpdatedDate = DateTime.Now;
                //    enrollconfig.NoofComputers = dto.NoofComputers;
                //    enrollconfig.NoofTaxProfessionals = dto.NoofTaxProfessionals;
                //    enrollconfig.PreferredLanguage = dto.PreferredLanguage;
                //}

                //if (model.SOorSSorEFIN == 3 && model.LastUpdatedBy != Guid.Empty)
                //{
                //    var emp_Info = db.emp_CustomerInformation.Where(o => o.Id == dto.UserId).FirstOrDefault();
                //    if (emp_Info != null)
                //    {
                //        emp_Info.IsAdditionalEFINAllowed = true;
                //        db.Entry(emp_Info).State = System.Data.Entity.EntityState.Modified;
                //    }
                //}


                var emp_MyInfo = db.emp_CustomerInformation.Where(o => o.Id == refId).FirstOrDefault();
                if (emp_MyInfo != null)
                {
                    var emp_ParentInfo = db.emp_CustomerInformation.Where(o => o.Id == emp_MyInfo.ParentId).FirstOrDefault();
                    if (emp_ParentInfo != null)
                    {
                        MyId = emp_MyInfo.Id;

                        if (emp_ParentInfo.EntityId == (int)EMPConstants.Entity.MO)
                        {
                            if (model.SOorSSorEFIN == 1)
                            {
                                emp_MyInfo.EROType  = "Multi Office - Single Office";
                                emp_MyInfo.EntityId = (int)EMPConstants.Entity.MO_SO;
                            }
                            else if (model.SOorSSorEFIN == 3)
                            {
                                emp_MyInfo.EROType  = "Multi Office - Additional EFIN";
                                emp_MyInfo.EntityId = (int)EMPConstants.Entity.MO_AE;
                            }
                        }
                        else if (emp_ParentInfo.EntityId == (int)EMPConstants.Entity.SVB_MO)
                        {
                            if (model.SOorSSorEFIN == 1)
                            {
                                emp_MyInfo.EROType  = "Service Bureau - Multi Office - Single Office";
                                emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_MO_SO;
                            }
                            else if (model.SOorSSorEFIN == 3)
                            {
                                emp_MyInfo.EROType  = "Service Bureau - Multi Office - Additional EFIN";
                                emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_MO_AE;
                            }
                        }
                        else if (emp_ParentInfo.EntityId == (int)EMPConstants.Entity.SVB)
                        {
                            if (model.SOorSSorEFIN == 1)
                            {
                                emp_MyInfo.EROType  = "Service Bureau - Single Office";
                                emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_SO;
                            }
                            else if (model.SOorSSorEFIN == 2)
                            {
                                emp_MyInfo.EROType  = "Service Bureau - Multi Office";
                                emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_MO;
                            }
                            else if (model.SOorSSorEFIN == 3)
                            {
                                emp_MyInfo.EROType  = "Service Bureau - Additional EFIN";
                                emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_AE;
                            }
                        }

                        if (model.SOorSSorEFIN == 3)
                        {
                            emp_MyInfo.IsAdditionalEFINAllowed = true;
                        }

                        if (emp_MyInfo.EFINStatus == (int)EMPConstants.EFINStatus_ForSub.Sharing && model.SiteOwnthisEFIN == false)
                        {
                            var UserId = model.EFINOwnerSite;
                            if (!string.IsNullOrEmpty(UserId))
                            {
                                var UserMain = (from emp in db.emp_CustomerInformation
                                                join emplog in db.emp_CustomerLoginInformation
                                                on emp.Id equals emplog.CustomerOfficeId
                                                where emplog.EMPUserId == UserId
                                                select new { emp.EFIN }).FirstOrDefault();

                                if (UserMain != null)
                                {
                                    emp_MyInfo.EFIN = UserMain.EFIN ?? 0;
                                }
                            }
                        }

                        db.Entry(emp_MyInfo).State = System.Data.Entity.EntityState.Modified;
                    }

                    if (emp_MyInfo.IsActivationCompleted == 1)
                    {
                        if (prevBS != dto.IsBusinessSoftware && dto.IsBusinessSoftware)
                        {
                            var loginfo = db.emp_CustomerLoginInformation.Where(x => x.CustomerOfficeId == refId).FirstOrDefault();

                            var sy = db.SalesYearMasters.Where(x => x.Id == emp_MyInfo.SalesYearID).Select(x => x.SalesYear).FirstOrDefault();
                            CustomerInformationService cis = new CustomerInformation.CustomerInformationService();
                            cis.SaveEmpCsrData(refId, "Business Software", emp_MyInfo.SalesforceAccountID, sy.Value.ToString());

                            EmailNotification _email = new EmailNotification();
                            _email.CreatedBy    = dto.UserId ?? Guid.Empty;
                            _email.CreatedDate  = DateTime.Now;
                            _email.EmailCC      = "";
                            _email.EmailContent = "";
                            _email.EmailSubject = "Business Software";
                            _email.EmailTo      = EMPConstants.SupportutaxEmail;
                            _email.EmailType    = (int)EMPConstants.EmailTypes.BusinessSoftware;
                            _email.IsSent       = false;
                            _email.Parameters   = loginfo.EMPUserId + "$|$" + loginfo.MasterIdentifier + "$|$" + dto.IsBusinessSoftware;
                            db.EmailNotifications.Add(_email);
                        }
                    }
                    if (prevBS != dto.IsBusinessSoftware && dto.IsBusinessSoftware && emp_MyInfo.EntityId != (int)EMPConstants.Entity.SO)
                    {
                        var loginfo    = db.emp_CustomerLoginInformation.Where(x => x.CustomerOfficeId == refId).FirstOrDefault();
                        var parentinfo = db.emp_CustomerInformation.Where(x => x.Id == emp_MyInfo.ParentId).FirstOrDefault();
                        var parentsb   = db.MainOfficeConfigurations.Where(x => x.emp_CustomerInformation_ID == emp_MyInfo.ParentId).Select(x => x.HasBusinessSoftware).FirstOrDefault();
                        if (parentinfo != null)
                        {
                            if (parentinfo.QuoteSoftwarePackage != EMPConstants.EnterprisePackage && !parentsb)
                            {
                                EmailNotification _email = new EmailNotification();
                                _email.CreatedBy    = dto.UserId ?? Guid.Empty;
                                _email.CreatedDate  = DateTime.Now;
                                _email.EmailCC      = "";
                                _email.EmailContent = "";
                                _email.EmailSubject = "Business Software";
                                _email.EmailTo      = EMPConstants.accountutaxEmail;
                                _email.EmailType    = (int)EMPConstants.EmailTypes.BusinessSoftware;
                                _email.IsSent       = false;
                                _email.Parameters   = loginfo.EMPUserId + "$|$" + loginfo.MasterIdentifier + "$|$" + dto.IsBusinessSoftware;
                                db.EmailNotifications.Add(_email);
                            }
                        }
                    }
                }
            }

            try
            {
                db.SaveChanges();
                db.Dispose();

                if (MyId != Guid.Empty)
                {
                    DropDownService ddService = new DropDownService();
                    var             items     = ddService.GetBottomToTopHierarchy(MyId);
                }

                return(model.Id);
            }
            catch (Exception ex)
            {
                EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "CustomerPaymentOptionsService/SaveSubSiteOfficeConfigInfo", Guid.Empty);
                return(Guid.Empty);
            }
        }
Пример #11
0
        // public DatabaseEntities db = new DatabaseEntities();

        //public IQueryable<ChangePasswordModel> GetAll()
        //{
        //    db = new DatabaseEntities();
        //    var data = db.emp_CustomerLoginInformation.Select(o => new ChangePasswordModel
        //    {
        //        Id = o.Id,
        //        EMPPassword = o.EMPPassword,
        //        CustomerOfficeId = o.CustomerOfficeId,
        //        StatusCode = o.StatusCode
        //    }).DefaultIfEmpty();
        //    return data;
        //}

        public CustomerLoginModel Get(CustomerLoginModel _Dto, string userip)
        {
            try
            {
                DropDownService           ddService           = new DropDownService();
                List <EntityHierarchyDTO> EntityHierarchyDTOs = new List <EntityHierarchyDTO>();

                db = new DatabaseEntities();
                //var data2 = db.emp_CustomerLoginInformation.ToList();
                string EMPPassword = PasswordManager.CryptText(_Dto.EMPPassword); // _Dto.EMPPassword
                var    data        = (from ci in db.emp_CustomerInformation
                                      join cli in db.emp_CustomerLoginInformation on ci.Id equals cli.CustomerOfficeId
                                      join entMas in db.EntityMasters on ci.EntityId equals entMas.Id
                                      where cli.EMPUserId == _Dto.EMPUserId && cli.EMPPassword == EMPPassword && (ci.StatusCode == EMPConstants.Active || ci.StatusCode == EMPConstants.Pending)
                                      //&& ci.IsHold != true//ci.StatusCode == EMPConstants.Created ||
                                      select new { ci, cli, EntityId = entMas.Id, entMas.BaseEntityId }).FirstOrDefault();

                if (data != null)
                {
                    if ((data.ci.IsHold ?? false) && data.ci.EntityId != (int)EMPConstants.Entity.SO && data.ci.EntityId != (int)EMPConstants.Entity.MO && data.ci.EntityId != (int)EMPConstants.Entity.SVB)
                    {
                        _Dto.Id      = Guid.Empty;
                        _Dto.Message = "Your site has been placed on hold, please contact your Software Provider";
                        return(_Dto);
                    }
                    _Dto.Id = data.cli.Id;
                    _Dto.CustomerOfficeId = data.cli.CustomerOfficeId;

                    //11212016
                    _Dto.EFIN       = data.ci.EFIN;
                    _Dto.EFINStatus = data.ci.EFINStatus;

                    _Dto.TaxOfficeUsername = data.cli.TaxOfficeUsername;
                    _Dto.CrossLinkUserId   = data.cli.CrossLinkUserId;

                    _Dto.IsChangedPassword     = (data.cli.CrossLinkPassword == data.cli.EMPPassword) ? true : false;
                    _Dto.IsSetSecurityQuestion = db.SecurityAnswerUserMaps.Where(o => o.UserId == data.cli.CustomerOfficeId).Any();
                    _Dto.Token       = _TokenService.GenerateToken(data.ci.Id, userip);
                    _Dto.ParentID    = data.ci.ParentId.ToString();
                    _Dto.SalesYearID = data.ci.SalesYearID.ToString();
                    //_Dto.EntityDisplayID = data.DisplayId;
                    _Dto.BaseEntityId = data.BaseEntityId;
                    // _Dto.EntityID = data.EntityId;
                    _Dto.EntityID = data.ci.EntityId;//.ToString();

                    _Dto.IsMSOUser             = data.ci.IsMSOUser ?? false;
                    _Dto.IsActivationCompleted = data.ci.IsActivationCompleted ?? 0;
                    _Dto.IsEnrollmentSubmit    = new SubSiteFeeService().IsEnrollmentSubmit(data.ci.Id);
                    _Dto.IsVerified            = data.ci.IsVerified ?? false;

                    _Dto.uTaxNotCollectingSBFee = data.ci.uTaxNotCollectingSBFee ?? false;

                    _Dto.IsTaxReturn = true;
                    if (data.ci.ParentId == Guid.Empty || data.ci.ParentId == null)
                    {
                        var taxreturn = db.MainOfficeConfigurations.Where(x => x.emp_CustomerInformation_ID == data.ci.Id && x.StatusCode == EMPConstants.Active).FirstOrDefault();
                        if (taxreturn != null)
                        {
                            _Dto.IsTaxReturn = taxreturn.IsSiteTransmitTaxReturns;
                        }
                    }
                    _Dto.IsHold = data.ci.IsHold ?? false;

                    Guid TopParentId = Guid.Empty;
                    EntityHierarchyDTOs = ddService.GetEntityHierarchies(data.ci.Id);
                    var TopFromHierarchy = EntityHierarchyDTOs.OrderByDescending(o => o.Customer_Level).FirstOrDefault();
                    TopParentId = TopFromHierarchy.CustomerId ?? Guid.Empty;

                    DefaultBankModel DefaultBank = new DefaultBankModel();

                    DefaultBank = (from enrollbank in db.EnrollmentBankSelections
                                   where enrollbank.CustomerId == data.cli.CustomerOfficeId && enrollbank.StatusCode == EMPConstants.Active && enrollbank.BankSubmissionStatus == 1
                                   orderby enrollbank.BankSubmissionStatus descending, enrollbank.LastUpdatedDate descending
                                   select new DefaultBankModel {
                        BankId = enrollbank.BankId, BankSubmissionStatus = enrollbank.BankSubmissionStatus ?? 0, LastUpdatedDate = enrollbank.LastUpdatedDate
                    }).FirstOrDefault();

                    if (DefaultBank != null)
                    {
                        _Dto.BankId = DefaultBank.BankId;
                    }
                    else
                    {
                        DefaultBankModel DefaultBank2 = (from enrollbank in db.EnrollmentBankSelections
                                                         where enrollbank.CustomerId == data.cli.CustomerOfficeId && enrollbank.StatusCode == EMPConstants.Active
                                                         orderby enrollbank.BankSubmissionStatus descending, enrollbank.LastUpdatedDate descending
                                                         select new DefaultBankModel {
                            BankId = enrollbank.BankId, BankSubmissionStatus = enrollbank.BankSubmissionStatus ?? 0, LastUpdatedDate = enrollbank.LastUpdatedDate
                        }).FirstOrDefault();

                        if (DefaultBank2 != null)
                        {
                            _Dto.BankId = DefaultBank2.BankId;
                        }
                    }


                    if (_Dto.EntityID != (int)EMPConstants.Entity.SO && _Dto.EntityID != (int)EMPConstants.Entity.SOME && _Dto.EntityID != (int)EMPConstants.Entity.SOME_SS && _Dto.BankId != Guid.Empty)
                    {
                        var SSBConfig = db.SubSiteBankConfigs.Where(o => o.emp_CustomerInformation_ID == TopParentId && o.BankMaster_ID == _Dto.BankId).ToList();
                        if (SSBConfig.Count() == 0)
                        {
                            _Dto.BankId = Guid.Empty;
                        }
                    }

                    if (TopParentId != Guid.Empty)
                    {
                        if (TopParentId == data.ci.Id)
                        {
                            _Dto.CanSubSiteLoginToEmp = true;
                        }
                        else
                        {
                            if (_Dto.BaseEntityId == (int)EMPConstants.BaseEntities.AE_SS)
                            {
                                // _Dto.CanSubSiteLoginToEmp = db.SubSiteOfficeConfigs.Where(a => a.RefId.ToString() == _Dto.ParentID).Select(a => a.CanSubSiteLoginToEmp ?? false).FirstOrDefault();
                                //var SupParentData = db.emp_CustomerInformation.Where(o => o.Id == data.ci.ParentId).FirstOrDefault();
                                //if (SupParentData != null)
                                //{
                                _Dto.SupParentID = TopParentId.ToString();

                                var sscExist = (from ssc in db.SubSiteConfigurations where ssc.emp_CustomerInformation_ID == TopParentId select ssc).FirstOrDefault();
                                if (sscExist != null)
                                {
                                    if (sscExist.IsuTaxManageingEnrolling == true)
                                    {
                                        _Dto.CanSubSiteLoginToEmp = true;
                                    }
                                    else
                                    {
                                        if (sscExist.IsuTaxPortalEnrollment == true)
                                        {
                                            _Dto.CanSubSiteLoginToEmp = true;
                                        }
                                        else
                                        {
                                            _Dto.CanSubSiteLoginToEmp = false;
                                        }
                                    }
                                }



                                var subSiteOfficeCo = (from ssc in db.SubSiteOfficeConfigs where ssc.RefId == _Dto.CustomerOfficeId select ssc).FirstOrDefault();
                                if (subSiteOfficeCo != null)
                                {
                                    if (subSiteOfficeCo.EFINListedOtherOffice == false)
                                    {
                                        _Dto.EFINOwnerUserId = false;
                                    }
                                    else
                                    {
                                        if (subSiteOfficeCo.SiteOwnthisEFIN == false)
                                        {
                                            _Dto.EFINOwnerUserId = true;
                                        }
                                        else
                                        {
                                            _Dto.EFINOwnerUserId = false;
                                        }
                                    }
                                }
                                //}
                            }
                            else
                            {
                                // _Dto.CanSubSiteLoginToEmp = db.SubSiteConfigurations.Where(a => a.emp_CustomerInformation_ID.ToString() == _Dto.ParentID).Select(a => a.CanSubSiteLoginToEmp).FirstOrDefault();

                                var sscExist = (from ssc in db.SubSiteConfigurations where ssc.emp_CustomerInformation_ID == TopParentId select ssc).FirstOrDefault();
                                if (sscExist != null)
                                {
                                    if (sscExist.IsuTaxManageingEnrolling == true)
                                    {
                                        _Dto.CanSubSiteLoginToEmp = true;
                                    }
                                    else
                                    {
                                        if (sscExist.IsuTaxPortalEnrollment == true)
                                        {
                                            _Dto.CanSubSiteLoginToEmp = true;
                                        }
                                        else
                                        {
                                            _Dto.CanSubSiteLoginToEmp = false;
                                        }
                                    }
                                }


                                var subSiteOfficeCo = (from ssc in db.SubSiteOfficeConfigs where ssc.RefId == _Dto.CustomerOfficeId select ssc).FirstOrDefault();
                                if (subSiteOfficeCo != null)
                                {
                                    if (subSiteOfficeCo.EFINListedOtherOffice == false)
                                    {
                                        _Dto.EFINOwnerUserId = false;
                                    }
                                    else
                                    {
                                        if (subSiteOfficeCo.SiteOwnthisEFIN == false)
                                        {
                                            _Dto.EFINOwnerUserId = true;
                                        }
                                        else
                                        {
                                            _Dto.EFINOwnerUserId = false;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        _Dto.CanSubSiteLoginToEmp = true;
                    }


                    if (_Dto.EntityID == (int)EMPConstants.Entity.SOME_SS)
                    {
                        _Dto.CanSubSiteLoginToEmp = true;
                    }

                    EntityHierarchyDTOs = ddService.GetEntityHierarchies(_Dto.Id);

                    Guid ParentId = Guid.Empty;
                    int  Level    = EntityHierarchyDTOs.Count;
                    if (EntityHierarchyDTOs.Count > 0)
                    {
                        var LevelOne = EntityHierarchyDTOs.OrderByDescending(o => o.Customer_Level).FirstOrDefault();
                        if (LevelOne != null)
                        {
                            ParentId = LevelOne.CustomerId ?? Guid.Empty;
                        }

                        if (EntityHierarchyDTOs.Count > 1)
                        {
                            _Dto.IsMSOUser = db.emp_CustomerInformation.Where(o => o.Id == ParentId).Select(o => o.IsMSOUser).FirstOrDefault() ?? false;
                        }
                    }
                }
                else
                {
                    return(null);
                }
                return(_Dto);
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex.ToString(), "CustomerLogin/Get", Guid.Empty);
                return(null);
            }
        }
Пример #12
0
        /// <summary>
        /// This Method is used to Get the Main Office Configuration Details
        /// </summary>
        /// <returns></returns>
        public async Task <SubSiteDTO> GetById(Guid userid)
        {
            try
            {
                DropDownService           ddService           = new DropDownService();
                List <EntityHierarchyDTO> EntityHierarchyDTOs = new List <EntityHierarchyDTO>();
                EntityHierarchyDTOs = ddService.GetEntityHierarchies(userid);

                Guid ParentId = Guid.Empty;
                int  Level    = EntityHierarchyDTOs.Count;
                if (EntityHierarchyDTOs.Count == 1)
                {
                    var LevelOne = EntityHierarchyDTOs.Where(o => o.Customer_Level == 0).FirstOrDefault();
                    if (LevelOne != null)
                    {
                        ParentId = LevelOne.CustomerId ?? Guid.Empty;
                    }
                }
                else
                {
                    var LevelOne = EntityHierarchyDTOs.Where(o => o.Customer_Level == 1).FirstOrDefault();
                    if (LevelOne != null)
                    {
                        ParentId = LevelOne.CustomerId ?? Guid.Empty;
                    }
                }

                userid = ParentId;

                db = new DatabaseEntities();
                var data = await db.SubSiteConfigurations.Where(o => (o.StatusCode == EMPConstants.Active || o.StatusCode == EMPConstants.Pending) && o.emp_CustomerInformation_ID == userid).Select(o => new SubSiteDTO
                {
                    Id    = o.ID.ToString(),
                    refId = o.emp_CustomerInformation_ID.ToString(),
                    IsuTaxManageingEnrolling = o.IsuTaxManageingEnrolling,
                    IsuTaxPortalEnrollment   = o.IsuTaxPortalEnrollment,
                    IsuTaxManageOnboarding   = o.IsuTaxManageOnboarding,
                    EnrollmentEmails         = o.EnrollmentEmails ?? false,
                    IsuTaxCustomerSupport    = o.IsuTaxCustomerSupport,
                    NoofSupportStaff         = o.NoofSupportStaff,
                    NoofDays                     = o.NoofDays,
                    OpenHours                    = o.OpenHours.Value.ToString(),  // "hh:mm tt"),// "hh:mm tt"),
                    CloseHours                   = o.CloseHours.Value.ToString(), //"hh:mm tt"),//"hh:mm tt"),
                    TimeZone                     = o.TimeZone.ToString(),
                    SubSiteTaxReturn             = o.SubSiteTaxReturn,
                    IsAutoEnrollAffiliateProgram = o.IsAutoEnrollAffiliateProgram,
                    IsSubSiteEFINAllow           = o.IsSubSiteEFINAllow,
                    CanSubSiteLoginToEmp         = o.CanSubSiteLoginToEmp,
                    Affiliates                   = o.SubSiteAffiliateProgramConfigs.Select(s => new SubSiteAffiliateProgramDTO()
                    {
                        AffiliateProgramId = s.AffiliateProgramMaster_ID
                    }).ToList(),
                    SubSiteBankQuestions = o.SubSiteBankConfigs.Select(s => new SubSiteBankQuestionDTO()
                    {
                        BankId = s.BankMaster_ID, QuestionId = s.SubQuestion_ID ?? Guid.Empty
                    }).ToList()
                }).FirstOrDefaultAsync();

                if (data != null)
                {
                    DateTime dt  = new DateTime();
                    bool     res = DateTime.TryParse(data.OpenHours, out dt);
                    string   ddt = new DateTime().Add(dt.TimeOfDay).ToString("hh:mm tt");
                    data.OpenHours = ddt;

                    DateTime dt1  = new DateTime();
                    bool     res1 = DateTime.TryParse(data.CloseHours, out dt1);
                    string   ddt1 = new DateTime().Add(dt1.TimeOfDay).ToString("hh:mm tt");
                    data.CloseHours = ddt1;
                }
                else
                {
                    if (Level > 2)
                    {
                        data = new DTO.SubSiteDTO();
                        var SubSiteOfficeCon = db.SubSiteOfficeConfigs.Where(o => o.RefId == ParentId).FirstOrDefault();

                        if (SubSiteOfficeCon != null)
                        {
                            if (SubSiteOfficeCon.SOorSSorEFIN == 2 || SubSiteOfficeCon.SOorSSorEFIN == 3)
                            {
                                data.IsSubSiteEFINAllow = true;
                            }
                        }
                    }

                    // OpenHours = new DateTime().Add(o.OpenHours.Value).ToString("hh:mm tt"),// "hh:mm tt"),
                    //     CloseHours = new DateTime().Add(o.CloseHours.Value).ToString("hh:mm tt"),//"hh:mm tt"),
                }

                return(data);
            }
            catch (Exception ex)
            {
                EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "SubSiteConfigService/GetById", userid);
                return(null);
            }
        }
Пример #13
0
 public GamesController(DropDownService dropDownService, GamesService gamesService)
 {
     this.dropDownService = dropDownService;
     this.gamesService    = gamesService;
 }
Пример #14
0
        public int Save(CustomerLoginInformationModel model)
        {
            int entityState = 0;
            emp_CustomerLoginInformation customerLoginInformation = new emp_CustomerLoginInformation();

            if (model != null)
            {
                Guid newguid1;
                Guid CustomerOfficeId = model.CustomerOfficeId ?? Guid.Empty;
                if (Guid.TryParse(model.Id, out newguid1))
                {
                    //var ExistCust = db.emp_CustomerLoginInformation.Any(a => a.EFIN == model.EFIN && a.Id != newguid1);
                    //if (ExistCust)
                    //    return -1;

                    //11212016 - If

                    int EFIN = model.EFIN ?? 0;
                    if (EFIN > 0 && (model.EFINStatus == 16 || model.EFINStatus == 19))
                    {
                        //if (CustomerOfficeId != Guid.Empty)
                        //{
                        var ExistCust = db.emp_CustomerInformation.Any(a => a.EFIN == model.EFIN && a.Id != CustomerOfficeId);
                        if (ExistCust)
                        {
                            return(-1);
                        }
                        //}
                    }

                    var ExistCrossCust = db.emp_CustomerLoginInformation.Any(a => a.CrossLinkUserId == model.CrossLinkUserId && a.Id != newguid1);
                    if (ExistCrossCust)
                    {
                        return(-2);
                    }
                }

                if (string.IsNullOrEmpty(model.Id))
                {
                    customerLoginInformation.Id = Guid.NewGuid();
                }
                else
                {
                    Guid newguid;
                    if (Guid.TryParse(model.Id, out newguid))
                    {
                        customerLoginInformation.Id = newguid;
                        entityState = (int)System.Data.Entity.EntityState.Modified;
                    }
                }

                // customerLoginInformation.EFIN = model.EFIN;
                customerLoginInformation.MasterIdentifier  = model.MasterIdentifier;
                customerLoginInformation.CrossLinkUserId   = model.CrossLinkUserId;
                customerLoginInformation.CrossLinkPassword = PasswordManager.CryptText(model.CrossLinkPassword);// model.CrossLinkPassword;
                customerLoginInformation.OfficePortalUrl   = model.OfficePortalUrl;
                customerLoginInformation.TaxOfficeUsername = model.TaxOfficeUsername;
                customerLoginInformation.TaxOfficePassword = PasswordManager.CryptText(model.TaxOfficePassword); // model.TaxOfficePassword;
                customerLoginInformation.CustomerOfficeId  = model.CustomerOfficeId;
                customerLoginInformation.EMPPassword       = PasswordManager.CryptText(model.EMPPassword);       //model.EMPPassword;
                customerLoginInformation.EMPUserId         = model.EMPUserId;
                customerLoginInformation.StatusCode        = EMPConstants.Active;

                customerLoginInformation.CLAccountId       = model.CLAccountId;
                customerLoginInformation.CLLogin           = model.CLLogin;
                customerLoginInformation.CLAccountPassword = string.IsNullOrEmpty(model.CLAccountPassword) ? "" : PasswordManager.CryptText(model.CLAccountPassword);

                if (entityState == (int)System.Data.Entity.EntityState.Modified)
                {
                    customerLoginInformation.CreatedDate     = DateTime.Now;
                    customerLoginInformation.LastUpdatedDate = DateTime.Now;
                    customerLoginInformation.LastUpdatedBy   = model.UserId;
                    customerLoginInformation.CreatedBy       = model.UserId;
                    db.Entry(customerLoginInformation).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    db.Entry(customerLoginInformation).State = System.Data.Entity.EntityState.Added;
                    customerLoginInformation.LastUpdatedBy   = model.UserId;
                    customerLoginInformation.LastUpdatedDate = DateTime.Now;
                    db.emp_CustomerLoginInformation.Add(customerLoginInformation);
                }

                emp_CustomerInformation empCustInfo = new emp_CustomerInformation();
                empCustInfo = db.emp_CustomerInformation.Where(o => o.Id == model.CustomerOfficeId).FirstOrDefault();
                if (empCustInfo != null)
                {
                    //11212016 - 2
                    empCustInfo.EFIN          = model.EFIN;
                    empCustInfo.EFINStatus    = model.EFINStatus;
                    empCustInfo.StatusCode    = empCustInfo.IsActivationCompleted == 1 ? EMPConstants.Active : EMPConstants.Created;
                    empCustInfo.CreatedBy     = model.UserId;
                    empCustInfo.LastUpdatedBy = model.UserId;

                    if (empCustInfo.EntityId == (int)EMPConstants.Entity.SO || empCustInfo.EntityId == (int)EMPConstants.Entity.SOME)
                    {
                        if (empCustInfo.StatusCode == EMPConstants.Active || empCustInfo.IsActivationCompleted == 1)
                        {
                            empCustInfo.StatusCode            = EMPConstants.Active;
                            empCustInfo.IsActivationCompleted = 1;
                            empCustInfo.AccountStatus         = "Active";
                            if (empCustInfo.EntityId == (int)EMPConstants.Entity.SO)
                            {
                                empCustInfo.EROType = "Single Office";
                            }
                            else if (empCustInfo.EntityId == (int)EMPConstants.Entity.SOME)
                            {
                                empCustInfo.EROType = "SOME";
                            }
                        }
                    }

                    empCustInfo.CreatedDate     = System.DateTime.Now;
                    empCustInfo.LastUpdatedDate = System.DateTime.Now;

                    db.Entry(empCustInfo).State = System.Data.Entity.EntityState.Modified;
                }
            }
            try
            {
                db.SaveChanges();
                db.Dispose();

                if (model != null)
                {
                    if (model.CustomerOfficeId != Guid.Empty)
                    {
                        DropDownService ddService = new DropDownService();
                        var             items     = ddService.GetBottomToTopHierarchy(model.CustomerOfficeId ?? Guid.Empty);
                    }
                }

                return(1);
            }
            catch (Exception ex)
            {
                EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "CustomerLoginInformationService/Save", Guid.Empty);
                return(0);

                throw;
            }
        }