public CommContracts.Job GetCurrentJob(int employeeID) { using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from u in ctx.EmployeeJobHistorys where u.EmployeeID == employeeID && !u.EndDate.HasValue select u.Job; if (query.Count() == 1) { DAL.Job Job = query.First() as DAL.Job; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.Job, CommContracts.Job>(); }); var mapper = config.CreateMapper(); CommContracts.Job temp = new CommContracts.Job(); temp = mapper.Map <CommContracts.Job>(Job); return(temp); } return(null); } }
public bool SaveJob(CommContracts.Job job) { using (DAL.HisContext ctx = new DAL.HisContext()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.Job, DAL.Job>(); }); var mapper = config.CreateMapper(); DAL.Job temp = new DAL.Job(); temp = mapper.Map <DAL.Job>(job); ctx.Jobs.Add(temp); try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
private void SendEmail(DAL.Job job) { string userEmail, CompanyEmail; if (job.UserID.HasValue) { userEmail = job.User.Email; } else { userEmail = job.Email; } //send email to user EmailManager.SendEmail("Limoallover", CreateEmailMessageBody(job.LimoConfirmNumber, job.ComapnyConfirmNum), userEmail, true); CompanyEmail = job.CompanyEmail; //send email to company EmailManager.SendEmail("Limoallover", CreateEmailMessageBody(job.LimoConfirmNumber, job.ComapnyConfirmNum), CompanyEmail, true); //send email to admin EmailManager.SendEmail("Limoallover", CreateEmailMessageBody(job.LimoConfirmNumber, job.ComapnyConfirmNum), "", true, true); //send email to markting EmailManager.SendEmail("Limoallover", CreateEmailMessageBody(job.LimoConfirmNumber, job.ComapnyConfirmNum), "*****@*****.**", 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 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()); }
public static List <JobView> JobView(List <Job> job) { try { using (DAL.IdialEntities3 dbn = new DAL.IdialEntities3()) { //new connection to the database dbn.Database.Connection.Open(); String diff2 = ""; List <Entities.JobView> jv = new List <JobView>(); DateTime temp; foreach (var item in job) { DAL.Workspace w = dbn.Workspace.FirstOrDefault(p1 => p1.WSId == item.JobWorkspaceId); DAL.SubjectJob s = dbn.SubjectJob.FirstOrDefault(p1 => p1.SubId == item.JobSubId); DAL.OutNet outNet = dbn.OutNet.FirstOrDefault(o => o.OutNetId == item.JobPartOutNetId); DAL.Company company = dbn.Company.FirstOrDefault(q => q.CompanyId == item.JobCompanyId); DAL.City city = dbn.City.FirstOrDefault(c => c.CityId == company.CompanyCityId); DAL.Area area = dbn.Area.FirstOrDefault(a => a.AreaId == company.CompanyAreaId); DAL.SubjectJob SubjectJob = dbn.SubjectJob.FirstOrDefault(o => o.SubId == item.JobSubId); DAL.Part p = dbn.Part.FirstOrDefault(s2 => s2.PartId == item.JobPartId); DAL.Job job1 = dbn.Job.FirstOrDefault(j => j.JobId == item.JobId); Entities.JobView v = new JobView(); DateTime.TryParse(item.JobDateAdv.ToString(), out temp); if (temp != null) { diff2 = Convert.ToInt32((DateTime.Today - temp).TotalDays).ToString(); } v = Entities.JobView.CreateJobView(area, company, job1, SubjectJob, w, p, outNet, city, diff2); jv.Add(v); } db.Database.Connection.Close(); return(jv); } //DAL.IdialEntities3.Connection.Open(); } catch (Exception e) { BL.SendMail.SendEmail(e.ToString(), e.Message, ""); BL.WriteLogError.WriteLogErrors(e.Message); return(null); } }
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"); }
public static Entities.Job JobEntities(DAL.Job j) { return(new Entities.Job() { JobAreaId = j.JobAreaId, JobBossId = j.JobBossId, JobCityId = j.JobCityId, JobCVId = j.JobCVId, JobDateAdv = j.JobDateAdv, JobDateCaughtJob = j.JobDateCaughtJob, JobExperience = j.JobExperience, JobId = j.JobId, JobIsByUs = j.JobIsByUs, JobOfferId = j.JobOfferId, JobPartId = j.JobPartId, JobPartOutNetId = j.JobPartOutNetId, JobRole = j.JobRole, JobStars = j.JobStars, JobStatus = j.JobStatus, JobSubId = j.JobSubId, JobWorkspaceId = j.JobWorkspaceId }); }
//public JobView():base() //{ //} public static Entities.JobView CreateJobView(DAL.Area a, DAL.Company c, DAL.Job j, DAL.SubjectJob s, DAL.Workspace w, DAL.Part p, DAL.OutNet o, DAL.City ci, string diff) { return(new Entities.JobView() { JobDateAdv = j.JobDateAdv, JobDateShow = diff, CompanyName = c.CompanyName, CompanyId = c.CompanyId, JobRole = j.JobRole, JobDateCaughtJob = j.JobDateCaughtJob, PartName = p.PartName, OutNetName = o.OutNetName, WSName = w.WSName, JobExperience = j.JobExperience, JobStars = j.JobStars, JobDescribe = j.JobDescribe, AreaName = a.AreaName, BossId = j.JobBossId, CityName = ci.CityName, SubjectName = s.SubName, JobRequire = j.JobRequire, JobId = j.JobId }); }
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; } } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DAL.Job job = (DAL.Job)e.Row.DataItem; if (job != null) { if (job.JobStatu != null && job.JobStatu.JobStatus.ToLower() != Limo_Gloabel.JobStatus.Pending.ToString().ToLower()) { var actionCell = e.Row.Cells[0]; var accept = actionCell.FindControl("butAccept"); if (accept != null) { accept.Visible = false; } var reject = actionCell.FindControl("butReject"); if (reject != null) { reject.Visible = false; } if (job.JobStatu != null && job.JobStatu.JobStatus.ToLower() == Limo_Gloabel.JobStatus.Rejected.ToString().ToLower()) { actionCell.BackColor = Color.Red; AdminHelper adminHelper = new AdminHelper(); if (!adminHelper.IsAdmin) { var edit = e.Row.Cells[1].FindControl("butEdit"); if (edit != null) { edit.Visible = false; } } } else { actionCell.BackColor = Color.Green; } if (!string.IsNullOrEmpty(job.JobStatu.color)) { Color jobStatusColor = ColorTranslator.FromHtml(job.JobStatu.color); var statusColor = e.Row.Cells[5]; statusColor.BackColor = jobStatusColor; } } else { AdminHelper adminHelper = new AdminHelper(); if (!adminHelper.IsAdmin) { var edit = e.Row.Cells[1].FindControl("butEdit"); if (edit != null) { edit.Visible = false; } } } e.Row.Cells[10].ToolTip = "Email: " + job.CompanyEmail + "\n Phone: " + job.CompanyPhone; e.Row.Cells[9].ToolTip = "Email: " + job.DriverEmail + "\n Phone: " + job.DriverPhone; e.Row.Cells[6].ToolTip = "Email: " + job.PassengerEmail + "\n Phone: " + job.PassengerPhone; } } }