Beispiel #1
0
 protected void butSignUp_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         AdminHelper adminHelper = new AdminHelper();
         LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
         if (DriverID == 0)
         {
             DAL.Driver driver = new DAL.Driver();
             driver.FName     = txtFirstName.Text;
             driver.LName     = txtLastName.Text;
             driver.Email     = txtEmail.Text;
             driver.Phone     = txtMobilePhone.Text.Trim();
             driver.CompanyID = adminHelper.CompanyObject.CompanyID;
             driver.ShowOnMap = cbShowOnMap.Checked;
             driver.Password  = txtPassword.Text.Trim();
             int carID = int.Parse(ddlCars.SelectedValue);
             driver.CarID = carID != 0 ? carID : new int?();
             limoEntities.Drivers.AddObject(driver);
             limoEntities.SaveChanges();
             Response.Redirect("~/admin/Pages/ManageDrivers.aspx");
         }
         else
         {
             DAL.Driver contactTemp =
                 limoEntities.Drivers.Where(xx => xx.DriverID == DriverID).ToList().
                 FirstOrDefault();
             if (contactTemp != null)
             {
                 contactTemp.FName     = txtFirstName.Text;
                 contactTemp.LName     = txtLastName.Text;
                 contactTemp.Email     = txtEmail.Text;
                 contactTemp.Phone     = txtMobilePhone.Text.Trim();
                 contactTemp.ShowOnMap = cbShowOnMap.Checked;
                 contactTemp.Password  = txtPassword.Text.Trim();
                 int carID = int.Parse(ddlCars.SelectedValue);
                 contactTemp.CarID = carID != 0 ? carID : new int?();
                 limoEntities.SaveChanges();
                 Response.Redirect("~/admin/Pages/ManageDrivers.aspx");
             }
         }
     }
     catch (Exception)
     {
         lblError.Visible = true;
         lblError.Text    = "There are problem with your information.";
     }
 }
 protected void butLogin_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         AdminHelper             adminHelper = new AdminHelper();
         double                  tempPrice;
         double?                 nullPrice = null;
         int                     tempID    = 0;
         CompanyCityPrice        companyCityPriceTemp;
         List <CompanyCityPrice> tempCCPL = new List <CompanyCityPrice>();
         for (int i = 0; i < GridView1.Rows.Count; i++)
         {
             double.TryParse(((TextBox)GridView1.Rows[i].Cells[2].FindControl("txtPrice")).Text, out tempPrice);
             int.TryParse(((HiddenField)GridView1.Rows[i].Cells[2].FindControl("hfID")).Value, out tempID);
             companyCityPriceTemp = CitiesList.Where(xx => xx.CompanyCityPriceID == tempID).FirstOrDefault();
             if (companyCityPriceTemp != null)
             {
                 companyCityPriceTemp.Price = tempPrice > 0 ? tempPrice : nullPrice;
                 tempCCPL.Add(companyCityPriceTemp);
             }
         }
         using (var dc = new LimoEntitiesEntityFremwork())
         {
             List <int> tempIDsList         = tempCCPL.Select(yy => yy.CompanyCityPriceID).ToList();
             List <CompanyCityPrice> dbList =
                 dc.CompanyCityPrices.Where(xx => tempIDsList.Contains(xx.CompanyCityPriceID)).ToList();
             foreach (var companyCityPrice in dbList)
             {
                 CompanyCityPrice tempTemp =
                     tempCCPL.Where(xx => xx.CompanyCityPriceID == companyCityPrice.CompanyCityPriceID).Single();
                 companyCityPrice.Price = tempTemp.Price;
             }
             dc.SaveChanges();
             CitiesList =
                 dc.CompanyCityPrices.Where(
                     xx =>
                     xx.IsActive.HasValue && xx.CompanyID == adminHelper.CompanyObject.CompanyID && xx.IsActive.Value)
                 .ToList
                     ();
             foreach (var companyCityPrice in CitiesList)
             {
                 companyCityPrice.CityName  = companyCityPrice.cities_extended.CityName;
                 companyCityPrice.StateName = companyCityPrice.cities_extended.State.StateName;
             }
         }
         int pageIndex = GridView1.PageIndex;
         GridView1.DataSource = CitiesList;
         GridView1.DataBind();
         GridView1.PageIndex     = pageIndex;
         divConfirmation.Visible = true;
     }
     catch (Exception)
     {
         divError.Visible = true;
     }
 }
Beispiel #3
0
        protected void butSignUp_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
                DAL.Job tempJob =
                    limoEntities.Jobs.Where(xx => xx.JobID == JobID).ToList().
                    FirstOrDefault();
                if (tempJob != null)
                {
                    tempJob.FirstName = txtFirstName.Text;
                    tempJob.LastName  = txtLastName.Text;
                    tempJob.Mobile    = txtPH.Text;
                    tempJob.Email     = txUserEmail.Text;

                    tempJob.FromAddress = txtFrom.Text;
                    tempJob.ToAddress   = txtTo.Text;
                    tempJob.JobDate     = DateTime.Parse(txtPickUpDate.Text);
                    tempJob.JobTime     = txtPickUpTime.Text;

                    double temp;
                    tempJob.GratuityPrice      = double.TryParse(txtGratuity.Text, out temp) ? temp : new double?();
                    tempJob.EstimatedFarePrice = double.TryParse(txtEstimatedFarePrice.Text, out temp) ? temp : new double?();
                    tempJob.ProcessingFee      = double.TryParse(txtProcessingFee.Text, out temp) ? temp : new double?();
                    tempJob.Taxes      = double.TryParse(txtTaxes.Text, out temp) ? temp : new double?();
                    tempJob.OtherPrice = double.TryParse(txtOtherPrice.Text, out temp) ? temp : new double?();
                    tempJob.PriceNote  = txtOtherPriceNote.Text;
                    int driverID = int.Parse(ddlDrivers.SelectedValue);
                    tempJob.DriverID = driverID != 0 ? driverID : new int?();
                    int statusID = int.Parse(ddlStatus.SelectedValue);
                    tempJob.JobStatusID = statusID != 0 ? statusID : new int?();
                    limoEntities.SaveChanges();

                    divError.Visible        = false;
                    divConfirmation.Visible = true;
                    ProcessData(tempJob);
                    SendEmail(tempJob);
                    try
                    {
                        var    driver   = DriversList.Where(xxx => xxx.DriverID == driverID).FirstOrDefault();
                        string password = driver != null ? driver.Password : string.Empty;
                        //Service1.LimoAllOver ccc = new Service1.LimoAllOver();
                        MobileService.LimoAllOver ccc = new MobileService.LimoAllOver();
                        ccc.SendNotifcationToDriver("android", driverID);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception)
            {
                divError.Visible        = true;
                divConfirmation.Visible = false;
            }
        }
 protected void butSignUp_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         AdminHelper adminHelper = new AdminHelper();
         LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
         if (ContactPersonID == 0)
         {
             ContactPerson contactPerson = new ContactPerson();
             contactPerson.FirstName = txtFirstName.Text;
             contactPerson.LastName  = txtLastName.Text;
             contactPerson.Email     = txtEmail.Text;
             contactPerson.Phone     = txtMobilePhone.Text;
             contactPerson.Job       = txtJob.Text;
             contactPerson.CompanyID = adminHelper.CompanyObject.CompanyID;
             limoEntities.ContactPersons.AddObject(contactPerson);
             limoEntities.SaveChanges();
             Response.Redirect("~/admin/Pages/ManageContactPerson.aspx");
         }
         else
         {
             ContactPerson contactTemp =
                 limoEntities.ContactPersons.Where(xx => xx.ContactPersonID == ContactPersonID).ToList().
                 FirstOrDefault();
             if (contactTemp != null)
             {
                 contactTemp.FirstName = txtFirstName.Text;
                 contactTemp.LastName  = txtLastName.Text;
                 contactTemp.Email     = txtEmail.Text;
                 contactTemp.Phone     = txtMobilePhone.Text;
                 contactTemp.Job       = txtJob.Text;
                 limoEntities.SaveChanges();
                 Response.Redirect("~/admin/Pages/ManageContactPerson.aspx");
             }
         }
     }
     catch (Exception)
     {
         lblError.Visible = true;
         lblError.Text    = "There are problem with your information.";
     }
 }
Beispiel #5
0
        protected void butReject_onClick(object sender, EventArgs e)
        {
            int id = int.Parse(((Button)sender).CommandName);

            if (id != 0)
            {
                LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
                DAL.Job tempJob = limoEntities.Jobs.Where(xx => xx.JobID == id).ToList().
                                  FirstOrDefault();
                if (tempJob != null)
                {
                    tempJob.JobStatusID = (int)Limo_Gloabel.JobStatus.Rejected;
                    limoEntities.SaveChanges();
                }
            }
            Response.Redirect("~/admin/Pages/ManageSettle.aspx?id=" + id.ToString());
        }
Beispiel #6
0
        protected void butCancel_onClick(object sender, EventArgs e)
        {
            int id = int.Parse(((Button)sender).CommandName);

            //Response.Redirect("~/admin/Pages/Reservation.aspx?id=" + id.ToString());
            if (id != 0)
            {
                LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
                DAL.Job tempJob = limoEntities.Jobs.Where(xx => xx.JobID == id).ToList().
                                  FirstOrDefault();
                if (tempJob != null)
                {
                    limoEntities.Jobs.DeleteObject(tempJob);
                    limoEntities.SaveChanges();
                }
            }
            Response.Redirect("~/admin/Pages/Despatch.aspx");
        }
Beispiel #7
0
        protected void butSignUp_Click(object sender, ImageClickEventArgs e)
        {
            LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
            AdminHelper adminHelper = new AdminHelper();
            int         id          = 0;

            int.TryParse(Request.QueryString["id"], out id);
            Company company;

            if (adminHelper.IsAdmin)
            {
                company =
                    limoEntities.Companies.Where(xx => xx.CompanyID == id &&
                                                 xx.Password == txtOldPassword.Text).FirstOrDefault();
            }
            else
            {
                if (adminHelper.CompanyObject != null)
                {
                    id = adminHelper.CompanyObject.CompanyID;
                }
                else
                {
                    id = 0;
                }
                company =
                    limoEntities.Companies.Where(xx => xx.CompanyID == id &&
                                                 xx.Password == txtOldPassword.Text).FirstOrDefault();
            }
            if (company != null)
            {
                company.Password = txtPassword.Text;
                limoEntities.SaveChanges();
                divChangePasswordConfirmation.Visible        = true;
                divProblemChangePasswordConfirmation.Visible = false;
            }
            else
            {
                divProblemChangePasswordConfirmation.Visible = true;
                divChangePasswordConfirmation.Visible        = false;
            }
        }
 protected void butDelete_onClick(object sender, EventArgs e)
 {
     try
     {
         int id = int.Parse(((Button)sender).CommandName);
         //AdminHelper adminHelper = new AdminHelper();
         LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
         DAL.Company companyTemp = limoEntities.Companies.Where(xx => xx.CompanyID == id).FirstOrDefault();
         if (companyTemp != null)
         {
             limoEntities.Companies.DeleteObject(companyTemp);
             limoEntities.SaveChanges();
         }
         Response.Redirect("~/admin/Pages/ManageCompany.aspx");
     }
     catch (Exception ex)
     {
         divProblem.Visible = true;
     }
 }
        private void FillListWithCities()
        {
            string temp = hfLatLon.Value;

            string[] list = temp.Split('&');
            list = list.Distinct().ToArray();
            AdminHelper adminHelper = new AdminHelper();

            if (adminHelper.CompanyObject != null)
            {
                using (var DC = new LimoEntitiesEntityFremwork())
                {
                    Company company = DC.Companies.Where(xx => xx.CompanyID == adminHelper.CompanyObject.CompanyID).ToList()[0];
                    double  distance;
                    company.DistancePerMile = double.TryParse(ddlDistance.SelectedValue, out distance)? distance: 0;
                    var oldCities =
                        DC.CompanyCityPrices.Where(xx => xx.CompanyID == adminHelper.CompanyObject.CompanyID).ToList();
                    var citiesList =
                        DC.cities_extended.Where(
                            ob => list.Contains(ob.latitude.Substring(0, 5) + "," + ob.longitude.Substring(0, 5))).
                        OrderBy(elem => elem.state_code).ToList();
                    if (citiesList.Count > 0)
                    {
                        citiesList = citiesList.DistinctBy(xx => xx.CityStateName).ToList();
                        CompanyCityPrice companycityPrice;
                        foreach (var oldCity in oldCities)
                        {
                            var dummy = citiesList.Where(xx => xx.CityID == oldCity.CityID).ToList().Count;
                            if (dummy > 0)
                            {
                                oldCity.IsActive = true;
                                citiesList.Remove(citiesList.Where(xx => xx.CityID == oldCity.CityID).ToList()[0]);
                            }
                            else
                            {
                                oldCity.IsActive = false;
                            }
                        }
                        foreach (var citiesExtended in citiesList)
                        {
                            companycityPrice = new CompanyCityPrice
                            {
                                CompanyID = adminHelper.CompanyObject.CompanyID,
                                CityID    = citiesExtended.CityID,
                                IsActive  = true
                            };
                            DC.CompanyCityPrices.AddObject(companycityPrice);
                        }
                        DC.SaveChanges();
                        var cityPriceList =
                            DC.CompanyCityPrices.Where(xx => xx.IsActive.HasValue && xx.CompanyID == adminHelper.CompanyObject.CompanyID && xx.IsActive.Value).ToList
                                ();
                        foreach (var companyCityPrice in cityPriceList)
                        {
                            companyCityPrice.CityName  = companyCityPrice.cities_extended.CityName;
                            companyCityPrice.StateName = companyCityPrice.cities_extended.State.StateName;
                        }
                        CitiesList           = cityPriceList;
                        GridView1.DataSource = CitiesList;
                        GridView1.DataBind();
                        adminHelper.CompanyObject = company;
                    }
                }
            }
        }
Beispiel #10
0
        //private void AddJobtoLimoAnyWhere()
        //{
        ////    JobWrapper jobWrapper = new JobWrapper();
        ////    string apiId = ConfigurationSettings.AppSettings["apiId"]; //Your Api ID
        ////    string apiKey = ConfigurationSettings.AppSettings["apiKey"]; //Your Api Key

        //}

        private Job SaveJobInDatabase(string tripConfirmationNumber, string authorizationCode, string invoiceNumber)
        {
            LimoEntitiesEntityFremwork limoEntity = new LimoEntitiesEntityFremwork();
            JobWrapper jobWrapper = new JobWrapper();
            Job        job        = new Job();

            job.CompanyCarID       = jobWrapper.JobDetailsObject.CarID;
            job.UserID             = jobWrapper.UserNumber > 0 ? jobWrapper.UserNumber : new int?(); //.JobDetailsObject.userID;
            job.FromAddress        = jobWrapper.JobDetailsObject.FromAddress;
            job.ToAddress          = jobWrapper.JobDetailsObject.ToAddress;
            job.CityID             = jobWrapper.JobDetailsObject.cityID;
            job.JobDate            = jobWrapper.JobDetailsObject.JobDate;
            job.JobTime            = jobWrapper.JobDetailsObject.JobMappedTime;
            job.TotalPrice         = jobWrapper.JobDetailsObject.JobTotalPrise;
            job.EstimatedFarePrice = jobWrapper.JobDetailsObject.JobBasePrise;
            job.GratuityPrice      = jobWrapper.JobDetailsObject.JobGratuity;
            job.ProcessingFee      = jobWrapper.JobDetailsObject.JobProcessingFees;
            job.Taxes                 = jobWrapper.JobDetailsObject.JobStateTaxes;
            job.FirstName             = txtFirstName.Text;
            job.LastName              = txtLastName.Text;
            job.ComapnyConfirmNum     = tripConfirmationNumber;
            job.AuthorizationCode     = authorizationCode;
            job.AuthorizInvoiceNumber = invoiceNumber;

            DAL.User user = limoEntity.Users.Where(obj => obj.UserID == jobWrapper.UserNumber).FirstOrDefault();
            if (user != null)
            {
                user.CardZipCode        = txtZipCode.Text;
                user.CardNumber         = txtCardNumber.Text;
                user.CardAddress        = txtAdddress.Text;
                user.CardStateID        = ddlState.SelectedValue;
                user.CardExpirationDate = ddlExpirationMonth.SelectedValue + "/" + ddlExpirationYear.SelectedValue;
                user.CardHolderFName    = txtFirstName.Text;
                user.CardHolderLName    = txtLastName.Text;
            }
            //job.OtherPrice = jobWrapper.JobDetailsObject.otherPrice;
            if (limoEntity.JobStatus != null)
            {
                string       pending   = Limo_Gloabel.JobStatus.Pending.ToString().ToLower();
                DAL.JobStatu jobStatus =
                    limoEntity.JobStatus.Where(obj => obj.JobStatus.ToLower() == pending).FirstOrDefault();
                if (jobStatus != null)
                {
                    job.JobStatusID = jobStatus.JobStatusID;
                }
            }
            int idTemp = jobWrapper.JobDetailsObject != null?  jobWrapper.JobDetailsObject.CarID: 0;
            var car    =
                limoEntity.Cars.Where(xxx => xxx.CarID == idTemp).
                FirstOrDefault();
            int driverID = 0;

            if (car != null)
            {
                driverID = car.Drivers != null?car.Drivers.ToList()[0].DriverID : 0;

                //if (driverID > 0)
                //job.DriverID = driverID;
            }
            job.JobBy       = 1;
            job.NoPassenger = int.Parse(jobWrapper.JobDetailsObject.UserNumber);

            job.FromLat = jobWrapper.JobDetailsObject.FromAddressLat;
            job.FromLng = jobWrapper.JobDetailsObject.FromAddressLNG;
            job.ToLat   = jobWrapper.JobDetailsObject.ToAddressLat;
            job.ToLng   = jobWrapper.JobDetailsObject.ToAddressLNG;

            limoEntity.Jobs.AddObject(job);
            limoEntity.SaveChanges();
            try
            {
                if (driverID > 0)
                {
                    //Service1.LimoAllOver ccc = new Service1.LimoAllOver();
                    MobileService.LimoAllOver ccc = new MobileService.LimoAllOver();
                    //ccc.SendNotifcationToDriver("android", driverID);
                    ccc.SendJobToDriver(driverID, job.JobID);
                }
            }
            catch (Exception)
            {
            }

            if (string.IsNullOrEmpty(job.ComapnyConfirmNum))
            {
                job.ComapnyConfirmNum = job.JobID.ToString() + DateTime.Now.Day.ToString() +
                                        DateTime.Now.Month.ToString() +
                                        DateTime.Now.Year.ToString().Substring(2);
            }
            job.LimoConfirmNumber = "L" + job.JobID.ToString() + DateTime.Now.Day.ToString() +
                                    DateTime.Now.Month.ToString() +
                                    DateTime.Now.Year.ToString().Substring(2);
            limoEntity.SaveChanges();
            return(job);
        }
Beispiel #11
0
 protected void butSignUp_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         bool isKnownType = GetCarType(txtCarName.Text);
         LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
         AdminHelper adminHelper = new AdminHelper();
         if (CarID != 0)
         {
             DAL.Car carTemp =
                 limoEntities.Cars.Where(
                     xx => xx.CompanyID == adminHelper.CompanyObject.CompanyID && xx.CarID == CarID).
                 FirstOrDefault();
             if (carTemp != null)
             {
                 //if (carTemp.CarName.ToLower() == txtCarName.Text.ToLower() || (carTemp.CarName != txtCarName.Text &&
                 //                                           limoEntities.Cars.Where(
                 //                                               xx =>
                 //                                               xx.CarName.ToLower() == txtCarName.Text.ToLower()).
                 //                                               ToList().Count == 0))
                 //{
                 carTemp.CarName     = txtCarName.Text;
                 carTemp.Description = txtDescription.Text;
                 //double priceTemp;
                 double?nullPrice = null;
                 int    noPassengerTemp;
                 //carTemp.MinPrice = double.TryParse(txtPrice.Text, out priceTemp) ? priceTemp : nullPrice;
                 double pricePerMile, pricePerHour;
                 carTemp.PricePerHore = double.TryParse(txtPricePerHour.Text, out pricePerHour)
                                            ? pricePerHour
                                            : nullPrice;
                 carTemp.PricePerMaile = double.TryParse(txtPricePerMile.Text, out pricePerMile)
                                             ? pricePerMile
                                             : nullPrice;
                 carTemp.NoPassengers = int.TryParse(ddlNoPassengers.SelectedValue, out noPassengerTemp)
                                            ? noPassengerTemp
                                            : 0;
                 string imagPublishedPath = string.Empty;
                 if (!isKnownType)
                 {
                     if (fu_Image.HasFile)
                     {
                         imagPublishedPath = SaveImg(fu_Image);
                     }
                 }
                 else
                 {
                     imagPublishedPath = GetImagePath(txtCarName.Text);
                 }
                 if (!string.IsNullOrEmpty(imagPublishedPath))
                 {
                     carTemp.PhotoName = imagPublishedPath;
                 }
                 carTemp.CarNumber = txtCarNumber.Text;
                 limoEntities.SaveChanges();
                 Response.Redirect("~/admin/Pages/ManageCars.aspx");
                 //}
             }
             else
             {
                 lblError.Visible = true;
             }
         }
         else
         //if (limoEntities.Cars.Where(xx => xx.CarName.ToLower() == txtCarName.Text.ToLower()).ToList().Count == 0)
         {
             DAL.Car newCar = new DAL.Car();
             newCar.CompanyID   = adminHelper.CompanyObject.CompanyID;
             newCar.CarName     = txtCarName.Text;
             newCar.Description = txtDescription.Text;
             double priceTemp;
             double?nullPrice = null;
             int    noPassengerTemp;
             //newCar.MinPrice = double.TryParse(txtPrice.Text, out priceTemp) ? priceTemp : nullPrice;
             newCar.NoPassengers = int.TryParse(ddlNoPassengers.SelectedValue, out noPassengerTemp)
                                       ? noPassengerTemp
                                       : 1;
             double pricePerMile, pricePerHour;
             newCar.PricePerHore = double.TryParse(txtPricePerHour.Text, out pricePerHour)
                                       ? pricePerHour
                                       : nullPrice;
             newCar.PricePerMaile = double.TryParse(txtPricePerMile.Text, out pricePerMile)
                                        ? pricePerMile
                                        : nullPrice;
             string imagPublishedPath = string.Empty;
             if (!isKnownType)
             {
                 if (fu_Image.HasFile)
                 {
                     imagPublishedPath = SaveImg(fu_Image);
                 }
             }
             else
             {
                 imagPublishedPath = GetImagePath(txtCarName.Text);
             }
             if (!string.IsNullOrEmpty(imagPublishedPath))
             {
                 newCar.PhotoName = imagPublishedPath;
             }
             newCar.CarNumber = txtCarNumber.Text;
             limoEntities.Cars.AddObject(newCar);
             limoEntities.SaveChanges();
             Response.Redirect("~/admin/Pages/ManageCars.aspx");
         }
         //else
         //    lblError.Visible = true;
     }
     catch (Exception)
     {
         lblError.Visible = true;
         lblError.Text    = "There are problem with your information.";
     }
 }
Beispiel #12
0
        protected void butSignUp_Click(object sender, ImageClickEventArgs e)
        {
            //string apiId = ConfigurationSettings.AppSettings["apiId"]; //Your Api ID
            //string apiKey = ConfigurationSettings.AppSettings["apiKey"]; //Your Api Key
            //ShortAccountInfo shortAccountInfo = new ShortAccountInfo();
            //shortAccountInfo.FirstName = txtFirstName.Text;
            //shortAccountInfo.LastName = txtLastName.Text;
            //shortAccountInfo.MobilePhone = txtMobilePhone.Text;

            //AccountEmail accountEmail = new AccountEmail();
            //accountEmail.Email = txtEmail.Text;
            //AccountEmail[] accountEmailList = new AccountEmail[1];
            //accountEmailList[0] = accountEmail;
            //shortAccountInfo.EmailList = accountEmailList;
            //shortAccountInfo.Email = txtEmail.Text;

            //shortAccountInfo.Password = txtPassword.Text;
            //shortAccountInfo.VerifyPassword = txtConfirmPassword.Text;
            //shortAccountInfo.UserName = txtUsername.Text;
            //shortAccountInfo.Country = ddlCountry.SelectedItem.Text;
            //shortAccountInfo.CityTown = txtCityTown.Text;
            //shortAccountInfo.ZipPost = txtZipPost.Text;
            //shortAccountInfo.PrimaryAddress = txtPrimaryAddress.Text;


            //var apiService = new ApiService();
            //AccountInfoResponse response = apiService.CreateAccount(apiId, apiKey, shortAccountInfo);

            LimoEntitiesEntityFremwork limoEntity = new LimoEntitiesEntityFremwork();

            Lemo.DAL.User user       = new Lemo.DAL.User();
            JobWrapper    jobWrapper = new JobWrapper();

            try
            {
                Lemo.DAL.User tempUser = limoEntity.Users.Where(
                    xx => xx.UserName.ToLower() == txtUsername.Text.ToLower()).
                                         ToList().FirstOrDefault();
                if (tempUser == null)
                {
                    user.FirstName = txtFirstName.Text;
                    user.LastName  = txtLastName.Text;
                    user.Mobile    = txtMobilePhone.Text;
                    user.Email     = txtEmail.Text;
                    user.Passwords = txtPassword.Text;
                    user.UserName  = txtUsername.Text;
                    //user.Country = ddlCountry.SelectedItem.Text;
                    //user.CityTown = txtCityTown.Text;
                    user.ZipCode = txtZipPost.Text;
                    user.Address = txtPrimaryAddress.Text;
                    limoEntity.Users.AddObject(user);
                    limoEntity.SaveChanges();
                    jobWrapper.UserNumber = user.UserID;
                    jobWrapper.UserNumber = user.UserID;
                    lblError.Visible      = false;
                    if (jobWrapper.JobDetailsObject != null && jobWrapper.ISReservationExist)
                    {
                        Response.Redirect("~/Pages/CompleteReservation.aspx");
                    }
                    else
                    {
                        Response.Redirect("~/Pages/MyAccount.aspx");
                    }
                }
                else
                {
                    lblError.Visible = true;
                }
            }
            catch (Exception)
            {
                lblError.Visible = true;
            }
        }
Beispiel #13
0
        protected void butSignUp_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
                AdminHelper adminHelper = new AdminHelper();
                Company     company;
                if (adminHelper.IsAdmin)
                {
                    adminHelper.CompanyObject = null;
                    company =
                        limoEntities.Companies.Where(xx => xx.CompanyID == CompanyID).
                        FirstOrDefault();
                    if (company != null)
                    {
                        company.IsActive  = cbIsActive.Checked;
                        company.IsTop     = cbIsTop.Checked;
                        company.IsDespath = cbAllowDespatch.Checked;
                    }
                }
                else
                {
                    company =
                        limoEntities.Companies.Where(xx => xx.CompanyID == adminHelper.CompanyObject.CompanyID).
                        FirstOrDefault();
                }
                if (company != null)
                {
                    company.CompanyName       = txtCompanyName.Text;
                    company.UserName          = txtUsername.Text;
                    company.stateName         = ddlState.SelectedValue;
                    company.CityName          = txtCityTown.Text;
                    company.Address           = txtPrimaryAddress.Text;
                    company.ZipCode           = txtZipPost.Text;
                    company.IsSupportAllState = cbAllState.Checked;
                    company.IsAvailable       = cbIsAvailable.Checked;
                    company.Email             = txtEmail.Text;
                    company.Phone             = txtMobilePhone.Text;
                    company.LimoAPIID         = txtLimoAPIID.Text;
                    company.LimoAPIKey        = txtLimoAPIKey.Text;

                    company.About_Us    = txtAbout_Us.Text;
                    company.OUR_SERVICE = txtOUR_SERVICE.Text;
                    company.OUR_FLEET   = txtOUR_FLEET.Text;
                    company.Contact_Us  = txtContact_Us.Text;

                    company.State_Tax = !string.IsNullOrEmpty(txtTaxState.Text)? double.Parse(txtTaxState.Text): new double?();
                    company.City_Tax  = !string.IsNullOrEmpty(txtTaxCity.Text) ? double.Parse(txtTaxCity.Text) : new double?();

                    company.OtherTax1    = !string.IsNullOrEmpty(txtOtherTax1.Text) ? double.Parse(txtOtherTax1.Text) : new double?();
                    company.Tax1Note     = txtOtherTax1Note.Text;
                    company.OtherTax2    = !string.IsNullOrEmpty(txtOtherTax2.Text) ? double.Parse(txtOtherTax2.Text) : new double?();
                    company.Tax2Note     = txtOtherTax2Note.Text;
                    company.Gratuity     = !string.IsNullOrEmpty(txtGratuity.Text) ? double.Parse(txtGratuity.Text) : new double?();
                    company.GratuityNote = txtGratuityNote.Text;

                    string imagPublishedPath = string.Empty;
                    if (fu_Image.HasFile)
                    {
                        imagPublishedPath = SaveImg(fu_Image);
                    }
                    if (!string.IsNullOrEmpty(imagPublishedPath))
                    {
                        company.imagePath = imagPublishedPath;
                    }
                    company.Description = txtDescription.Text;
                    limoEntities.SaveChanges();
                    if (adminHelper.CompanyObject != null)
                    {
                        adminHelper.CompanyObject = company;
                    }
                }
                //company.Password = txtPassword.Text;
                IsOperationSucceed = true;
                Response.Redirect(Request.RawUrl);
            }
            catch (Exception)
            {
                divError.Visible = true;
            }
        }
Beispiel #14
0
        private void ManageCompany()
        {
            LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
            AdminHelper adminHelper = new AdminHelper();

            if (CompanyID != 0 && adminHelper.CompanyObject != null)
            {
                Company company =
                    limoEntities.Companies.Where(xx => xx.CompanyID == adminHelper.CompanyObject.CompanyID).ToList().FirstOrDefault();
                if (company != null)
                {
                    if (company.CompanyName.ToLower() == txtCompanyName.Text.ToLower() || (company.CompanyName != txtCompanyName.Text &&
                                                                                           limoEntities.Companies.Where(xx => xx.CompanyName.ToLower() == txtCompanyName.Text.ToLower()).ToList().Count == 0))
                    {
                        if (company.UserName.ToLower() == txtUserName.Text.ToLower() || (company.UserName != txtUserName.Text &&
                                                                                         limoEntities.Companies.Where(xx => xx.UserName.ToLower() == txtUserName.Text.ToLower()).ToList().Count == 0))
                        {
                            company.CompanyName = txtCompanyName.Text;
                            company.UserName    = txtUserName.Text;
                            company.Password    = txtPassword.Text;
                            company.IsActive    = cbIsActive.Checked;
                            company.IsAvailable = cbIsAvailable.Checked;
                            company.IsTop       = cbIsTop.Checked;
                            company.Email       = txtEmail.Text;
                            company.Phone       = txtMobilePhone.Text;
                            company.IsDespath   = cbAllowDespatch.Checked;
                            limoEntities.SaveChanges();
                            adminHelper.CompanyObject = null;
                            EmailManager.SendEmail("Limoallover Account", CreateUpdateEmailMessageBody(), txtEmail.Text, true);
                            Response.Redirect("~/admin/Pages/ManageCompany.aspx");
                        }
                        else
                        {
                            lblError.Text    = "User Name Already Exist";
                            lblError.Visible = true;
                        }
                    }
                    else
                    {
                        lblError.Visible = true;
                    }
                }
            }
            else if (limoEntities.Companies.Where(xx => xx.CompanyName.ToLower() == txtCompanyName.Text.ToLower()).ToList().Count == 0)
            {
                if (limoEntities.Companies.Where(xx => xx.UserName.ToLower() == txtUserName.Text.ToLower()).ToList().Count == 0)
                {
                    Company company = new Company();
                    company.CompanyName = txtCompanyName.Text;
                    company.UserName    = txtUserName.Text;
                    company.Password    = txtPassword.Text;
                    company.IsActive    = cbIsActive.Checked;
                    company.IsAvailable = cbIsAvailable.Checked;
                    company.IsTop       = cbIsTop.Checked;
                    company.Email       = txtEmail.Text;
                    company.Phone       = txtMobilePhone.Text;
                    company.IsDespath   = cbAllowDespatch.Checked;
                    limoEntities.Companies.AddObject(company);
                    limoEntities.SaveChanges();
                    adminHelper.CompanyObject = null;
                    EmailManager.SendEmail("Limoallover Account", CreateEmailMessageBody(), txtEmail.Text, true);
                    EmailManager.SendEmail("Limoallover Account", CreateAdminEmailMessageBody(), "", true, true);
                    if (!IsSingnUP)
                    {
                        Response.Redirect("~/admin/Pages/ManageCompany.aspx");
                    }
                    else
                    {
                        Response.Redirect("~/admin/Pages/CompanyProfile.aspx");
                    }
                }
                else
                {
                    lblError.Text    = "User Name Already Exist";
                    lblError.Visible = true;
                }
            }
            else
            {
                lblError.Visible = true;
            }
        }
Beispiel #15
0
        private void ProcessDespatchData()
        {
            if (!string.IsNullOrEmpty(hfLAtLng.Value) && !string.IsNullOrEmpty(hfLAtLngTo.Value))
            {
                var        tempLatLng   = hfLAtLng.Value.Split(',');
                var        lat          = tempLatLng[0];
                var        lng          = tempLatLng[1];
                var        tempLatLngTo = hfLAtLngTo.Value.Split(',');
                var        latTo        = tempLatLngTo[0];
                var        lngTo        = tempLatLngTo[1];
                JobWrapper jobWrapper   = new JobWrapper();
                if (hfDistance.Value != null)
                {
                    if (hfDistance.Value == "-1" || string.IsNullOrEmpty(hfDistance.Value))
                    {
                        string message = "Google Map could not be created for the entered parameters. Please be specific while providing the destination location.";
                        string script  = "alert('" + message + "');";
                        ScriptManager.RegisterClientScriptBlock(this, GetType(), "alert", script, true);
                    }
                    else if (!IsValidDate)
                    {
                        string message = " Invalid Date / Time.";
                        string script  = "alert('" + message + "');";
                        ScriptManager.RegisterClientScriptBlock(this, GetType(), "alert", script, true);
                    }
                    else
                    {
                        double temp = 0, duration = 1;
                        double minMile = double.Parse(ConfigurationSettings.AppSettings["MinMile"]);
                        double.TryParse(hfDistance.Value, out temp);
                        temp = temp == 0 || temp < minMile ? minMile : temp;
                        string[] arrTemp = hfDuration.Value.Split(' ');
                        if (arrTemp.Length == 4)
                        {
                            duration = (double.Parse(arrTemp[0])) * 60 + double.Parse(arrTemp[2]);
                        }
                        else if (arrTemp.Length == 2)
                        {
                            double.TryParse(hfDuration.Value.Split(' ')[0], out duration);
                        }
                        duration = duration * 1 / 60;
                        duration = duration <= 1 ? 1 : duration <= 2 ? 2 : duration;

                        try
                        {
                            AddJobtoLimoAnyWhere();
                        }
                        catch (Exception)
                        {
                        }

                        LimoEntitiesEntityFremwork limoEntity = new LimoEntitiesEntityFremwork();
                        Job job = new Job();
                        job.FromAddress = txtSource.Text;      // +", NEW YORK, NY, USA";
                        job.ToAddress   = txtDistenation.Text; // +", NEW YORK, NY, USA";
                        job.JobDate     = DateTime.Parse(txtDatepicker.Text);
                        //job.NOUsers = int.Parse(ddlNOPassenger.SelectedValue);
                        job.JobTime = ddlHour.SelectedItem.Text.Substring(0, 2) +
                                      ddlMinutes.SelectedItem.Text + ddlHour.SelectedItem.Text.Substring(2);
                        double price = 0;
                        double.TryParse(txtTotalPrice.Text, out price);
                        job.TotalPrice = price;
                        job.FirstName  = txtFirstName.Text;
                        job.LastName   = txtLastName.Text;
                        job.Email      = txtPassEmail.Text;
                        job.Mobile     = txtPassMobile.Text;
                        string       pending   = Limo_Gloabel.JobStatus.Pending.ToString().ToLower();
                        DAL.JobStatu jobStatus =
                            limoEntity.JobStatus.Where(obj => obj.JobStatus.ToLower() == pending).FirstOrDefault();
                        if (jobStatus != null)
                        {
                            job.JobStatusID = jobStatus.JobStatusID;
                        }
                        job.IsDespath = true;
                        job.JobBy     = 1;
                        var noPass = ddlNOPassenger.SelectedItem.Text;
                        if (noPass.StartsWith("0"))
                        {
                            noPass = noPass.Remove(0, 1);
                        }
                        job.NoPassenger = int.Parse(noPass);
                        if (CorPorateID > 0)
                        {
                            job.CorporateID = CorPorateID;
                        }
                        job.FromLat = lat;
                        job.FromLng = lng;
                        job.ToLat   = latTo;
                        job.ToLng   = lngTo;

                        job.Notes = txtNote.Text;

                        limoEntity.Jobs.AddObject(job);
                        limoEntity.SaveChanges();
                        job.ComapnyConfirmNum = job.JobID.ToString() + DateTime.Now.Day.ToString() +
                                                DateTime.Now.Month.ToString() +
                                                DateTime.Now.Year.ToString().Substring(2);

                        job.LimoConfirmNumber = "L" + job.JobID.ToString() + DateTime.Now.Day.ToString() +
                                                DateTime.Now.Month.ToString() +
                                                DateTime.Now.Year.ToString().Substring(2);
                        limoEntity.SaveChanges();

                        //Service1.LimoAllOver ccc = new Service1.LimoAllOver();
                        MobileService.LimoAllOver ccc = new MobileService.LimoAllOver();
                        ccc.GetDriversNearMe(lng, lat, "1", job.JobID);
                        Response.Redirect("~/Admin/Pages/Despatch.aspx");
                    }
                }
            }
        }