public List <DocumentEL> GetAllDocumentType()
        {
            List <DocumentEL> lstDocumentEL = new List <DocumentEL>();

            try
            {
                using (uow = new UnitOfWork.UnitOfWork())
                {
                    List <DocumentMaster> lstDocs = uow.DocumentMasterRepository.Get().OrderBy(x => x.DocumentID).ToList();
                    foreach (DocumentMaster doc in lstDocs)
                    {
                        DocumentEL docEl = new DocumentEL();
                        docEl.DocumentTypeName = doc.DocumentName;
                        docEl.Description      = doc.Description;
                        docEl.DocumentTypeID   = doc.DocumentID;
                        docEl.DocumentID       = doc.DocumentID;
                        lstDocumentEL.Add(docEl);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(lstDocumentEL);
        }
        public bool AddDocument(DocumentEL document)
        {
            bool         isInserted = false;
            UserDocument newDoc     = new UserDocument();

            using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                try
                {
                    if (document != null)
                    {
                        using (uow = new UnitOfWork.UnitOfWork())
                        {
                            #region Add New Document
                            newDoc.DocID      = document.DocumentID;
                            newDoc.UserID     = document.UserID;
                            newDoc.UploadPath = document.DocumentPath;
                            uow.UserDocumentRepository.Insert(newDoc);
                            uow.Save();
                            #endregion
                            transactionScope.Complete();
                            isInserted = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    transactionScope.Dispose();
                }
                return(isInserted);
            }
        }
        public DocumentMaster AddDocumentType(DocumentEL document)
        {
            DocumentMaster newDoc = new DocumentMaster();

            using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                try
                {
                    if (document != null)
                    {
                        using (uow = new UnitOfWork.UnitOfWork())
                        {
                            #region Add New Document
                            newDoc.Description  = document.Description;
                            newDoc.DocumentName = document.DocumentTypeName;
                            uow.DocumentMasterRepository.Insert(newDoc);
                            uow.Save();
                            #endregion
                            transactionScope.Complete();
                        }
                    }
                }
                catch (Exception ex)
                {
                    transactionScope.Dispose();
                }
                return(newDoc);
            }
        }
        public void LoadMCSale()
        {
            int          MCID   = Convert.ToInt32(Request.QueryString["MCID"]);
            MCSaleEntity mcSale = mcSalesHelper.GetMCSale(MCID);

            Session["MCSaleNo"]     = mcSale.MCSaleNo;
            txtAddressOnCard.Text   = mcSale.AddressOnCard;
            lblSalesPersonName.Text = userHelper.GetComplianceUserByID(Convert.ToInt32(mcSale.SalesPersonID)).Name;
            txtDOT.Text             = mcSale.DotNo;
            txtMC.Text                     = mcSale.MCNo;
            txtCardNo.Text                 = mcSale.CardNo;
            hidCardNo.Value                = mcSale.CardNo;
            txtNameOnCard.Text             = mcSale.NameOnCard;
            txtPhysicalAddress.Text        = mcSale.PhysicalAddress;
            txtRecieptEmail.Text           = mcSale.Email;
            lblMCSaleNo.Text               = mcSale.MCSaleNo;
            txtExpirationDate.Text         = mcSale.ExpirationDate;
            txtCVC.Text                    = mcSale.CVC;
            txtPhoneNo.Text                = mcSale.PhoneNo;
            ulcardtype.Attributes["class"] = mcSale.CardType;
            txtDBA.Text                    = mcSale.DBA;
            txtLegalName.Text              = mcSale.LegalName;
            txtDOTPin.Text                 = mcSale.DotPin;
            foreach (MCServiceSaleEntity item in mcSale.serviceSaleData)
            {
                DocumentEL docEL = new DocumentEL();
                docEL.Description      = item.ServicePrice;
                docEL.DocumentID       = documentDal.GetDocumentTypeByName(item.ServiceName).DocumentTypeID;
                docEL.DocumentTypeName = item.ServiceName;
                serviceListData.Add(docEL);
            }
            Session["services"] = serviceListData;
        }
Example #5
0
        public GetUserDocResponse GetUserDocs(string UserID)
        {
            GetUserDocResponse getUserDocResponse = new GetUserDocResponse();

            getUserDocResponse.IsSuccess = false;
            getUserDocResponse.Message   = "Get docs for user is not successfull.";

            try
            {
                using (uow = new UnitOfWork())
                {
                    List <UserDocument> lstUserdocs = uow.UserDocumentRepository.Get().Where(x => x.UserID == Convert.ToInt32(UserID)).ToList();
                    List <DocumentEL>   docsListEL  = new List <DocumentEL>();
                    foreach (var item in lstUserdocs)
                    {
                        DocumentEL docEL = new DocumentEL();
                        docEL.DocumentID       = Convert.ToInt32(item.DocID);
                        docEL.DocumentPath     = "http://purcell.opilab.com/web/" + item.UploadPath;
                        docEL.UserID           = item.UserDocID;
                        docEL.Description      = "";
                        docEL.DocumentTypeName = "";
                        docsListEL.Add(docEL);
                    }
                    getUserDocResponse.docList   = docsListEL;
                    getUserDocResponse.IsSuccess = true;
                    getUserDocResponse.Message   = "Get docs for user is successfull.";
                }
            }
            catch
            {
            }

            return(getUserDocResponse);
        }
        protected void btnAddService_Click(object sender, EventArgs e)
        {
            bool isServiceExist = false;

            if (Session["services"] != null)
            {
                serviceListData = (List <DocumentEL>)Session["services"];
                isServiceExist  = serviceListData.Any(x => x.Description == drpServices.SelectedItem.Value && x.DocumentTypeName == drpServices.SelectedItem.Text);
            }

            if (!isServiceExist)
            {
                DocumentEL service = new DocumentEL();
                service.Description      = drpServices.SelectedItem.Value;
                service.DocumentTypeName = drpServices.SelectedItem.Text;
                service.DocumentID       = documentDal.GetDocumentTypeByName(drpServices.SelectedItem.Text).DocumentTypeID;
                if (Session["services"] == null)
                {
                    serviceListData.Add(service);
                }
                else
                {
                    serviceListData = (List <DocumentEL>)Session["services"];
                    serviceListData.Add(service);
                }
                Session["services"] = serviceListData;
            }

            BindPurchasedItems();
        }
        private void BindDocumentTypesById(string UserId)
        {
            DocumentEL        lstDocs    = documentDal.GetDocumentTypeByID(UserId);
            List <DocumentEL> lstDocsLst = new List <DocumentEL>();

            lstDocsLst.Add(lstDocs);
            lstDocuments.DataSource = lstDocsLst;
            lstDocuments.DataBind();
        }
Example #8
0
        public GetUserDocResponse GetDocumentList(UploadUserRequest docRequest)
        {
            GetUserDocResponse getUserDocResponse = new GetUserDocResponse();

            getUserDocResponse.IsSuccess = false;
            getUserDocResponse.Message   = "Get docs for user is not successfull.";

            #region Validate Input

            if (string.IsNullOrEmpty(docRequest.AuthToken))
            {
                getUserDocResponse.Message = "Please pass value of all mandatory fields";
                return(getUserDocResponse);
            }

            AuthenticationToken authToken = new Helper().GetAuthenticationToken(docRequest.AuthToken);

            if (authToken == null)
            {
                getUserDocResponse.Message = "Unauthorizes user.";
                return(getUserDocResponse);
            }
            #endregion validate input
            try
            {
                using (uow = new UnitOfWork())
                {
                    List <UserDocument> lstUserdocs = uow.UserDocumentRepository.Get().Where(x => x.UserID == Convert.ToInt32(docRequest.userId)).ToList();

                    List <DocumentEL> docsListEL = new List <DocumentEL>();
                    foreach (var item in lstUserdocs)
                    {
                        var        _docRec = uow.DocumentMasterRepository.Get().Where(x => x.DocumentID == Convert.ToInt32(item.DocID)).SingleOrDefault();
                        DocumentEL docEL   = new DocumentEL();
                        docEL.DocumentID = Convert.ToInt32(item.DocID);
                        //docEL.DocumentPath = "http://purcell.opilab.com/web/" + item.UploadPath;
                        docEL.DocumentPath     = "https://purcellcompanies.com/uploads/" + item.UploadPath;
                        docEL.UserID           = item.UserDocID;
                        docEL.Description      = _docRec.Description;
                        docEL.DocumentTypeName = _docRec.DocumentName + " " + _docRec.Description;
                        docsListEL.Add(docEL);
                    }
                    getUserDocResponse.docList   = docsListEL;
                    getUserDocResponse.IsSuccess = true;
                    getUserDocResponse.Message   = "Get docs for user is successfull.";
                }
            }
            catch
            {
            }

            return(getUserDocResponse);
        }
 protected void lstServicesPurchased_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (e.CommandName == "DelService")
     {
         if (Session["services"] != null)
         {
             serviceListData = (List <DocumentEL>)Session["services"];
             DocumentEL docEL = serviceListData.Where(x => x.DocumentID == Convert.ToInt32(e.CommandArgument)).FirstOrDefault();
             serviceListData.Remove(docEL);
             BindPurchasedItems();
         }
     }
 }
        public bool EditDocumentType(DocumentEL document)
        {
            bool isUpdated = false;

            try
            {
                if (document != null)
                {
                    DocumentMaster existingDoc = null;

                    using (uow = new UnitOfWork.UnitOfWork())
                    {
                        existingDoc = uow.DocumentMasterRepository.Get().Where(u => u.DocumentID.Equals(document.DocumentTypeID)).FirstOrDefault();

                        #region Get Existing User

                        if (existingDoc == null)
                        {
                            return(isUpdated);
                        }
                        // Check updating email id exists for other user

                        #endregion


                        #region Update Document

                        existingDoc.DocumentName = document.DocumentTypeName;
                        existingDoc.Description  = document.Description;

                        uow.DocumentMasterRepository.Update(existingDoc);
                        uow.Save();

                        #endregion

                        #region PrepareResponse

                        isUpdated = true;

                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                isUpdated = false;
                return(isUpdated);
            }

            return(isUpdated);
        }
 protected void lstDocuments_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (e.CommandName == "Modify")
     {
         Session["EditID"] = e.CommandArgument;
         DocumentEL doc = documentDal.GetDocumentTypeByID(e.CommandArgument.ToString());
         txtDescription.Text = doc.Description;
         txtDocName.Text     = doc.DocumentTypeName;
         this.BindDocuments();
     }
     else
     if (e.CommandName == "Del")
     {
         documentDal.DeleteDocumentType(e.CommandArgument.ToString());
         this.BindDocuments();
     }
 }
 protected void lstDocuments_ItemDataBound(object sender, ListViewItemEventArgs e)
 {
     if (e.Item.ItemType == ListViewItemType.DataItem)
     {
         HiddenField hidDocID = (HiddenField)e.Item.FindControl("hidDocID");
         DocumentEL  docEL    = GetUserDocs().Where(x => x.DocumentID == Convert.ToInt32(hidDocID.Value)).FirstOrDefault();
         if (docEL != null)
         {
             Label txtDocName = (Label)e.Item.FindControl("txtDocTypeName");
             txtDocName.Visible = false;
             LinkButton lnkDocName = (LinkButton)e.Item.FindControl("lnkDocTypeName");
             lnkDocName.Visible              = true;
             lnkDocName.Attributes["href"]   = docEL.DocumentPath;
             lnkDocName.Attributes["target"] = "_blank";
             lnkDocName.PostBackUrl          = docEL.DocumentPath;
         }
     }
 }
        public DocumentEL GetDocumentTypeByName(string documentname)
        {
            DocumentEL docEl = new DocumentEL();

            try
            {
                using (uow = new UnitOfWork.UnitOfWork())
                {
                    DocumentMaster doc = uow.DocumentMasterRepository.Get().Where(x => x.DocumentName == documentname).FirstOrDefault();
                    docEl.DocumentTypeID   = doc.DocumentID;
                    docEl.DocumentTypeName = doc.DocumentName;
                    docEl.Description      = doc.Description;
                }
            }
            catch (Exception ex)
            {
            }
            return(docEl);
        }
 protected void btnSaveDocument_Click(object sender, EventArgs e)
 {
     if (Session["EditID"] == null)
     {
         DocumentEL docEL = new DocumentEL();
         docEL.Description      = txtDescription.Text;
         docEL.DocumentTypeName = txtDocName.Text;
         documentDal.AddDocumentType(docEL);
         this.BindDocuments();
     }
     else
     {
         DocumentEL docEL = new DocumentEL();
         docEL.Description      = txtDescription.Text;
         docEL.DocumentTypeName = txtDocName.Text;
         docEL.DocumentTypeID   = Convert.ToInt32(Session["EditID"]);
         documentDal.EditDocumentType(docEL);
         Session["EditID"] = null;
         this.BindDocuments();
     }
 }
        public void LoadMCSale()
        {
            int          MCID   = Convert.ToInt32(Request.QueryString["MCID"]);
            MCSaleEntity mcSale = mcSalesHelper.GetMCSale(MCID);

            txtAddressOnCard.Text   = mcSale.AddressOnCard;
            txtDOT.Text             = mcSale.DotNo;
            txtMC.Text              = mcSale.MCNo;
            txtNameOnCard.Text      = mcSale.NameOnCard;
            txtPhysicalAddress.Text = mcSale.PhysicalAddress;
            txtRecieptEmail.Text    = mcSale.Email;
            txtCardNo.Text          = mcSale.CardNo;
            lblMCSaleNo.Text        = mcSale.MCSaleNo;
            txtDBA.Text             = mcSale.DBA;
            txtLegalName.Text       = mcSale.LegalName;
            txtDOTPin.Text          = mcSale.DotPin;
            foreach (MCServiceSaleEntity item in mcSale.serviceSaleData)
            {
                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();
            Label lblTotal = lstServicesPurchased.FindControl("lblSubTotal") as Label;

            try
            {
                lblTotal.Text = "$" + serviceListData.Sum(p => Convert.ToDouble(p.Description.Replace("$", ""))).ToString();
            }
            catch
            {
            }
        }
        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();
        }
        protected void lstDocuments_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Random rand = new Random();

            if (e.CommandName == "Upl")
            {
                Userid = Request.QueryString["id"].ToString();
                FileUpload fileUpl        = e.Item.FindControl("flUpload") as FileUpload;
                Label      lblDocTypeName = e.Item.FindControl("txtDocTypeName") as Label;
                DocumentEL docEL          = new DocumentEL();
                //  string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + fileUpl.FileName;
                string fileName = fileUpl.FileName;
                string ext      = Path.GetExtension(fileName);
                fileName         = lblDocTypeName.Text + "_" + GenerateRandomNo() + ext;
                docEL.DocumentID = Convert.ToInt32(e.CommandArgument);
                docEL.UserID     = Convert.ToInt32(Userid);
                // docEL.DocumentPath = "Uploads/" + fileName;
                string saleId       = documentDal.GetOrderByUSDOT(UsDot);
                string NewDirectory = "~/Uploads/" + saleId + "/";
                if (!Directory.Exists(NewDirectory))
                {
                    //If No any such directory then creates the new one
                    Directory.CreateDirectory(Server.MapPath(NewDirectory));
                }


                fileUpl.SaveAs(Server.MapPath(NewDirectory + fileName));
                string filepath = NewDirectory + fileName;
                docEL.DocumentPath = filepath;
                // fileUpl.SaveAs(Server.MapPath("~/Uploads/" + fileName));
                bool    isDocInserted = documentDal.AddDocument(docEL);
                UsersEL userEL        = userDal.GetCustomerByID(Userid);

                // New changes with DocumetnUpload table

                //DocumentUploadEL _docRec = new DocumentUploadEL();
                //_docRec.UserId = Convert.ToInt32( Userid);
                //_docRec.doc_id= Convert.ToInt32(e.CommandArgument);
                //_docRec.doctypename = lblDocTypeName.Text.ToString(); ;
                //_docRec.filepath = filepath;
                //bool isDocUploadInserted = documentDal.AddDocumentUpload(_docRec);
                //AddDocumentUpload
                if (!String.IsNullOrEmpty(userEL.PushToken) && !String.IsNullOrEmpty(userEL.DeviceType))
                {
                    //PushNotificationData pushData = new PushNotificationData();

                    //pushData.DevicePushToken = userEL.PushToken;
                    //if (userEL.DeviceType.Equals("Android"))
                    //{
                    //    pushData.DeviceType = DeviceType.Android;
                    //}
                    //else
                    //    if (userEL.DeviceType.Equals("Iphone"))
                    //    {
                    //        pushData.DeviceType = DeviceType.IPhone;
                    //    }
                    //pushData.Message = "A New document is been uploaded on your profile. Please check your document section to view.";
                    //PushHelper.SendPushMessage(pushData);
                }

                if (isDocInserted)
                {
                    Response.Write("<script>alert('Document uploaded successfully.');</script>");
                    this.BindDocumentTypes();
                }
                else
                {
                    Response.Write("<script>alert('Some Error Occured.');</script>");
                }
            }
        }