public IHttpActionResult Postemp_CustomerLoginInformation(CustomerLoginInformationModel dto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Guid newguid;

            if (!string.IsNullOrEmpty(dto.Id))
            {
                if (!Guid.TryParse(dto.Id, out newguid))
                {
                    return(BadRequest(ModelState));
                }
            }

            int result = customerLoginInformationService.Save(dto);

            if (result == 0)
            {
                return(NotFound());
            }
            return(Ok(result));
        }
Ejemplo n.º 2
0
        public CustomerLoginInformationModel GetParentCustomerInformation(Guid id)
        {
            CustomerLoginInformationModel model = new CustomerLoginInformationModel();

            try
            {
                Guid ParentId = id;
                var  Customer = db.emp_CustomerInformation.Where(a => a.Id == id).Select(a => new { Id = a.Id, ParentId = a.ParentId, EntityId = a.EntityId }).FirstOrDefault();


                if (Customer.EntityId == (int)EMPConstants.Entity.SOME)
                {
                    id = Customer.Id;
                }
                else if ((Customer.ParentId ?? Guid.Empty) != Guid.Empty)
                {
                    id = Customer.ParentId ?? Guid.Empty;
                    //ParentId = id_Customer.Id;
                }

                var itm = (from e in db.emp_CustomerLoginInformation
                           join c in db.emp_CustomerInformation on e.CustomerOfficeId equals c.Id
                           where c.Id == id
                           select new { e, c }).FirstOrDefault();

                if (itm != null)
                {
                    model.SalesforceParentID = itm.c.SalesforceParentID;
                    model.Id = itm.e.Id.ToString();

                    model.EFIN       = itm.c.EFIN;
                    model.EFINStatus = itm.c.EFINStatus;

                    model.ParentId               = (itm.c.ParentId ?? Guid.Empty).ToString();
                    model.MasterIdentifier       = itm.e.MasterIdentifier;
                    model.CrossLinkUserId        = itm.e.CrossLinkUserId;
                    model.CrossLinkPassword      = itm.e.CrossLinkPassword;
                    model.OfficePortalUrl        = itm.e.OfficePortalUrl;
                    model.TaxOfficeUsername      = itm.e.TaxOfficeUsername;
                    model.TaxOfficePassword      = itm.e.TaxOfficePassword;
                    model.CustomerOfficeId       = itm.e.CustomerOfficeId;
                    model.EMPPassword            = itm.e.EMPPassword;
                    model.EMPUserId              = itm.e.EMPUserId;
                    model.CompanyName            = itm.c.CompanyName;
                    model.BusinessOwnerFirstName = itm.c.BusinessOwnerFirstName;
                    model.PhysicalAddress1       = itm.c.PhysicalAddress1;
                    model.IsMSOUser              = itm.c.IsMSOUser ?? false;
                    model.CityStateZip           = itm.c.PhysicalCity + ',' + itm.c.PhysicalState + ',' + itm.c.PhysicalZipCode;
                    model.SalesforceParentID     = itm.c.SalesforceParentID;
                    model.TransmitType           = "";
                    model.IsMSOUser              = itm.c.IsMSOUser ?? false;
                    //  model.IsAdditionalEFINAllowed = itm.c.IsAdditionalEFINAllowed ?? false;

                    if ((itm.c.ParentId ?? Guid.Empty) == Guid.Empty)
                    {
                        var dbssb = db.SubSiteConfigurations.Where(a => a.emp_CustomerInformation_ID == id).FirstOrDefault();
                        if (dbssb != null)
                        {
                            if (dbssb.SubSiteTaxReturn == 1)
                            {
                                model.TransmitType = "All Sub-sites will transmit to the IRS (Transmitter) ";
                            }
                            else if (dbssb.SubSiteTaxReturn == 2)
                            {
                                model.TransmitType = "All Sub-sites will transmit to the Main Office (Feeder) ";
                            }
                            else
                            {
                                model.TransmitType = "Mixed – Some Sub-sites will transmit to the IRS and some will transmit to the Main Office ";
                            }
                        }
                    }


                    if (Customer.EntityId == (int)EMPConstants.Entity.SOME)
                    {
                        model.IsAdditionalEFINAllowed = true;
                    }
                    else if ((Customer.ParentId ?? Guid.Empty) != Guid.Empty)
                    {
                        if (ParentId != id)
                        {
                            var dbssb = db.SubSiteOfficeConfigs.Where(a => a.RefId == ParentId).FirstOrDefault();
                            if (dbssb != null)
                            {
                                //if (dbssb.SubSiteSendTaxReturn == true)
                                //    model.TransmitType = "All Sub-sites will transmit to the IRS (Transmitter) ";
                                //else if (dbssb.SubSiteSendTaxReturn == false)
                                //    model.TransmitType = "All Sub-sites will transmit to the Main Office (Feeder) ";
                                //else
                                //    model.TransmitType = "Mixed – Some Sub-sites will transmit to the IRS and some will transmit to the Main Office ";

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

                    model.MSO = "";
                    string strBank = "";

                    if (Customer.EntityId != (int)EMPConstants.Entity.SOME)
                    {
                        var dbBank = (from ssb in db.SubSiteBankConfigs
                                      join bm in db.BankMasters on ssb.BankMaster_ID equals bm.Id
                                      where ssb.emp_CustomerInformation_ID == id
                                      select new { bm, ssb });


                        foreach (var bn in dbBank)
                        {
                            if (bn.bm.BankName == "TPG")
                            {
                                strBank += bn.bm.BankName + ": ";
                                var bankqu = db.BankSubQuestions.Where(a => a.Id == bn.ssb.SubQuestion_ID).Select(a => a.Questions).FirstOrDefault() + "<br/>";
                                strBank += bankqu;
                            }
                            else
                            {
                                strBank += bn.bm.BankName + "<br/>";
                            }
                        }
                    }

                    model.Bank = strBank;
                }
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex.ToString(), "CustomerLogin/ParentCustomerInfo", id);
            }
            return(model);
        }