/// <summary> /// Initialise les valeurs des composants à l'ouverture de l'application /// </summary> public void Initialisation() { //On va chercher toutes les courses dans la bdd ListeCourses = Cr.GetAll(); foreach (Resultat r in Rr.GetAll()) { if (r.Course == course) { course.ListeResultat.Add(r); } } //On remplit le menu déroulant foreach (Course cours in ListeCourses) { SelectionCourse.Items.Add("Course " + cours.Id); } //On permet d'importer des participants dans une course si on a une course de disponible if (SelectionCourse.Items.Count != 0) { SelectionCourse.SelectedIndex = 0; ChargerCourse(0); ImporterParticipant.Enabled = true; afficherParticipants.Enabled = true; } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; // Suitable nullity checks etc, of course :) if (Cr != null) { hashCode = hashCode * 59 + Cr.GetHashCode(); } if (Qr != null) { hashCode = hashCode * 59 + Qr.GetHashCode(); } if (Car != null) { hashCode = hashCode * 59 + Car.GetHashCode(); } if (Tlgr != null) { hashCode = hashCode * 59 + Tlgr.GetHashCode(); } if (Dar != null) { hashCode = hashCode * 59 + Dar.GetHashCode(); } if (Em != null) { hashCode = hashCode * 59 + Em.GetHashCode(); } return(hashCode); } }
public IActionResult CancelClass(string mail_id, string course_code, string date) { Cr cr = _context.Cr.FirstOrDefault(s => s.CrMailId == mail_id); List <Routine> routine = new List <Routine>(); if (cr != null) { DateTime tdate = Convert.ToDateTime(date); routine = _context.Routine.Where(s => s.CourseCode == course_code && s.Date == tdate && s.Semester == cr.Semester).ToList(); if (routine.Count == 0) { return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status406NotAcceptable)); } else { _context.Routine.RemoveRange(routine); _context.SaveChanges(); return(Ok(routine)); } } else { return(Unauthorized("No CR With This Mail ID Found")); } }
public void select() { if (clsGlobal.power != "Admin") { var Employees = from DataRow Cr in remaxDatabaseDataSet1.Houses.Rows where Cr.Field <Int32>("refEmployee") == clsGlobal.loggedId select new { refHouse = Cr.Field <Int32>("refHouse"), Bathrooms = Cr.Field <string>("Bathrooms"), NumberOfRooms = Cr.Field <string>("NumberOfRooms"), LivingArea = Cr.Field <string>("LivingArea"), ParkingSpot = Cr.Field <string>("ParkingSpot"), BuiltDate = Cr.Field <string>("BuiltDate"), Bedrooms = Cr.Field <string>("Bedrooms"), Price = Cr.Field <string>("Price"), Address = Cr.Field <string>("Address"), Comments = Cr.Field <string>("Comments") }; grdResult.DataSource = Employees.ToList(); } else { this.housesTableAdapter1.Fill(this.remaxDatabaseDataSet1.Houses); } }
private void frmAgentInfo_Load(object sender, EventArgs e) { txtComment.Enabled = false; picAgent.SizeMode = PictureBoxSizeMode.StretchImage; // TODO: This line of code loads data into the 'remaxDatabaseDataSet1.EmployeeSkills' table. You can move, or remove it, as needed. this.employeeSkillsTableAdapter.Fill(this.remaxDatabaseDataSet1.EmployeeSkills); this.skillsTableAdapter.Fill(this.remaxDatabaseDataSet1.Skills); this.employeesTableAdapter1.Fill(this.remaxDatabaseDataSet1.Employees); if (Application.OpenForms.OfType <frmAdmAgents>().Count() == 1) { Abcd = frm1.grdResult.SelectedRows[0].Cells[3].Value.ToString(); } if (Application.OpenForms.OfType <frmSearch>().Count() == 1) { Abcd = frm2.grdResult.SelectedRows[0].Cells[2].Value.ToString(); } int refnumber = 0; foreach (DataRow Cr in remaxDatabaseDataSet1.Employees.Rows) { if (Cr.Field <String>("Phone") == Abcd) { txtName.Text = Cr["Name"].ToString(); txtPhone.Text = Cr["Phone"].ToString(); txtEmail.Text = Cr["Email"].ToString(); cmbGender.Text = Cr["Gender"].ToString(); cmbPosition.Text = Cr["Position"].ToString(); txtComment.Text = Cr["Comment"].ToString(); refnumber = Convert.ToInt32(Cr["refEmployee"].ToString()); string imgpath = Cr["Picture"].ToString(); if (imgpath.Length != 0 && (System.IO.File.Exists(@"..\..\Images\" + imgpath))) { picAgent.Image = System.Drawing.Image.FromFile(@"..\..\Images\" + imgpath); } else { picAgent.Image = System.Drawing.Image.FromFile(@"..\..\Images\sorry.png"); } } } foreach (DataRow ab in remaxDatabaseDataSet1.EmployeeSkills.Rows) { if (ab.Field <Int32>("refEmployee") == refnumber) { foreach (DataRow cd in remaxDatabaseDataSet1.Skills.Rows) { if (ab.Field <Int32>("refSkill") == cd.Field <Int32>("refSkill")) { string[] row = { ab.Field <Int32>("refSkill").ToString(), cd.Field <String>("SkillName") }; var listViewItem = new ListViewItem(row); listSkills.Items.Add(listViewItem); } } } } }
public async Task <IActionResult> Edit(string id, [Bind("CrMailId,Semester")] Cr cr) { if (id != cr.CrMailId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cr); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CrExists(cr.CrMailId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cr)); }
public override Vector3D SampleF(ref ShadeRec sr, ref Vector3D wo, out Vector3D wi, out double pdf) { float NDotWo = (float)sr.Normal.DotProduct(wo); wi = -wo + 2.0 * sr.Normal.ScaleBy(NDotWo); pdf = Math.Abs(sr.Normal * wi); return(Cr.ScaleBy(Kr)); }
public ServiceResponse GetOrdersForGrid(UserSessionModel user, SearchOrders search) { search.ReturnTotals = true; //var query = from order in this.Context.Orders var query = from order in this.Db.QueryOrderViewableBySearch(user, search)// TODO: this QueryOrderViewableBySearch is very slow. It can cause time out error with super user join project in this.Db.Projects on order.Quote.ProjectId equals project.ProjectId join quote in this.Db.Quotes on order.QuoteId equals quote.QuoteId join discountRequest in this.Context.DiscountRequests on new { project.ProjectId, quote.QuoteId } equals new { discountRequest.ProjectId, discountRequest.QuoteId } into Dr from discountRequest in Dr.OrderByDescending(o => o.Timestamp).Take(1).DefaultIfEmpty() join commissionRequest in this.Context.CommissionRequests on new { project.ProjectId, quote.QuoteId } equals new { commissionRequest.ProjectId, commissionRequest.QuoteId } into Cr from commissionRequest in Cr.OrderByDescending(o => o.Timestamp).Take(1).DefaultIfEmpty() select new OrderGridViewModel { projectId = project.ProjectId, projectName = project.Name, orderId = order.OrderId, poNumber = order.PONumber, erpOrderNumber = order.ERPOrderNumber, poAttachmentName = order.OrderAttachments.FirstOrDefault().FileName, projectOwnerName = project.Owner.FirstName + (project.Owner.MiddleName != null ? " " + project.Owner.MiddleName : "") + " " + project.Owner.LastName, dealerContractorName = project.DealerContractorName, orderStatusTypeId = (OrderStatusTypeEnum)order.OrderStatusTypeId, quoteId = quote.QuoteId, activeQuoteTitle = quote.Title, businessId = project.Owner.BusinessId, businessName = project.Owner.Business.BusinessName, projectDate = project.ProjectDate, submitDate = order.SubmitDate, estimatedDeliveryDate = project.EstimatedDelivery, estimatedReleaseDate = order.EstimatedReleaseDate, ERPShipDate = order.ERPShipDate, pricingTypeId = quote.IsCommission ? (byte)2 : (byte)1, totalNetPrice = quote.TotalNet, totalListPrice = quote.TotalList, totalSellPrice = quote.TotalSell, //totalDiscountPercent = quote.DiscountPercentage, totalDiscountPercent = quote.ApprovedDiscountPercentage, darComStatus = quote.IsCommission ? (commissionRequest != null ? commissionRequest.CommissionRequestStatusType.Description : "") : (discountRequest != null ? discountRequest.DiscountRequestStatusType.Description : ""), vrvODUcount = quote.VRVOutdoorCount, splitODUcount = quote.TotalCountSplitOutdoor, submittedByUserId = user.UserId, submittedByUserName = user.LastName + ", " + user.FirstName, createdByUserId = user.UserId, updatedByUserId = user.UserId, OrderReleaseDate = order.OrderReleaseDate }; this.Response.Model = query.ToList(); return(this.Response); }
public async Task <IActionResult> Create([Bind("CrMailId,Semester")] Cr cr) { if (ModelState.IsValid) { _context.Add(cr); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cr)); }
public IActionResult Reschedule(string mail_id, string cc, string oldDate, string newDate, string begin, string end) { Cr cr = _context.Cr.FirstOrDefault(s => s.CrMailId == mail_id); if (cr != null) { DateTime oDate = Convert.ToDateTime(oldDate); DateTime nDate = Convert.ToDateTime(newDate); TimeSpan t0 = TimeSpan.Parse(begin); TimeSpan t1 = TimeSpan.Parse(end); var available = _context.Routine.Where(s => s.Semester == cr.Semester && s.Date == nDate && s.EndTime > t0 && s.BeginTime < t1).ToList(); if (available.Count != 0) { return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status406NotAcceptable)); } var routine = _context.Routine.Where(s => s.CourseCode == cc && s.Date == oDate).ToList(); if (routine.Count != 0 && routine[0].Semester == cr.Semester) { foreach (var sc in routine) { Routine r = new Routine(); r.CourseCode = cc; r.BeginTime = t0; r.EndTime = t1; r.Date = nDate; r.FkInstructorId = sc.FkInstructorId; r.Dayname = sc.Dayname; r.Semester = sc.Semester; _context.Routine.Add(r); _context.Routine.Remove(sc); _context.SaveChanges(); } return(Ok("Class Rescheduled")); } else { return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status406NotAcceptable)); } } else { return(Unauthorized("No CR With This Mail ID Found")); } }
public IActionResult SwapClass(string mail_id, string cc1, string d1, string cc2, string d2) { Cr cr = _context.Cr.FirstOrDefault(s => s.CrMailId == mail_id); if (cr != null) { DateTime class_one_date = Convert.ToDateTime(d1); DateTime class_two_date = Convert.ToDateTime(d2); var routine1 = _context.Routine.Where(s => s.CourseCode == cc1 && s.Date == class_one_date && s.Semester == cr.Semester).ToList(); var routine2 = _context.Routine.Where(s => s.CourseCode == cc2 && s.Date == class_two_date && s.Semester == cr.Semester).ToList(); if (routine1.Count != 0 && routine2.Count != 0 && routine1[0].Semester == routine2[0].Semester) { DateTime date = routine1[0].Date; string day = routine1[0].Dayname; TimeSpan t0 = routine1[0].BeginTime; TimeSpan t1 = routine1[0].EndTime; foreach (var sc in routine1) { sc.Date = routine2[0].Date; sc.BeginTime = routine2[0].BeginTime; sc.EndTime = routine2[0].EndTime; sc.Dayname = routine2[0].Dayname; } foreach (var sc in routine2) { sc.Date = date; sc.BeginTime = t0; sc.EndTime = t1; sc.Dayname = day; } _context.SaveChanges(); return(Ok("Classes Swapped")); } else { return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status406NotAcceptable)); } } else { return(Unauthorized("No CR With This Mail ID Found")); } }
private void frmNewClient_Load(object sender, EventArgs e) { this.clientsTableAdapter.Fill(this.remaxDatabaseDataSet.Clients); this.employeesTableAdapter.Fill(this.remaxDatabaseDataSet.Employees); picAgent.SizeMode = PictureBoxSizeMode.StretchImage; imgpath = @"..\..\Images\sorry.png"; refnumber = 0; if (clsGlobal.mode == "edit") { if (frm1.grdResult.SelectedRows.Count <= 0) { MetroMessageBox.Show(this, "You did not select any client to modify.\nThe form is being executed in the ADD mode.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning); clsGlobal.mode = "add"; return; } btnCreate.Text = "Confirm\nEdit"; String Abcd = frm1.grdResult.SelectedRows[0].Cells[2].Value.ToString(); foreach (DataRow Cr in remaxDatabaseDataSet.Clients.Rows) { if (Cr.Field <String>("Phone") == Abcd) { this.Text = "Editing the client: " + Cr["Name"].ToString(); txtName.Text = Cr["Name"].ToString(); txtPhone.Text = Cr["Phone"].ToString(); txtEmail.Text = Cr["Email"].ToString(); cmbGender.Text = Cr["Gender"].ToString(); txtComment.Text = Cr["Comment"].ToString(); imgpath = Cr["Picture"].ToString(); refnumber = Convert.ToInt32(Cr["refClient"].ToString()); refagent = Convert.ToInt32(Cr["refEmployee"].ToString()); txtAddress.Text = Cr["Address"].ToString(); txtPassword.Text = Cr["Password"].ToString(); cmbAgent.SelectedValue = Cr["refEmployee"].ToString(); if (imgpath.Length != 0 && (System.IO.File.Exists(@"..\..\Images\" + imgpath))) { picAgent.Image = System.Drawing.Image.FromFile(@"..\..\Images\" + imgpath); } else { picAgent.Image = System.Drawing.Image.FromFile(@"..\..\Images\sorry.png"); } } } } }
public async Task <IActionResult> ExtraClass(string mail_id, string cc, string date, string begin, string end, string day, string ic) { Cr cr = _context.Cr.FirstOrDefault(s => s.CrMailId == mail_id); if (cr != null) { DateTime nDate = Convert.ToDateTime(date); TimeSpan t0 = TimeSpan.Parse(begin); TimeSpan t1 = TimeSpan.Parse(end); var available = _context.Routine.FirstOrDefault(s => s.Date == nDate && s.EndTime > t0 && s.BeginTime < t1); var res = await GetCourse(mail_id) as OkObjectResult; HashSet <string> availableCourses = new HashSet <string>(); availableCourses = res.Value as HashSet <string>; bool courseAuth = false; foreach (var i in availableCourses) { if (i == cc) { courseAuth = true; break; } } if (available != null || !courseAuth) { return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status406NotAcceptable)); } Routine r = new Routine(); r.CourseCode = cc; r.BeginTime = t0; r.EndTime = t1; r.Date = nDate; r.FkInstructorId = ic; r.Dayname = day; r.Semester = cr.Semester; _context.Routine.Add(r); _context.SaveChanges(); return(Ok("Extra Class Added")); } else { return(Unauthorized("No CR With This Mail ID Found")); } }
/// <summary> /// Carga MenuEmergente con colores. /// OK - 12/04/14. /// </summary> private void loadCmsColor() { string sCr; foreach (Color Cr in new ColorConverter().GetStandardValues()) { sCr = Cr.ToString(); if (sCr.Contains("Color [")) { sCr = sCr.Remove(0, 7); //Remueve "Color [" sCr = sCr.Remove(sCr.LastIndexOf(']'), 1); //Remueve "]" } cmsColor.Items.Add(sCr); } }
private void rdAgents_CheckedChanged(object sender, EventArgs e) { if (rdAgents.Checked) { var Employees = from DataRow Cr in remaxDatabaseDataSet.Employees.Rows select new { ID = Cr.Field <Int32>("RefEmployee"), Name = Cr.Field <string>("Name"), Phone = Cr.Field <string>("Phone"), Email = Cr.Field <string>("Email"), Gender = Cr.Field <string>("Gender"), Position = Cr.Field <string>("Position"), Comment = Cr.Field <string>("Comment") }; grdResult.DataSource = Employees.ToList(); } }
/// <summary> /// Returns true if Solvency instances are equal /// </summary> /// <param name="other">Instance of Solvency to be compared</param> /// <returns>Boolean</returns> public bool Equals(Solvency other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Cr == other.Cr || Cr != null && Cr.Equals(other.Cr) ) && ( Qr == other.Qr || Qr != null && Qr.Equals(other.Qr) ) && ( Car == other.Car || Car != null && Car.Equals(other.Car) ) && ( Tlgr == other.Tlgr || Tlgr != null && Tlgr.Equals(other.Tlgr) ) && ( Dar == other.Dar || Dar != null && Dar.Equals(other.Dar) ) && ( Em == other.Em || Em != null && Em.Equals(other.Em) )); }
public void select() { if (clsGlobal.power != "Admin") { var Employees = from DataRow Cr in remaxDatabaseDataSet.Clients.Rows where Cr.Field <Int32>("refEmployee") == clsGlobal.loggedId select new { Name = Cr.Field <string>("Name"), Gender = Cr.Field <string>("Gender"), Phone = Cr.Field <string>("Phone"), Email = Cr.Field <string>("Email"), }; grdResult.DataSource = Employees.ToList(); } else { this.clientsTableAdapter.Fill(this.remaxDatabaseDataSet.Clients); this.employeesTableAdapter.Fill(this.remaxDatabaseDataSet.Employees); } }
private void rdHouses_CheckedChanged(object sender, EventArgs e) { if (rdHouses.Checked) { var Employees = from DataRow Cr in remaxDatabaseDataSet.Houses.Rows select new { ID = Cr.Field <Int32>("refHouse"), Bathrooms = Cr.Field <string>("Bathrooms"), Bedrooms = Cr.Field <string>("Bedrooms"), Rooms = Cr.Field <string>("NumberOfRooms"), Area = Cr.Field <string>("LivingArea"), Parking = Cr.Field <string>("ParkingSpot"), BuiltDate = Cr.Field <string>("BuiltDate"), Price = Cr.Field <string>("Price"), Address = Cr.Field <string>("Address"), Comment = Cr.Field <string>("Comments") }; grdResult.DataSource = Employees.ToList(); } }
private void frmClientInfo_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'remaxDatabaseDataSet1.Clients' table. You can move, or remove it, as needed. this.clientsTableAdapter.Fill(this.remaxDatabaseDataSet1.Clients); txtComment.Enabled = false; picAgent.SizeMode = PictureBoxSizeMode.StretchImage; this.employeeSkillsTableAdapter.Fill(this.remaxDatabaseDataSet1.EmployeeSkills); this.skillsTableAdapter.Fill(this.remaxDatabaseDataSet1.Skills); this.employeesTableAdapter1.Fill(this.remaxDatabaseDataSet1.Employees); this.clientsTableAdapter.Fill(this.remaxDatabaseDataSet1.Clients); Abcd = frm1.grdResult.SelectedRows[0].Cells[2].Value.ToString(); int refnumber = 0; foreach (DataRow Cr in remaxDatabaseDataSet1.Clients.Rows) { if (Cr.Field <String>("Phone") == Abcd) { txtName.Text = Cr["Name"].ToString(); txtPhone.Text = Cr["Phone"].ToString(); txtEmail.Text = Cr["Email"].ToString(); cmbGender.Text = Cr["Gender"].ToString(); txtComment.Text = Cr["Comment"].ToString(); refnumber = Convert.ToInt32(Cr["refEmployee"].ToString()); string imgpath = Cr["Picture"].ToString(); if (imgpath.Length != 0 && (System.IO.File.Exists(@"..\..\Images\" + imgpath))) { picAgent.Image = System.Drawing.Image.FromFile(@"..\..\Images\" + imgpath); } else { picAgent.Image = System.Drawing.Image.FromFile(@"..\..\Images\sorry.png"); } } } }
/// <summary> /// initialisiert und startet den crawlvorgang /// </summary> /// <param name="source">source website</param> private static void StartCrawling(string source) { //Init source Uri uri = null; Uri.TryCreate(source, UriKind.Absolute, out uri); //GetContent GetWebsiteContent content = new GetWebsiteContent(); string contentString = content.GetContent(uri); //Crawl Cr crawler = new Cr(); //Alle gefundenen Links HashSet<Uri> allLinks = crawler.ParseLinks(contentString, source); //Wenn keine a Elemente vorhanden sind wir gleich abgebrochen if(allLinks.Count == 0) { DBConnection.SetSourceAsCrawled(source); return; } List<HashSet<Uri>> returnedList = crawler.FilterLinks(allLinks); #region fill db if (returnedList != null) { //Links werden aufgeteilt HashSet<Uri> linkList = returnedList[0]; HashSet<Uri> imgList = returnedList[1]; //Befüllt die Datenbank crawler.FillDatabaseWithLinks(linkList, source); crawler.FillDatabaseWithImgs(imgList); } #endregion }
public void CleanChromosomes(ref Chromosome[] CGeral) { foreach (Chromosome Cr in CGeral) { Cr.RestartValues(); foreach (QueueService Qs in Cr.QueueList) { Qs.AwaitingTime = 0; Qs.CrossTime = 0; Qs.TimeInPort = 0; Qs.DelayTime = 0; Qs.ArrivalTime = GetQueueServiceIndexForQueueID(Qs.ID).ArrivalTime; Qs.DepartureTime = GetQueueServiceIndexForQueueID(Qs.ID).DepartureTime; Qs.FixedCost = 0; Qs.VariableCost = 0; Qs.Cost = 0; Qs.ReAllocatedTime = 0; Qs.ReAllocatedDock = 0; } } }
private void btnSearch_Click(object sender, EventArgs e) { if (rdAgents.Checked) { if (txtKeyword.Text != "") { var Employees = from DataRow Cr in remaxDatabaseDataSet.Employees.Rows where ( Convert.ToString(Cr.Field <Int32>("refEmployee")).Contains(txtKeyword.Text) || Cr.Field <string>("name").Contains(txtKeyword.Text) || Cr.Field <string>("phone").Contains(txtKeyword.Text) || Cr.Field <string>("gender").Contains(txtKeyword.Text) || Cr.Field <string>("email").Contains(txtKeyword.Text) || Cr.Field <string>("position").Contains(txtKeyword.Text) || Cr.Field <string>("comment").Contains(txtKeyword.Text) ) select new { ID = Cr.Field <Int32>("RefEmployee"), Name = Cr.Field <string>("Name"), Phone = Cr.Field <string>("Phone"), Email = Cr.Field <string>("Email"), Gender = Cr.Field <string>("Gender"), Position = Cr.Field <string>("Position"), Comment = Cr.Field <string>("Comment") }; grdResult.DataSource = Employees.ToList(); } else { var Employees = from DataRow Cr in remaxDatabaseDataSet.Employees.Rows select new { ID = Cr.Field <Int32>("RefEmployee"), Name = Cr.Field <string>("Name"), Phone = Cr.Field <string>("Phone"), Email = Cr.Field <string>("Email"), Gender = Cr.Field <string>("Gender"), Position = Cr.Field <string>("Position"), Comment = Cr.Field <string>("Comment") }; grdResult.DataSource = Employees.ToList(); } } else if (rdHouses.Checked) { if (txtKeyword.Text != "") { var Employees = from DataRow Cr in remaxDatabaseDataSet.Houses.Rows where ( Convert.ToString(Cr.Field <Int32>("refHouse")).Contains(txtKeyword.Text) || Cr.Field <string>("Bathrooms").Contains(txtKeyword.Text) || Cr.Field <string>("Bedrooms").Contains(txtKeyword.Text) || Cr.Field <string>("NumberOfRooms").Contains(txtKeyword.Text) || Cr.Field <string>("LivingArea").Contains(txtKeyword.Text) || Cr.Field <string>("ParkingSpot").Contains(txtKeyword.Text) || Cr.Field <string>("BuiltDate").Contains(txtKeyword.Text) || Cr.Field <string>("Price").Contains(txtKeyword.Text) || Cr.Field <string>("Address").Contains(txtKeyword.Text) || Cr.Field <string>("Comments").Contains(txtKeyword.Text) ) select new { ID = Cr.Field <Int32>("refHouse"), Bathrooms = Cr.Field <string>("Bathrooms"), Bedrooms = Cr.Field <string>("Bedrooms"), Rooms = Cr.Field <string>("NumberOfRooms"), Area = Cr.Field <string>("LivingArea"), Parking = Cr.Field <string>("ParkingSpot"), BuiltDate = Cr.Field <string>("BuiltDate"), Price = Cr.Field <string>("Price"), Address = Cr.Field <string>("Address"), Comment = Cr.Field <string>("Comments") }; grdResult.DataSource = Employees.ToList(); } else { var Employees = from DataRow Cr in remaxDatabaseDataSet.Houses.Rows select new { ID = Cr.Field <Int32>("refHouse"), Bathrooms = Cr.Field <string>("Bathrooms"), Bedrooms = Cr.Field <string>("Bedrooms"), Rooms = Cr.Field <string>("NumberOfRooms"), Area = Cr.Field <string>("LivingArea"), Parking = Cr.Field <string>("ParkingSpot"), BuiltDate = Cr.Field <string>("BuiltDate"), Price = Cr.Field <string>("Price"), Address = Cr.Field <string>("Address"), Comment = Cr.Field <string>("Comments") }; grdResult.DataSource = Employees.ToList(); } } else { MetroMessageBox.Show(this, "Please select either Houses or Agents to search from."); } }
public void FitnessFunctionForAllCromosomes(ref Chromosome[] CGeral) { foreach (Chromosome Cr in CGeral) { Cr.RestartValues(); _ShipMovements = 0; _AwaitingTime = 0; _CrossTime = 0; _TimeInPort = 0; //_ExtraTime = 0; foreach (QueueService Qs in Cr.QueueList) { _ShipMovements = Qs.MOV; _AwaitingTime = Qs.AwaitingTime; _CrossTime = Qs.CrossTime; _TimeInPort = Qs.TimeInPort; //_ExtraTime = Qs.ExtraTime; _ShipFitness = (Convert.ToDouble(Qs.MOV) / ((Convert.ToDouble(Qs.TimeInPort + Qs.DelayTime)) + Qs.Cost)); Qs.Fitness = _ShipFitness; Cr.VesselsQty++; Cr.Units += Qs.Units; Cr.Movements += Qs.MOV; Cr.AwaitingTime += Qs.AwaitingTime; Cr.TimeInPort += Qs.AwaitingTime; //Cr.ExtraTime += Qs.ExtraTime; Cr.CrossTime += Qs.CrossTime; Cr.DelayTime += Qs.DelayTime; Cr.ShipsCost += Qs.Cost; Cr.FixedCost += Qs.FixedCost; Cr.VariableCost += Qs.VariableCost; Cr.PortCost = Cr.Movements / Cr.VesselsQty; Cr.FitnessShips += Qs.Fitness; //Console.WriteLine(Cr.FitnessShips); } Cr.Units += Cr.Units; Cr.Movements += Cr.Movements; Cr.AwaitingTime += Cr.AwaitingTime; Cr.TimeInPort += Cr.TimeInPort; //Cr.ExtraTime = Cr.ExtraTime / Cr.VesselsQty; Cr.CrossTime += Cr.CrossTime; Cr.DelayTime += Cr.DelayTime; Cr.ShipsCost += Cr.ShipsCost; Cr.FixedCost += Cr.FixedCost; Cr.VariableCost += Cr.VariableCost; GetLastDepartureOFChromosome(Cr, ref _LastDeparture); GetFirtsArrivalOFChromosome(Cr, ref _FirstArrival); Cr.TotalPortTime = Convert.ToInt64((_LastDeparture - _FirstArrival).TotalHours); //QueueService: public int TimeInPort; //AwaitingTime + CrossTime + WorkTime //Chromosome: public long TotalPortTime; //Difference between LastArrivalTime - FirstArrivalTime Cr.FitnessPorts = (Cr.PortCost) / ((Cr.VesselsQty + Cr.Movements) * Cr.TotalPortTime); //Cr.Fitness = Cr.FitnessShips*Cr.FitnessPorts; } }
public override int GetHashCode() { int hash = 1; if (Ts != 0D) { hash ^= Ts.GetHashCode(); } if (PreviewWindow != 0) { hash ^= PreviewWindow.GetHashCode(); } if (Cf != 0D) { hash ^= Cf.GetHashCode(); } if (Cr != 0D) { hash ^= Cr.GetHashCode(); } if (MassFl != 0) { hash ^= MassFl.GetHashCode(); } if (MassFr != 0) { hash ^= MassFr.GetHashCode(); } if (MassRl != 0) { hash ^= MassRl.GetHashCode(); } if (MassRr != 0) { hash ^= MassRr.GetHashCode(); } if (Eps != 0D) { hash ^= Eps.GetHashCode(); } hash ^= matrixQ_.GetHashCode(); hash ^= reverseMatrixQ_.GetHashCode(); if (CutoffFreq != 0) { hash ^= CutoffFreq.GetHashCode(); } if (MeanFilterWindowSize != 0) { hash ^= MeanFilterWindowSize.GetHashCode(); } if (MaxIteration != 0) { hash ^= MaxIteration.GetHashCode(); } if (MaxLateralAcceleration != 0D) { hash ^= MaxLateralAcceleration.GetHashCode(); } if (latErrGainScheduler_ != null) { hash ^= LatErrGainScheduler.GetHashCode(); } if (headingErrGainScheduler_ != null) { hash ^= HeadingErrGainScheduler.GetHashCode(); } return(hash); }
private void frmHousesInfo_Load(object sender, EventArgs e) { this.housesPicturesTableAdapter.Fill(this.remaxDatabaseDataSet.HousesPictures); this.featuresTableAdapter.Fill(this.remaxDatabaseDataSet.Features); this.houseTypeTableAdapter.Fill(this.remaxDatabaseDataSet.HouseType); this.listingTableAdapter.Fill(this.remaxDatabaseDataSet.Listing); this.clientsTableAdapter.Fill(this.remaxDatabaseDataSet.Clients); this.employeesTableAdapter.Fill(this.remaxDatabaseDataSet.Employees); this.housesFeaturesTableAdapter.Fill(this.remaxDatabaseDataSet.HousesFeatures); this.picturesTableAdapter.Fill(this.remaxDatabaseDataSet.Pictures); this.housesTableAdapter.Fill(this.remaxDatabaseDataSet.Houses); if (Application.OpenForms.OfType <frmAdmHouses>().Count() == 1) { Abcd = frm1.grdResult.SelectedRows[0].Cells[8].Value.ToString(); } if (Application.OpenForms.OfType <frmSearch>().Count() == 1) { Abcd = frm2.grdResult.SelectedRows[0].Cells[8].Value.ToString(); } foreach (DataRow Cr in remaxDatabaseDataSet.Houses.Rows) { if (Cr.Field <String>("Address") == Abcd) { refHouse = Convert.ToInt32(Cr["refHouse"].ToString()); this.Text = "Info on house: " + Cr["Address"].ToString(); cmbListing.SelectedValue = Cr["refListing"].ToString(); cmbType.SelectedValue = Cr["refType"].ToString(); cmbClient.SelectedValue = Cr["refClient"].ToString(); cmbEmployee.SelectedValue = Cr["refEmployee"].ToString(); cmbBathroom.Text = Cr["Bathrooms"].ToString(); cmbTotalRoom.Text = Cr["NumberOfRooms"].ToString(); txtLivingArea.Text = Cr["LivingArea"].ToString(); cmbParkingSpot.Text = Cr["ParkingSpot"].ToString(); cmbDate.Text = Cr["BuiltDate"].ToString(); txtAddress.Text = Cr["Address"].ToString(); cmbBedroom.Text = Cr["Bedrooms"].ToString(); txtComment.Text = Cr["Comments"].ToString(); txtPrice.Text = Cr["Price"].ToString(); } } foreach (DataRow ab in remaxDatabaseDataSet.HousesFeatures.Rows) { if (ab.Field <Int32>("refHouse") == refHouse) { foreach (DataRow cd in remaxDatabaseDataSet.Features.Rows) { if (ab.Field <Int32>("refFeature") == cd.Field <Int32>("refFeature")) { string[] row = { ab.Field <Int32>("refFeature").ToString(), cd.Field <String>("FeatureName") }; var listViewItem = new ListViewItem(row); listSkills.Items.Add(listViewItem); } } } } foreach (DataRow ab in remaxDatabaseDataSet.HousesPictures.Rows) { if (ab.Field <Int32>("refHouse") == refHouse) { foreach (DataRow cd in remaxDatabaseDataSet.Pictures.Rows) { if (ab.Field <Int32>("refPicture") == cd.Field <Int32>("refPicture")) { string[] row = { cd.Field <String>("PicturePath").ToString(), cd.Field <String>("PictureComment") }; var listViewItem = new ListViewItem(row); listPic.Items.Add(listViewItem); } } } } }
public Bitmap[] load(Stream stream) { BinaryReader binaryReader = new BinaryReader(stream); if (binaryReader.ReadChar() != id) { // } width = binaryReader.ReadInt32(); height = binaryReader.ReadInt32(); //intra frame int count = binaryReader.ReadInt32(); YEncode = new List <byte>(binaryReader.ReadBytes(count)); count = binaryReader.ReadInt32(); CbEncode = new List <byte>(binaryReader.ReadBytes(count)); count = binaryReader.ReadInt32(); CrEncode = new List <byte>(binaryReader.ReadBytes(count)); //inter frame count = binaryReader.ReadInt32(); YEncodeInter = new List <byte>(binaryReader.ReadBytes(count)); count = binaryReader.ReadInt32(); CbEncodeInter = new List <byte>(binaryReader.ReadBytes(count)); count = binaryReader.ReadInt32(); CrEncodeInter = new List <byte>(binaryReader.ReadBytes(count)); //motion vector int x = binaryReader.ReadInt32(); int y = binaryReader.ReadInt32(); YMoVec = new Point[x, y]; for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { YMoVec[i, j].X = binaryReader.ReadSByte(); YMoVec[i, j].Y = binaryReader.ReadSByte(); } } x = binaryReader.ReadInt32(); y = binaryReader.ReadInt32(); CbMoVec = new Point[x, y]; for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { CbMoVec[i, j].X = binaryReader.ReadSByte(); CbMoVec[i, j].Y = binaryReader.ReadSByte(); } } x = binaryReader.ReadInt32(); y = binaryReader.ReadInt32(); CrMoVec = new Point[x, y]; for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { CrMoVec[i, j].X = binaryReader.ReadSByte(); CrMoVec[i, j].Y = binaryReader.ReadSByte(); } } Bitmap[] ret = new Bitmap[2]; ret[0] = new Bitmap(width, height); ret[1] = new Bitmap(width, height); //decode intra frame YQuant = decoding(YEncode, width, height); CbQuant = decoding(CbEncode, width / 2, height / 2); CrQuant = decoding(CrEncode, width / 2, height / 2); YDCT = invQuantization(YQuant); CbDCT = invQuantization(CbQuant); CrDCT = invQuantization(CrQuant); Y = inverseDCT(YDCT, width, height); Cb = inverseDCT(CbDCT, Cb.GetLength(0), Cb.GetLength(1)); Cr = inverseDCT(CrDCT, Cr.GetLength(0), Cr.GetLength(1)); unsubSampling(ref Cb, ref Cr); YCbCrtoRGB(ret[0], Y, Cb, Cr); //decode inter frame subSampling(ref Cb, ref Cr); YQuantInter = decoding(YEncodeInter, width, height); CbQuantInter = decoding(CbEncodeInter, width / 2, height / 2); CrQuantInter = decoding(CrEncodeInter, width / 2, height / 2); YDCTInter = invQuantization(YQuantInter); CbDCTInter = invQuantization(CbQuantInter); CrDCTInter = invQuantization(CrQuantInter); YDif = inverseDCTInter(YDCTInter, width, height); CbDif = inverseDCTInter(CbDCTInter, CbInter.GetLength(0), CbInter.GetLength(1)); CrDif = inverseDCTInter(CrDCTInter, CrInter.GetLength(0), CrInter.GetLength(1)); YInter = unCalcDifference(Y, YMoVec, YDif); CbInter = unCalcDifference(Cb, CbMoVec, CbDif); CrInter = unCalcDifference(Cr, CrMoVec, CrDif); unsubSampling(ref CbInter, ref CrInter); YCbCrtoRGB(ret[1], YInter, CbInter, CrInter); return(ret); }
public override int GetHashCode() { int hash = 1; if (Ts != 0D) { hash ^= Ts.GetHashCode(); } if (Cf != 0D) { hash ^= Cf.GetHashCode(); } if (Cr != 0D) { hash ^= Cr.GetHashCode(); } if (MassFl != 0) { hash ^= MassFl.GetHashCode(); } if (MassFr != 0) { hash ^= MassFr.GetHashCode(); } if (MassRl != 0) { hash ^= MassRl.GetHashCode(); } if (MassRr != 0) { hash ^= MassRr.GetHashCode(); } if (Eps != 0D) { hash ^= Eps.GetHashCode(); } hash ^= matrixQ_.GetHashCode(); hash ^= matrixR_.GetHashCode(); if (CutoffFreq != 0) { hash ^= CutoffFreq.GetHashCode(); } if (MeanFilterWindowSize != 0) { hash ^= MeanFilterWindowSize.GetHashCode(); } if (MaxIteration != 0) { hash ^= MaxIteration.GetHashCode(); } if (MaxLateralAcceleration != 0D) { hash ^= MaxLateralAcceleration.GetHashCode(); } if (StandstillAcceleration != 0D) { hash ^= StandstillAcceleration.GetHashCode(); } if (ThrottleDeadzone != 0D) { hash ^= ThrottleDeadzone.GetHashCode(); } if (BrakeDeadzone != 0D) { hash ^= BrakeDeadzone.GetHashCode(); } if (latErrGainScheduler_ != null) { hash ^= LatErrGainScheduler.GetHashCode(); } if (headingErrGainScheduler_ != null) { hash ^= HeadingErrGainScheduler.GetHashCode(); } if (steerWeightGainScheduler_ != null) { hash ^= SteerWeightGainScheduler.GetHashCode(); } if (feedforwardtermGainScheduler_ != null) { hash ^= FeedforwardtermGainScheduler.GetHashCode(); } if (calibrationTable_ != null) { hash ^= CalibrationTable.GetHashCode(); } return(hash); }
private void frmNewAgent_Load(object sender, EventArgs e) { picAgent.SizeMode = PictureBoxSizeMode.StretchImage; this.skillsTableAdapter.Fill(this.remaxDatabaseDataSet.Skills); this.employeeSkillsTableAdapter.Fill(this.remaxDatabaseDataSet.EmployeeSkills); this.employeesTableAdapter.Fill(this.remaxDatabaseDataSet.Employees); imgpath = @"..\..\Images\sorry.png"; refnumber = 0; if (clsGlobal.mode == "edit") { if (frm1.grdResult.SelectedRows.Count <= 0) { MetroMessageBox.Show(this, "You did not select any agent to modify.\nThe form is being executed in the ADD mode.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning); clsGlobal.mode = "add"; return; } String Abcd = frm1.grdResult.SelectedRows[0].Cells[3].Value.ToString(); foreach (DataRow Cr in remaxDatabaseDataSet.Employees.Rows) { if (Cr.Field <String>("Phone") == Abcd) { this.Text = "Editing the agent: " + Cr["Name"].ToString(); btnCreate.Text = "Confirm\nEdit"; txtName.Text = Cr["Name"].ToString(); txtPhone.Text = Cr["Phone"].ToString(); txtEmail.Text = Cr["Email"].ToString(); cmbGender.Text = Cr["Gender"].ToString(); cmbPosition.Text = Cr["Position"].ToString(); txtComment.Text = Cr["Comment"].ToString(); imgpath = Cr["Picture"].ToString(); refnumber = Convert.ToInt32(Cr["refEmployee"].ToString()); txtAddress.Text = Cr["Address"].ToString(); txtPassword.Text = Cr["Password"].ToString(); if (imgpath.Length != 0 && (System.IO.File.Exists(@"..\..\Images\" + imgpath))) { picAgent.Image = System.Drawing.Image.FromFile(@"..\..\Images\" + imgpath); } else { picAgent.Image = System.Drawing.Image.FromFile(@"..\..\Images\sorry.png"); } } } } foreach (DataRow ab in remaxDatabaseDataSet.EmployeeSkills.Rows) { if (ab.Field <Int32>("refEmployee") == refnumber) { foreach (DataRow cd in remaxDatabaseDataSet.Skills.Rows) { if (ab.Field <Int32>("refSkill") == cd.Field <Int32>("refSkill")) { string[] row = { ab.Field <Int32>("refSkill").ToString(), cd.Field <String>("SkillName") }; var listViewItem = new ListViewItem(row); listSkills.Items.Add(listViewItem); } } } } }
private void frmHouseAddEdit_Load(object sender, EventArgs e) { this.housesPicturesTableAdapter.Fill(this.remaxDatabaseDataSet.HousesPictures); this.featuresTableAdapter.Fill(this.remaxDatabaseDataSet.Features); this.houseTypeTableAdapter.Fill(this.remaxDatabaseDataSet.HouseType); this.listingTableAdapter.Fill(this.remaxDatabaseDataSet.Listing); this.clientsTableAdapter.Fill(this.remaxDatabaseDataSet.Clients); this.employeesTableAdapter.Fill(this.remaxDatabaseDataSet.Employees); this.housesFeaturesTableAdapter.Fill(this.remaxDatabaseDataSet.HousesFeatures); this.picturesTableAdapter.Fill(this.remaxDatabaseDataSet.Pictures); this.housesTableAdapter.Fill(this.remaxDatabaseDataSet.Houses); if (clsGlobal.mode == "edit") { if (frm1.grdResult.SelectedRows.Count <= 0) { MetroMessageBox.Show(this, "You did not select any house to modify.\nThe form is being executed in the ADD mode.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning); clsGlobal.mode = "add"; return; } Abcd = frm1.grdResult.SelectedRows[0].Cells[8].Value.ToString(); foreach (DataRow Cr in remaxDatabaseDataSet.Houses.Rows) { if (Cr.Field <String>("Address") == Abcd) { refHouse = Convert.ToInt32(Cr["refHouse"].ToString()); refEmployee = Convert.ToInt32(Cr["refEmployee"].ToString()); refListing = Convert.ToInt32(Cr["refListing"].ToString()); refType = Convert.ToInt32(Cr["refType"].ToString()); refClient = Convert.ToInt32(Cr["refClient"].ToString()); this.Text = "Editing the house: " + Cr["Address"].ToString(); btnCreate.Text = "Confirm\nEdit"; cmbEmployee.SelectedValue = Cr["refEmployee"].ToString(); cmbListing.SelectedValue = Cr["refListing"].ToString(); cmbType.SelectedValue = Cr["refType"].ToString(); cmbClient.SelectedValue = Cr["refClient"].ToString(); cmbBathroom.Text = Cr["Bathrooms"].ToString(); cmbTotalRoom.Text = Cr["NumberOfRooms"].ToString(); txtLivingArea.Text = Cr["LivingArea"].ToString(); cmbParkingSpot.Text = Cr["ParkingSpot"].ToString(); cmbDate.Text = Cr["BuiltDate"].ToString(); txtAddress.Text = Cr["Address"].ToString(); cmbBedroom.Text = Cr["Bedrooms"].ToString(); txtComment.Text = Cr["Comments"].ToString(); txtPrice.Text = Cr["Price"].ToString(); } } foreach (DataRow ab in remaxDatabaseDataSet.HousesFeatures.Rows) { if (ab.Field <Int32>("refHouse") == refHouse) { foreach (DataRow cd in remaxDatabaseDataSet.Features.Rows) { if (ab.Field <Int32>("refFeature") == cd.Field <Int32>("refFeature")) { string[] row = { ab.Field <Int32>("refFeature").ToString(), cd.Field <String>("FeatureName") }; var listViewItem = new ListViewItem(row); listSkills.Items.Add(listViewItem); } } } } foreach (DataRow ab in remaxDatabaseDataSet.HousesPictures.Rows) { if (ab.Field <Int32>("refHouse") == refHouse) { foreach (DataRow cd in remaxDatabaseDataSet.Pictures.Rows) { if (ab.Field <Int32>("refPicture") == cd.Field <Int32>("refPicture")) { string[] row = { cd.Field <String>("PicturePath").ToString(), cd.Field <String>("PictureComment") }; var listViewItem = new ListViewItem(row); listPic.Items.Add(listViewItem); } } } } } }