public DriverInterviewProfileEntity GetDriverDataByInterviewProfileID(bool isSubmitted, int interviewprofileid)
        {
            DriverInterviewProfileEntity driverSale = new DriverInterviewProfileEntity();

            using (uow = new UnitOfWork.UnitOfWork())
            {
                driverSale = uow.DriverInterviewProfileRepository.Get().Select(dv => new DriverInterviewProfileEntity
                {
                    CDLNonCDL         = dv.CDLNonCDL,
                    Class             = dv.Class,
                    IsSubmitted       = isSubmitted,
                    Date              = dv.Date,
                    DOB               = dv.DOB,
                    OrderFormID       = dv.OrderFormID,
                    DriverInterviewID = dv.DriverInterviewID,
                    DriverName        = dv.DriverName,
                    EIN               = dv.EIN,
                    Email             = dv.Email,
                    ExpirationDate    = dv.ExpirationDate,
                    LegalName         = dv.LegalName,
                    LicenseNo         = dv.LicenseNo,
                    Notes             = dv.Notes,
                    Phone             = dv.Phone,
                    SSN               = dv.SSN,
                    StatusIssued      = dv.StatusIssued,
                    Supervisor        = dv.Supervisor,
                    USDOT             = dv.USDOT,

                    DriverCargos = uow.DriverVehicleCargoRepository.Get().Where(x => x.DriverVehicleID == interviewprofileid).Select(p => new DriverVehicleCargoEntity {
                        CargoCarriedName = p.CargoCarriedName, DriverVehicleID = p.DriverVehicleID, VehicleCargoID = p.VehicleCargoID
                    }).ToList(),
                    DriverServices = uow.DriverServiceRepository.Get().Join(uow.DocumentMasterRepository.Get(), msd => msd.ServiceID, dms => dms.DocumentID, (msd, dms) => new { msd, dms })
                                     .Select(p => new DriverServiceEntity {
                        DriverServiceID = p.msd.DriverServiceID, ServiceID = (int)p.msd.ServiceID, DriverInterviewProfileID = p.msd.DriverInterviewProfileID, ServiceName = p.dms.DocumentName, ServicePrice = p.dms.Description
                    })
                                     .Where(x => x.DriverInterviewProfileID == interviewprofileid).ToList(),
                    DriverVehicle = uow.DriverVehicleRepository.Get().Where(x => x.OrderFormID == interviewprofileid).Select(p => new DriverVehicleEntity {
                        DriverVehicleInfo = p.DriverVehicleInfo, GVW = p.GVW, Make = p.Make, Model = p.Model, OrderFormID = p.OrderFormID, Year = p.Year
                    }).FirstOrDefault(),
                }).Where(x => x.DriverInterviewID == interviewprofileid && x.IsSubmitted == isSubmitted).FirstOrDefault();
            }
            return(driverSale);
        }
Exemple #2
0
        protected void btnSaveDriver_Click(object sender, EventArgs e)
        {
            interviewprofileid = Convert.ToInt32(Request.QueryString["interviewprofileid"]);
            List <DriverServiceEntity> driverServices = new List <DriverServiceEntity>();
            List <ListItem>            items          = chkServices.Items.Cast <ListItem>().Where(n => n.Selected).ToList();

            foreach (ListItem item in items)
            {
                //if (item.Selected)
                //{
                //    DriverServiceEntity driverService = new DriverServiceEntity();
                //    driverService.Service = item.Text;
                //    driverService.ServiceDetail = "";
                //    driverService.DriverInterviewProfileID = interviewprofileid;
                //    driverServices.Add(driverService);
                //}
            }

            DriverInterviewProfileEntity driverInterviewProfile = new DriverInterviewProfileEntity();

            driverInterviewProfile.Class = txtClass.Text;
            driverInterviewProfile.Date  = txtDate.Text;
            // driverInterviewProfile.DBA = txtDriverDBA.Text;
            driverInterviewProfile.DOB            = txtDOB.Text;
            driverInterviewProfile.DriverName     = txtDriverName.Text;
            driverInterviewProfile.EIN            = txtDriverEIN.Text;
            driverInterviewProfile.Email          = txtDriverEmailAddress.Text;
            driverInterviewProfile.ExpirationDate = txtExpirationDate.Text;
            driverInterviewProfile.LegalName      = txtDriverLegalName.Text;
            driverInterviewProfile.LicenseNo      = txtDriverLicense.Text;
            // driverInterviewProfile.MC = txtMC.Text;
            driverInterviewProfile.Notes        = txtNotesCommentsObservation.Text;
            driverInterviewProfile.Phone        = txtDriverPhone.Text;
            driverInterviewProfile.SSN          = txtDriverSSN.Text;
            driverInterviewProfile.StatusIssued = DropDownListState.SelectedItem.Value;
            driverInterviewProfile.Supervisor   = txtSupervisor.Text;
            driverInterviewProfile.USDOT        = txtDriverUSDOT.Text;

            driverProfileHelper.SaveDriverServices(interviewprofileid, driverInterviewProfile, driverServices);
        }
        public bool SaveDriverServices(int driverProfileID, DriverInterviewProfileEntity driverInterviewProfile, List <DriverServiceEntity> driverServices)
        {
            bool isDriverProfileSaved = false;
            DriverInterviewProfile driverInterviewProfiledb = new DriverInterviewProfile();

            driverInterviewProfiledb.Class             = driverInterviewProfile.Class;
            driverInterviewProfiledb.Date              = driverInterviewProfile.Date;
            driverInterviewProfiledb.DOB               = driverInterviewProfile.DOB;
            driverInterviewProfiledb.DriverInterviewID = driverInterviewProfile.DriverInterviewID;
            driverInterviewProfiledb.DriverName        = driverInterviewProfile.DriverName;
            driverInterviewProfiledb.OrderFormID       = driverProfileID;
            driverInterviewProfiledb.EIN               = driverInterviewProfile.EIN;
            driverInterviewProfiledb.Email             = driverInterviewProfile.Email;
            driverInterviewProfiledb.ExpirationDate    = driverInterviewProfile.ExpirationDate;
            driverInterviewProfiledb.LegalName         = driverInterviewProfile.LegalName;
            driverInterviewProfiledb.LicenseNo         = driverInterviewProfile.LicenseNo;
            driverInterviewProfiledb.Notes             = driverInterviewProfile.Notes;
            driverInterviewProfiledb.Phone             = driverInterviewProfile.Phone;
            driverInterviewProfiledb.SSN               = driverInterviewProfile.SSN;
            driverInterviewProfiledb.StatusIssued      = driverInterviewProfile.StatusIssued;
            driverInterviewProfiledb.Supervisor        = driverInterviewProfile.Supervisor;
            driverInterviewProfiledb.USDOT             = driverInterviewProfile.USDOT;
            uow.DriverInterviewProfileRepository.Insert(driverInterviewProfiledb);
            uow.Save();

            foreach (DriverServiceEntity driverService in driverServices)
            {
                DriverService driverServicedb = new DriverService();
                driverServicedb.DriverInterviewProfileID = driverInterviewProfiledb.DriverInterviewID;
                driverServicedb.ServiceID = driverService.ServiceID;
                uow.DriverServiceRepository.Insert(driverServicedb);
                uow.Save();
            }

            return(isDriverProfileSaved);
        }
        public void LoadDriverProfile()
        {
            int orderid = Convert.ToInt32(Request.QueryString["USDotSaleID"]);
            DriverSaleEntity usdotDriver = driverProfileHelper.GetSalesByOrderID(true, orderid);

            txtCardNo.Text  = usdotDriver.profileCard.CorDC;
            hidCardNo.Value = usdotDriver.profileCard.CorDC;

            ulcardtype.Attributes["class"] = usdotDriver.profileCard.CardType;


            txtExpiration.Text = usdotDriver.profileCard.Expiration;
            txtCVC.Text        = usdotDriver.profileCard.CVC;

            OrderFormEntity order = usdotDriver.orderForm;

            txtUSDOT.Text      = order.USDot;
            txtCA.Text         = order.CA;
            txtNameOnCard.Text = order.NameOnCard;
            txtName.Text       = order.Name;
            txtDBA.Text        = order.DBA;
            txtLegalName.Text  = order.LegalName;
            chkCompanyType.Items.FindByText(order.CompanyType).Selected = true;
            txtMailingAddress.Text    = order.PhysicalAddress;
            txtBillingAddress.Text    = order.BillingAddress;
            txtEmailAddress.Text      = order.Email;
            txtDateTime.Text          = DateTime.Now.ToString();
            txtAdditionalPhoneNo.Text = order.DriverPhone;
            drpComplianceSupervisor.Items.FindByValue(order.ComplianceSupervisor).Selected = true;

            int DriverProfileID = usdotDriver.driverInterviewProfiles.FirstOrDefault().DriverInterviewID;
            DriverVehicleEntity             driverVehicle          = usdotDriver.driverInterviewProfiles.FirstOrDefault().DriverVehicle;
            List <DriverVehicleCargoEntity> driverVehicleCargoData = usdotDriver.driverInterviewProfiles.FirstOrDefault().DriverCargos.Where(x => x.DriverVehicleID == DriverProfileID).ToList();

            List <DriverInterviewProfileEntity> driverInterviewProfiles = usdotDriver.driverInterviewProfiles.Where(x => x.OrderFormID == order.OrderFormID).ToList();
            DriverInterviewProfileEntity        driverInterviewProfile  = usdotDriver.driverInterviewProfiles.FirstOrDefault();

            lstDrivers.DataSource = driverInterviewProfiles;
            lstDrivers.DataBind();

            foreach (DriverServiceEntity item in usdotDriver.driverServices)
            {
                DocumentEL docEL = new DocumentEL();
                docEL.Description      = item.ServicePrice;
                docEL.DocumentID       = documentDal.GetDocumentTypeByName(item.ServiceName).DocumentTypeID;
                docEL.DocumentTypeName = item.ServiceName;
                serviceListData.Add(docEL);
            }

            //lstServicesPurchased.DataSource = serviceListData;
            //lstServicesPurchased.DataBind();
            Session["services"]         = serviceListData;
            Session["completeservices"] = serviceListData;
            if (driverInterviewProfile != null)
            {
                txtDate.Text               = DateTime.Now.ToShortDateString();
                txtDriverLegalName.Text    = driverInterviewProfile.LegalName;
                txtDriverUSDOT.Text        = driverInterviewProfile.USDOT;
                txtDriverPhone.Text        = driverInterviewProfile.Phone;
                txtDriverEmailAddress.Text = driverInterviewProfile.Email;
                txtDriverName.Text         = driverInterviewProfile.DriverName;
                txtSupervisor.Text         = driverInterviewProfile.Supervisor;
                txtDriverLicense.Text      = driverInterviewProfile.LicenseNo;
                txtExpirationDate.Text     = driverInterviewProfile.ExpirationDate;
                DropDownListState.Items.FindByValue(driverInterviewProfile.StatusIssued).Selected = true;
                txtClass.Text = driverInterviewProfile.Class;
                txtDOB.Text   = driverInterviewProfile.DOB;
                drpCDL.Items.FindByText(driverInterviewProfile.CDLNonCDL).Selected = true;
                txtDriverSSN.Text = driverInterviewProfile.SSN;
                hidSSNNo.Value    = driverInterviewProfile.SSN;
                txtDriverEIN.Text = driverInterviewProfile.EIN;
                txtNotesCommentsObservation.Text = driverInterviewProfile.Notes;
            }

            if (driverVehicle != null)
            {
                txtYear.Text  = driverVehicle.Year.ToString();
                txtMake.Text  = driverVehicle.Make;
                txtModel.Text = driverVehicle.Model;
                txtGVW.Text   = driverVehicle.GVW;
                foreach (DriverVehicleCargoEntity driverVehicleCargo in driverVehicleCargoData)
                {
                    if (driverVehicleCargo != null)
                    {
                        if (driverVehicleCargo.CargoCarriedName == chkAgriculturalFarmSupplies.Text)
                        {
                            chkAgriculturalFarmSupplies.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkBeverages.Text)
                        {
                            chkBeverages.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkBuildingMaterials.Text)
                        {
                            chkBuildingMaterials.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkChemicals.Text)
                        {
                            chkChemicals.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkCoalCoke.Text)
                        {
                            chkCoalCoke.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkCommoditiesDryBulk.Text)
                        {
                            chkCommoditiesDryBulk.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkConstruction.Text)
                        {
                            chkConstruction.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkDriveTowaway.Text)
                        {
                            chkDriveTowaway.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkFreshProduce.Text)
                        {
                            chkFreshProduce.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkGarbageRefuse.Text)
                        {
                            chkGarbageRefuse.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkGeneralFreight.Text)
                        {
                            chkGeneralFreight.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkGrainFeedHay.Text)
                        {
                            chkGrainFeedHay.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkHouseholdGoods.Text)
                        {
                            chkHouseholdGoods.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkIntermodalCont.Text)
                        {
                            chkIntermodalCont.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkLiquidsGases.Text)
                        {
                            chkLiquidsGases.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkLivestock.Text)
                        {
                            chkLivestock.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkLogsPolesBeamsLumber.Text)
                        {
                            chkLogsPolesBeamsLumber.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkMachineryLargeObjects.Text)
                        {
                            chkMachineryLargeObjects.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkMeat.Text)
                        {
                            chkMeat.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkMetalsheetscoilsrolls.Text)
                        {
                            chkMetalsheetscoilsrolls.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkMobileHomes.Text)
                        {
                            chkMobileHomes.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkMotorVehicles.Text)
                        {
                            chkMotorVehicles.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkOilfieldEquipment.Text)
                        {
                            chkOilfieldEquipment.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkPaperProducts.Text)
                        {
                            chkPaperProducts.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkPassengers.Text)
                        {
                            chkPassengers.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkRefrigeratedFood.Text)
                        {
                            chkRefrigeratedFood.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkUSMail.Text)
                        {
                            chkUSMail.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkUtilities.Text)
                        {
                            chkUtilities.Checked = true;
                        }
                        if (driverVehicleCargo.CargoCarriedName == chkWaterWell.Text)
                        {
                            chkWaterWell.Checked = true;
                        }
                    }
                }
            }

            Session["driverlist"] = driverProfileHelper.GetSalesByOrderID(false, orderid).driverInterviewProfiles;

            BindPurchasedItems();
        }