static void Main() { //variable Declarations string fs; FileStream file; DriversList driversList = new DriversList(); Report report = new Report(); //open file //the actual file name should be dependency injection fs = @"C:\GitHub\CodeKata\CodeKataApp\SampleInput.txt"; file = TextFile.OpenFile(fs); try { //Process the file into List of Drivers List <Driver> drivers = driversList.CreateList(file); //Create Report File from List of Drivers report.CreateReport(drivers); } finally { //close file file.Close(); } }
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(); } } }
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; } }
private void SelectAll_CheckedChanged(object sender, EventArgs e) { if (SelectAll.Checked == true) { for (int i = DriversList.Items.Count - 1; i >= 0; i--) { DriversList.SetItemCheckState(i, CheckState.Checked); } } }
private void LoadMoreDrivers(uint arg1, int index) { NotifyTaskCompletion.Create <IEnumerable <ClientSummaryExtended> >(_clientDataServices.GetPagedSummaryDoAsync(index, DefaultPageSize), (sender, ev) => { if (sender is INotifyTaskCompletion <IEnumerable <ClientSummaryExtended> > value) { if (value.IsSuccessfullyCompleted) { var result = value.Task.Result.Except(DriversList); DriversList.LoadItems(result); } } }); }
public override IEnumerable <Driver> GetAll() { connection.Command.Parameters.Clear(); connection.Command.CommandText = "select * from водители"; DriversList list = new DriversList(); using (MySqlDataReader reader = connection.Command.ExecuteReader()) { if (reader.HasRows) // если есть данные { while (reader.Read()) { list.Add(new Driver((int)reader.GetValue(0), (string)reader.GetValue(1), (string)reader.GetValue(2))); } } } return(list); }
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; } } } }