protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AdminHelper adminHelper = new AdminHelper(); if (adminHelper.CompanyObject != null) { LimoEntitiesEntityFremwork dc = new LimoEntitiesEntityFremwork(); DriversList = dc.Drivers.Where(xx => xx.CompanyID == adminHelper.CompanyObject.CompanyID).ToList(); if (DriversList.Count > 0) { DriversList = DriversList.OrderBy(yyy => yyy.FullName).ToList(); } foreach (var driver in DriversList) { if (!driver.ShowOnMap.HasValue) { driver.ShowOnMap = false; } } GridView1.DataSource = DriversList; GridView1.DataBind(); } } }
private void ProcessData() { JobWrapper jobWrapper = new JobWrapper(); LimoEntitiesEntityFremwork limoEntity = new LimoEntitiesEntityFremwork(); //List<DAL.Car> JobCarsList = new List<Car>(); // if (jobWrapper.UserNumber != 0) // JobCarsList = limoEntity.Cars.Where(obj => obj.CompanyID == jobWrapper.UserNumber).ToList(); //JobCarsList.Insert(0, new DAL.Car() { CarID = 0, CarName = "Select .." }); //ddlStatus.DataSource = JobCarsList; //ddlStatus.DataTextField = "JobStatus"; //ddlStatus.DataValueField = "JobStatusID"; //ddlStatus.DataBind(); //ddlStatus.SelectedValue = "0"; List <Job> jobsList = new List <Job>(); string doneStatus = Limo_Gloabel.JobStatus.Done.ToString().ToLower(); var dateString = DateTime.Now.ToString("mm/dd/yyyy"); var dateNow = DateTime.Now.Date; jobsList = limoEntity.Jobs.Where(obj => obj.IsDespath.HasValue && obj.IsDespath.Value && obj.JobDate.HasValue && EntityFunctions.TruncateTime(obj.JobDate.Value) >= dateNow).ToList(); ReservationList = jobsList; //List<JobWrapperDespatch> jobWrapperDespatchList = new List<JobWrapperDespatch>(); //foreach (var item in ReservationList) //{ // jobWrapperDespatchList.Add(new JobWrapperDespatch() { CarsList = JobCarsList, jobWrapperDespatch = item }); //} GridView1.DataSource = ReservationList; GridView1.DataBind(); }
private void PrepareCompanyInformation(JobObjectDetails jobObjectDetails) { int?companyID = jobObjectDetails.CompanyID; if (companyID.HasValue) { LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork(); Company company = limoEntities.Companies.Where(xxx => xxx.CompanyID == companyID.Value).FirstOrDefault(); if (company != null) { imgLogo.ImageUrl = company.imagePath != null ? company.imagePath : string.Empty; lblCompanyName.Text = company.CompanyName != null ? company.CompanyName : string.Empty; divAboutUs.InnerText = company.About_Us != null ? company.About_Us : string.Empty; divDescription.InnerText = company.Description != null ? company.Description : string.Empty; divOurService.InnerText = company.OUR_SERVICE != null ? company.OUR_SERVICE : string.Empty; divOurFleet.InnerText = company.OUR_FLEET != null ? company.OUR_FLEET : string.Empty; divContactUs.InnerText = company.Contact_Us != null ? company.Contact_Us : string.Empty; } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (!IsPostBack) { int id = 0; int.TryParse(Request.QueryString["id"], out id); //int id = int.Parse(hfCarID.Value); JobWrapper jobWrapper = new JobWrapper(); if (id != 0 && jobWrapper.JobDetailsObject.CarID == 0) { LimoEntitiesEntityFremwork limoEnitiies = new LimoEntitiesEntityFremwork(); DAL.Car car = limoEnitiies.Cars.Where(xx => xx.CarID == id).FirstOrDefault(); if (car != null) { double distancePrice = jobWrapper.JobDetailsObject.Distance * (car.PricePerMaile != null ? car.PricePerMaile.Value : 1); double hourPrice = jobWrapper.JobDetailsObject.JobDurationPerHours * (car.PricePerHore != null ? car.PricePerHore.Value : 1); double tempPrice = distancePrice + hourPrice; car.TotalPrice = tempPrice; jobWrapper.JobDetailsObject.JobCompanyName = car.CompanyName; jobWrapper.JobDetailsObject.JobCarType = car.CarName; jobWrapper.JobDetailsObject.JobBasePrise = car.TotalPrice; jobWrapper.JobDetailsObject.CarID = car.CarID; jobWrapper.JobDetailsObject.CompanyID = car.CompanyID; } } } }
private void GetCompanyInformation() { AdminHelper adminHelper = new AdminHelper(); int id = 0; int.TryParse(Request.QueryString["id"], out id); if (id != 0) { CompanyID = id; LimoEntitiesEntityFremwork imoEntities = new LimoEntitiesEntityFremwork(); Company company = imoEntities.Companies.Where(xx => xx.CompanyID == id).ToList().FirstOrDefault(); if (company != null) { adminHelper.CompanyObject = company; txtCompanyName.Text = company.CompanyName; txtUserName.Text = company.UserName; cbIsActive.Checked = company.IsActive.HasValue ? company.IsActive.Value : false; cbIsAvailable.Checked = company.IsAvailable.HasValue ? company.IsAvailable.Value : false; cbIsTop.Checked = company.IsTop.HasValue ? company.IsTop.Value : false; txtEmail.Text = company.Email; txtMobilePhone.Text = company.Phone; cbAllowDespatch.Checked = company.IsDespath.HasValue ? company.IsDespath.Value : false; } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; string noPassengerString = context.Request.QueryString["NOPassenger"]; //JobWrapper jobWrapper = new JobWrapper(); string driverLocationLatLan = string.Empty; LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork(); List <Car> carList = limoEntities.Cars.ToList(); Car car; List <DriverLocation> driverLocationsListq = limoEntities.DriverLocations.ToList(); int x = driverLocationsListq.Count; List <DriverLocation> driverLocationsList = limoEntities.DriverLocations.Where(xxx => xxx.Driver.ShowOnMap.HasValue && xxx.Driver.ShowOnMap.Value).ToList(); string photoNames = string.Empty; string isAvailable = "false"; int noPassenger = 0; // jobWrapper.JobDetailsObject.UserNumberINT; if (!string.IsNullOrEmpty(noPassengerString)) { int.TryParse(noPassengerString, out noPassenger); } string companyName = string.Empty; string carNumber = string.Empty; foreach (var driverLocation in driverLocationsList) { car = carList.Where(xxx => driverLocation.Driver.CarID.HasValue && xxx.CarID == driverLocation.Driver.CarID.Value).FirstOrDefault(); if (car != null && car.NoPassengers >= noPassenger) { photoNames = car.PhotoName; isAvailable = driverLocation.Driver.IsAvailable.HasValue ? driverLocation.Driver.IsAvailable.Value.ToString().ToLower() : "false"; if (car.CompanyName != null) { companyName = car.CompanyName; } else { companyName = string.Empty; } if (!string.IsNullOrEmpty(car.CarNumber)) { carNumber = car.CarNumber; } else { carNumber = string.Empty; } driverLocationLatLan += driverLocation.Lat + "_" + driverLocation.Lng + "_" + photoNames + "_" + car.CarID + "_" + isAvailable + "_" + "Operator by " + companyName + "_" + carNumber + ","; } } context.Response.Write(driverLocationLatLan); context.Response.End(); }
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; } }
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 Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LimoEntitiesEntityFremwork dc = new LimoEntitiesEntityFremwork(); CompanyList = dc.Companies.OrderBy(xx => xx.CompanyName).ToList(); GridView1.DataSource = CompanyList; GridView1.DataBind(); } }
protected void butLogin_Click(object sender, ImageClickEventArgs e) { AdminHelper adminHelper = new AdminHelper(); LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork(); string adminUserName = ConfigurationSettings.AppSettings["AdminUserName"]; //Your Api ID string adminPassword = ConfigurationSettings.AppSettings["AdminPassword"]; //Your Api Key if (cbCorporate.Checked) { adminHelper.CorporateObject = limoEntities.Corporates.Where(xx => xx.UserName.ToLower() == txtUsername.Text.ToLower() && xx.Password == txtPassword.Text && xx.IsActive.HasValue && xx.IsActive.Value).FirstOrDefault(); if (adminHelper.CorporateObject != null) { lblError.Visible = false; adminHelper.AdminUser = adminHelper.CorporateObject.UserName; adminHelper.IsAdmin = false; Response.Redirect("~/admin/Pages/Despatch.aspx"); } else { lblError.Visible = true; adminHelper.AdminUser = null; adminHelper.IsAdmin = false; } } else { if (txtUsername.Text.ToLower() == adminUserName.ToLower() && txtPassword.Text == adminPassword) { lblError.Visible = false; adminHelper.AdminUser = adminUserName; adminHelper.IsAdmin = true; Response.Redirect("~/admin/Pages/ManageCompany.aspx"); } else { adminHelper.CompanyObject = limoEntities.Companies.Where(xx => xx.UserName.ToLower() == txtUsername.Text.ToLower() && xx.Password == txtPassword.Text && xx.IsActive.HasValue && xx.IsActive.Value).FirstOrDefault(); if (adminHelper.CompanyObject != null) { lblError.Visible = false; adminHelper.AdminUser = adminHelper.CompanyObject.UserName; adminHelper.IsAdmin = false; Response.Redirect("~/admin/Pages/CompanyProfile.aspx"); } else { lblError.Visible = true; adminHelper.AdminUser = null; adminHelper.IsAdmin = false; } } } }
protected void Page_Load(object sender, EventArgs e) { JobWrapper jobWrapper = new JobWrapper(); if (jobWrapper.JobDetailsObject != null) { jobWrapper.ISReservationExist = true; //if (JobWrapper.UserNumber == null) // Response.Redirect("~/Pages/Login.aspx"); //else //{ FeesDetais1.IsReadOnly = true; ddlExpirationYear.Items.Add(new ListItem("YYYY", "-1")); ddlExpirationYear.Items.Add(new ListItem(DateTime.Now.Year.ToString(), DateTime.Now.Year.ToString().Substring(2))); ddlExpirationYear.Items.Add(new ListItem(DateTime.Now.AddYears(1).Year.ToString(), DateTime.Now.AddYears(1).Year.ToString().Substring(2))); ddlExpirationYear.Items.Add(new ListItem(DateTime.Now.AddYears(2).Year.ToString(), DateTime.Now.AddYears(2).Year.ToString().Substring(2))); ddlExpirationYear.Items.Add(new ListItem(DateTime.Now.AddYears(3).Year.ToString(), DateTime.Now.AddYears(3).Year.ToString().Substring(2))); ddlExpirationYear.Items.Add(new ListItem(DateTime.Now.AddYears(4).Year.ToString(), DateTime.Now.AddYears(4).Year.ToString().Substring(2))); ddlExpirationYear.Items.Add(new ListItem(DateTime.Now.AddYears(5).Year.ToString(), DateTime.Now.AddYears(5).Year.ToString().Substring(2))); ddlExpirationYear.Items.Add(new ListItem(DateTime.Now.AddYears(6).Year.ToString(), DateTime.Now.AddYears(6).Year.ToString().Substring(2))); ddlExpirationYear.Items.Add(new ListItem(DateTime.Now.AddYears(7).Year.ToString(), DateTime.Now.AddYears(7).Year.ToString().Substring(2))); ddlExpirationYear.Items.Add(new ListItem(DateTime.Now.AddYears(8).Year.ToString(), DateTime.Now.AddYears(8).Year.ToString().Substring(2))); //} GetAccountByAccountNumber(); if (!IsPostBack) { LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork(); List <DAL.State> statesList = limoEntities.States.ToList(); statesList.Insert(0, new DAL.State() { state_code = "-1", StateName = "Select .." }); ddlState.DataSource = statesList; ddlState.DataTextField = "StateName"; ddlState.DataValueField = "state_code"; ddlState.DataBind(); } } else { Response.Redirect("~/Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AdminHelper adminHelper = new AdminHelper(); if (adminHelper.CompanyObject != null) { LimoEntitiesEntityFremwork dc = new LimoEntitiesEntityFremwork(); CarsList = dc.Cars.Where(xx => xx.CompanyID == adminHelper.CompanyObject.CompanyID).OrderBy(yyy => yyy.CarName).ToList(); GridView1.DataSource = CarsList; GridView1.DataBind(); } } }
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 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()); }
protected void butLogin_Click(object sender, ImageClickEventArgs e) { //string apiId = ConfigurationSettings.AppSettings["apiId"]; //Your Api ID //string apiKey = ConfigurationSettings.AppSettings["apiKey"]; //Your Api Key //var apiService = new ApiService(); //LoginResponse response = apiService.LoginAccount(apiId, apiKey, txtUsername.Text, txtPassword.Text); //if (string.IsNullOrEmpty(response.AcctNumber)) // lblError.Visible = true; //else //{ try { LimoEntitiesEntityFremwork limoEntity = new LimoEntitiesEntityFremwork(); Lemo.DAL.Corporate corporate = limoEntity.Corporates.Where( xx => xx.UserName.ToLower() == txtUsername.Text.ToLower() && xx.Password.ToLower() == txtPassword.Text.ToLower()). ToList().FirstOrDefault(); if (corporate != null) { lblError.Visible = false; JobWrapper jobWrapper = new JobWrapper(); //jobWrapper.JobDetailsObject.userID = user.UserID; jobWrapper.CorporateNumber = corporate.ID; if (jobWrapper.JobDetailsObject != null && jobWrapper.ISReservationExist) { AddJob(); jobWrapper.JobDetailsObject = null; butLogin.Visible = false; //Response.Redirect("~/Pages/CompleteReservation.aspx"); } else { Response.Redirect("~/Pages/ManageReservation.aspx"); } } else { lblError.Visible = true; } } catch (Exception) { lblError.Visible = true; } }
private void ProcessData() { JobWrapper jobWrapper = new JobWrapper(); AdminHelper adminHelper = new AdminHelper(); LimoEntitiesEntityFremwork limoEntity = new LimoEntitiesEntityFremwork(); List <Job> jobsList = new List <Job>(); string doneStatus = Limo_Gloabel.JobStatus.Done.ToString().ToLower(); DateTime date = GetSelectedDate(); string dateString = date.ToString("MM/dd/yyyy"); if (adminHelper.IsAdmin) { jobsList = limoEntity.Jobs.Where(obj => obj.JobDate == date && obj.JobStatu != null && obj.JobStatu.JobStatus != null && obj.JobStatu.JobStatus.ToLower() != doneStatus && (!obj.IsDespath.HasValue || (obj.IsDespath.HasValue && !obj.IsDespath.Value))).ToList(); } else if (jobWrapper.UserNumber != 0) { jobsList = limoEntity.Jobs.Where(xx => xx.UserID.HasValue && xx.UserID == jobWrapper.UserNumber && xx.JobDate == date).ToList(); } else { if (adminHelper.CompanyObject != null) { jobsList = limoEntity.Jobs.Where(xx => xx.JobDate == date && xx.Car.CompanyID == adminHelper.CompanyObject.CompanyID && xx.JobStatu != null && xx.JobStatu.JobStatus != null && xx.JobStatu.JobStatus.ToLower() != doneStatus && (!xx.IsDespath.HasValue || (xx.IsDespath.HasValue && !xx.IsDespath.Value))).ToList(); } else if (adminHelper.CorporateObject != null) { jobsList = limoEntity.Jobs.Where(xx => xx.JobDate == date && xx.CorporateID == adminHelper.CorporateObject.ID && xx.JobStatu != null && xx.JobStatu.JobStatus != null && xx.JobStatu.JobStatus.ToLower() != doneStatus && (!xx.IsDespath.HasValue || (xx.IsDespath.HasValue && !xx.IsDespath.Value))).ToList(); } } //foreach (var job in jobsList) //{ // job.CompanyName = job.Car.Company.CompanyName; //} ReservationList = jobsList; GridView1.DataSource = ReservationList; GridView1.DataBind(); }
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"); }
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 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."; } }
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 GetCorporateInformation() { AdminHelper adminHelper = new AdminHelper(); int id = 0; int.TryParse(Request.QueryString["id"], out id); if (id != 0) { CompanyID = id; LimoEntitiesEntityFremwork imoEntities = new LimoEntitiesEntityFremwork(); var company = imoEntities.Corporates.Where(xx => xx.ID == id).ToList().FirstOrDefault(); if (company != null) { txtCompanyName.Text = company.Name; txtUserName.Text = company.UserName; cbIsActive.Checked = company.IsActive.HasValue ? company.IsActive.Value : false; txtEmail.Text = company.Email; txtMobilePhone.Text = company.Phone; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AdminHelper adminHelper = new AdminHelper(); LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork(); int id = 0; int.TryParse(Request.QueryString["id"], out id); if (id != 0) { CarID = id; DAL.Car carTemp = limoEntities.Cars.Where(xx => xx.CarID == CarID).ToList(). FirstOrDefault(); if (carTemp != null) { txtCarName.Text = carTemp.CarName; txtDescription.Text = carTemp.Description; //txtPrice.Text = carTemp.MinPrice.HasValue ? carTemp.MinPrice.Value.ToString() : string.Empty; txtPricePerHour.Text = carTemp.PricePerHore.HasValue ? carTemp.PricePerHore.Value.ToString() : string.Empty; txtPricePerMile.Text = carTemp.PricePerMaile.HasValue ? carTemp.PricePerMaile.Value.ToString() : string.Empty; ddlNoPassengers.SelectedValue = carTemp.NoPassengers != null ? carTemp.NoPassengers.ToString() : "1"; imgLogo.ImageUrl = carTemp.PhotoName ?? string.Empty; GetCarType(carTemp.CarName); txtCarNumber.Text = carTemp.CarNumber; } } else { rbSedan.Checked = true; } } }
private void GetAccountByAccountNumber() { JobWrapper jobWrapper = new JobWrapper(); if (jobWrapper.UserNumber != 0) { //string apiId = ConfigurationSettings.AppSettings["apiId"]; //Your Api ID //string apiKey = ConfigurationSettings.AppSettings["apiKey"]; //Your Api Key //var apiService = new ApiService(); //AccountResponse accountResponse = apiService.GetAccountsByAcctNumber(apiId, apiKey, // jobWrapper.UserNumber); LimoEntitiesEntityFremwork limoEntity = new LimoEntitiesEntityFremwork(); Lemo.DAL.User user = limoEntity.Users.Where(xx => xx.UserID == jobWrapper.UserNumber).ToList().FirstOrDefault(); if (user != null) { txtPassFirstName.Text = user.FirstName; txtPassLastName.Text = user.LastName; txtPassEmail.Text = user.Email; txtPassMobile.Text = user.Mobile; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AdminHelper adminHelper = new AdminHelper(); LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork(); var carsList = limoEntities.Cars.Where(xx => xx.CompanyID == adminHelper.CompanyObject.CompanyID).ToList(); carsList.Insert(0, new DAL.Car() { CarID = 0, CarName = "Select .." }); ddlCars.DataSource = carsList; ddlCars.DataTextField = "CarNameWithNumber"; ddlCars.DataValueField = "CarID"; ddlCars.DataBind(); int id = 0; int.TryParse(Request.QueryString["id"], out id); if (id != 0) { DriverID = id; DAL.Driver driverTemp = limoEntities.Drivers.Where(xx => xx.DriverID == DriverID).ToList().FirstOrDefault(); if (driverTemp != null) { txtFirstName.Text = driverTemp.FName; txtLastName.Text = driverTemp.LName; txtEmail.Text = driverTemp.Email; txtMobilePhone.Text = driverTemp.Phone; cbShowOnMap.Checked = driverTemp.ShowOnMap.HasValue ? driverTemp.ShowOnMap.Value : false; txtPassword.Text = driverTemp.Password; ddlCars.SelectedValue = driverTemp.CarID.HasValue ? driverTemp.CarID.Value.ToString() : "0"; } } } }
protected void Page_Load(object sender, EventArgs e) { AdminHelper adminHelper = new AdminHelper(); if (!IsPostBack) { using (var DC = new LimoEntitiesEntityFremwork()) { ddlDistance.SelectedValue = adminHelper.CompanyObject.DistancePerMile.HasValue ? adminHelper.CompanyObject.DistancePerMile.Value.ToString() : "0"; 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; } GridView1.DataSource = CitiesList; GridView1.DataBind(); } } if (adminHelper.CompanyObject != null && !string.IsNullOrEmpty(adminHelper.CompanyObject.ZipCode) && !(adminHelper.CompanyObject.IsSupportAllState.HasValue && adminHelper.CompanyObject.IsSupportAllState.Value)) { string script = "var ZipCodeValue='" + adminHelper.CompanyObject.ZipCode + "';"; this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "ZipCodeScript", script, true); } else { Response.Redirect("~/admin/Pages/CompanyProfile.aspx"); } }
void AddJob() { JobWrapper jobWrapper = new JobWrapper(); if (jobWrapper.JobDetailsObject != null) { LimoEntitiesEntityFremwork limmoEntity = new LimoEntitiesEntityFremwork(); Company company = limmoEntity.Companies.Where(xx => xx.CompanyID == jobWrapper.JobDetailsObject.CompanyID).ToList(). FirstOrDefault(); string tripConfirmationNumber = string.Empty; if (company != null) { string apiId = company.LimoAPIID; //Your Api ID string apiKey = company.LimoAPIKey; //Your Api Key tripConfirmationNumber = AddJobtoCompanyLimoAnyWhere(apiId, apiKey, company); string limoAPIId = ConfigurationSettings.AppSettings["apiId"]; //Your Api ID string LimoAPIapiKey = ConfigurationSettings.AppSettings["apiKey"]; //Your Api Key if (company.LimoAPIID != limoAPIId && company.LimoAPIKey != LimoAPIapiKey) { AddJobtoCompanyLimoAnyWhere(limoAPIId, LimoAPIapiKey, company, tripConfirmationNumber); } } //string tripConfirmationNumber = AddJobtoCompanyLimoAnyWhere(); Job job = SaveJobInDatabase(tripConfirmationNumber); SendEmail(job); divConfirmation.Visible = true; divProblem.Visible = false; } else { Response.Redirect("~/Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AdminHelper adminHelper = new AdminHelper(); LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork(); int id = 0; int.TryParse(Request.QueryString["id"], out id); if (id != 0) { ContactPersonID = id; ContactPerson contactTemp = limoEntities.ContactPersons.Where(xx => xx.ContactPersonID == ContactPersonID).ToList().FirstOrDefault(); if (contactTemp != null) { txtFirstName.Text = contactTemp.FirstName; txtLastName.Text = contactTemp.LastName; txtEmail.Text = contactTemp.Email; txtMobilePhone.Text = contactTemp.Phone; txtJob.Text = contactTemp.Job; } } } }
private void ProcessData(DAL.Job job = null) { AdminHelper adminHelper = new AdminHelper(); JobWrapper jobWrapper = new JobWrapper(); if (adminHelper.AdminUser != null) { divPriceDetails.Visible = true; } else if (jobWrapper.UserNumber != 0) { divPriceDetails.Visible = false; ddlDrivers.Enabled = false; ddlStatus.Enabled = false; } int id = 0; int.TryParse(Request.QueryString["id"], out id); if (id != 0 || job != null) { LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork(); JobID = id; DAL.Job tempJob = job ?? limoEntities.Jobs.Where(xx => xx.JobID == JobID).ToList(). FirstOrDefault(); if (tempJob != null) { DriversList = limoEntities.Drivers.Where(xx => xx.CompanyID == tempJob.Car.CompanyID).ToList(); DriversList.Insert(0, new DAL.Driver() { DriverID = 0, FullName = "Select .." }); ddlDrivers.DataSource = DriversList; ddlDrivers.DataTextField = "FullName"; ddlDrivers.DataValueField = "DriverID"; ddlDrivers.DataBind(); List <DAL.JobStatu> JobStatuList = limoEntities.JobStatus.Where(obj => obj.JobStatusID != (int)Limo_Gloabel.JobStatus.Pending && //obj.JobStatusID != (int)Limo_Gloabel.JobStatus.Accepted && obj.JobStatusID != (int)Limo_Gloabel.JobStatus.Rejected).ToList(); JobStatuList.Insert(0, new DAL.JobStatu() { JobStatusID = 0, JobStatus = "Select .." }); ddlStatus.DataSource = JobStatuList; ddlStatus.DataTextField = "JobStatus"; ddlStatus.DataValueField = "JobStatusID"; ddlStatus.DataBind(); txtFirstName.Text = tempJob.FirstName; txtLastName.Text = tempJob.LastName; txtPH.Text = tempJob.Mobile; txUserEmail.Text = tempJob.Email; txtFrom.Text = tempJob.FromAddress; txtTo.Text = tempJob.ToAddress; txtPickUpDate.Text = tempJob.JobDate.Value.ToString("MM/dd/yyyy"); txtPickUpTime.Text = tempJob.JobTime; txtGratuity.Text = tempJob.GratuityPrice.HasValue ? tempJob.GratuityPrice.Value.ToString() : string.Empty; txtEstimatedFarePrice.Text = tempJob.EstimatedFarePrice.HasValue ? tempJob.EstimatedFarePrice.Value.ToString() : string.Empty; txtProcessingFee.Text = tempJob.ProcessingFee.HasValue ? tempJob.ProcessingFee.Value.ToString() : string.Empty; txtTaxes.Text = tempJob.Taxes.HasValue ? tempJob.Taxes.Value.ToString() : string.Empty; txtOtherPrice.Text = tempJob.OtherPrice.HasValue ? tempJob.OtherPrice.Value.ToString() : string.Empty; txtOtherPriceNote.Text = tempJob.PriceNote; ddlDrivers.SelectedValue = tempJob.DriverID.HasValue ? tempJob.DriverID.ToString() : "0"; ddlStatus.SelectedValue = tempJob.JobStatusID.HasValue ? tempJob.JobStatusID.ToString() : "0"; if (tempJob.CorporateID.HasValue && tempJob.TotalPrice.HasValue) { lblEstimatedFarePrice.Text = "Total Price"; txtEstimatedFarePrice.Text = tempJob.TotalPrice.Value.ToString(); txtEstimatedFarePrice.ReadOnly = true; txtGratuity.Text = "0"; txtProcessingFee.Text = "0"; txtTaxes.Text = "0"; txtGratuity.ReadOnly = true; txtProcessingFee.ReadOnly = true; txtTaxes.ReadOnly = true; txtOtherPrice.ReadOnly = true; txtOtherPriceNote.ReadOnly = 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; } } } }
protected void Page_Load(object sender, EventArgs e) { JobWrapper jobWrapper = new JobWrapper(); if (jobWrapper.JobDetailsObject != null) { tdFrom.InnerHtml = "<span style='font-weight: bold;color:#49BDFA;font-size:26px;'>From:</span> <br />" + jobWrapper.JobDetailsObject.FromAddress; tdTo.InnerHtml = "<span style='font-weight: bold;color:#49BDFA;font-size:26px;'>To:</span> <br />" + jobWrapper.JobDetailsObject.ToAddress; int? id = jobWrapper.JobDetailsObject.CompanyID; double price = jobWrapper.JobDetailsObject.JobBasePrise; double processingFees = 3; double stateTaxes = 0; // = Math.Round((price * 7 / 100), 2);//Nj state Taxes : 7% //Ne state taxes //double localTxes = Math.Round((price * 0 / 100), 2);//local taxes will be added if applied //double driversWorker = Math.Round((price * 3.5 / 100), 2); //double tolls = 6.5; double gratuity = 0; if (id.HasValue) { LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork(); Company company = limoEntities.Companies.Where(xxx => xxx.CompanyID == id.Value).FirstOrDefault(); if (company != null) { double tax = 0; tax += company.State_Tax.HasValue ? company.State_Tax.Value : 0; tax += company.City_Tax.HasValue ? company.City_Tax.Value : 0; tax += company.OtherTax1.HasValue ? company.OtherTax1.Value : 0; tax += company.OtherTax2.HasValue ? company.OtherTax2.Value : 0; //tax += company.OtherTax3.HasValue ? company.OtherTax3.Value : 0; stateTaxes = Math.Round((price * tax / 100), 2); double gratuityPersentage = company.Gratuity.HasValue ? company.Gratuity.Value : 0; gratuity = Math.Round((price * gratuityPersentage / 100), 2); } } jobWrapper.JobDetailsObject.JobGratuity = gratuity; jobWrapper.JobDetailsObject.JobProcessingFees = processingFees; jobWrapper.JobDetailsObject.JobStateTaxes = stateTaxes; //JobWrapper.JobDetailsObject.JobLocalTxes = localTxes; //JobWrapper.JobDetailsObject.JobDriversWorker = driversWorker; //JobWrapper.JobDetailsObject.JobTolls = tolls; _total = price + gratuity + processingFees + stateTaxes; // +localTxes + driversWorker;// +tolls; _total = Math.Round(_total, 2); tdBaseFees.InnerText = "$ " + price; tdGratuity.InnerText = "$ " + gratuity; tdProcessingFees.InnerText = "$ " + processingFees; tdStateTaxes.InnerText = "$ " + stateTaxes; //tdLocalTxes.InnerText = "$ " + localTxes; //tdDriversWorker.InnerText = "$ " + driversWorker; //tdTolls.InnerText = "$ " + tolls; tdTaxes.InnerText = "$ " + stateTaxes; // (stateTaxes + localTxes + driversWorker).ToString(); string script = "var Total =" + _total + ";"; ScriptManager.RegisterClientScriptBlock(this, GetType(), "script", script, true); if (IsReadOnly) { butPayment.Visible = false; ImagebutPayment.Visible = false; imgButCoentWithCorporat.Visible = false; cbCarSeat.Visible = false; lblCarSeat.Visible = jobWrapper.JobDetailsObject.IsCarSeatAdd; cbInsidePickup.Visible = false; lblInsidePickup.Visible = jobWrapper.JobDetailsObject.IsInsidePickup; _total = jobWrapper.JobDetailsObject.JobTotalPrise; } lblTotal.Text = "$ " + _total; } }