} = null; // holds persistant instance private LabList() { Lab lab = new Lab() { id = 101, number = 1, target = "This lab focuses on setting up programming environments for the labs and projects.", topic = "Programming Environments", due = new DateTime(2019, 2, 1) }; Labs.Add(lab); lab = new Lab() { id = 102, number = 2, target = "This lab focuses on building static web pages, using HTML5, CSS3, and EC6 (latest version of JavaScript)." + " You will use all three to define a theme for your web pages.", topic = "Static Web Pages", due = new DateTime(2019, 2, 8) }; Labs.Add(lab); lab = new Lab() { id = 103, number = 3, target = "This lab focuses on the use of Cascading Style Sheets (CSS) to build a useful component for your web pages.", topic = "CSS Styling Lab", due = new DateTime(2019, 2, 15) }; Labs.Add(lab); }
public ActionResult CreateLabProject(Labs laboratory) { var listProjectType = proType.ListProjectTypes(); ViewBag.listProjectTypeDll = new SelectList(listProjectType, "Project_type_id", "Project_type_name"); var listPhaseTypes = phaseType.ListPhaseTypes(); ViewBag.listPhaseTypesDll = new SelectList(listPhaseTypes, "Phase_id", "Phase_name"); var listSpeedConnectionsTypes = speedType.ListSpeedConnectionTypes(); ViewBag.listSpeedConnectionsTypesDll = new SelectList(listSpeedConnectionsTypes, "Speed_connection_id", "Speed_connection_name"); var listLabScopes = labScop.ListLabScopes(); ViewBag.listLabScopesDll = new SelectList(listLabScopes, "Lab_scope_id", "Lab_scope_name"); if (laboratory.Lab_requestor_id != null) { //Changes the lab project null to 2=Laboratory laboratory.Project_type = 2; try { if (!ModelState.IsValid) { return(View()); } var labToAdd = Mapper.Map <DATA.Labs>(laboratory); lab.AddLabs(labToAdd); int x = (Int32)Session["UserType"]; switch (x) { case 1: return(RedirectToAction("PmProjects", "User")); case 2: return(RedirectToAction("UserMyProjects", "User")); case 3: return(RedirectToAction("Index", "Lab")); case 4: return(RedirectToAction("Index", "Lab")); default: return(RedirectToAction("Index", "Home")); } } catch (Exception ex) { throw ex; } } else { return(View()); } }
public ScheduleProtectionLabsDataViewModel(Labs lab, int subGroupId) { SuGroupId = subGroupId; LabId = lab.Id; Order = lab.Order; Name = lab.Theme; }
public List <Labs> verLabs() { listLabs = new List <Labs>(); #region Contar e visualizar os computadores using (SqlConnection conexao = new SqlConnection(linkserver)) { conexao.Open(); using (SqlCommand cmd = new SqlCommand("SELECT * FROM PEEK_LAB", conexao)) { using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Labs codigo = new Labs(); codigo.IDLab1 = reader.GetInt32(0); codigo.Nome = Convert.ToString(reader[1]); codigo.Andar = Convert.ToString(reader[3]); codigo.Capacity = Convert.ToString(reader[2]); listLabs.Add(codigo); } return(listLabs); } } } #endregion }
public ActionResult EditLabProject(Labs labs) { try { if (!ModelState.IsValid) { return(View()); } int userType = (Int32)Session["UserType"]; var updateLabProject = Mapper.Map <DATA.Labs>(labs); lab.UpdateLabProject(updateLabProject); int x = (Int32)Session["UserType"]; switch (x) { case 1: return(RedirectToAction("PmProjects", "User")); case 2: return(RedirectToAction("UserMyProjects", "User")); case 3: return(RedirectToAction("Index", "Lab")); case 4: return(RedirectToAction("Index", "Lab")); default: return(RedirectToAction("Index", "Home")); } } catch { return(View()); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address,Phones")] Labs labs) { if (id != labs.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(labs); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LabsExists(labs.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(labs)); }
public async Task<IActionResult> AddLabAsync(Labs labs, IFormFile PicturePath) { labs.AddUserID = (int)HttpContext.Session.GetInt32("User_ID"); labs.AdditionDate = DateTime.Now; // * resim yolu if (PicturePath != null) { string imageExtension = Path.GetExtension(PicturePath.FileName); string imageName = Guid.NewGuid() + imageExtension; string path = Path.Combine($"wwwroot/img/Labs/{imageName}"); using var stream = new FileStream(path, FileMode.Create); await PicturePath.CopyToAsync(stream); labs.PicturePath = path; labs.PicturePath = labs.PicturePath.Substring(labs.PicturePath.IndexOf("wwwroot")).Replace("wwwroot", string.Empty); } db.Labs.Add(labs); db.SaveChanges(); return RedirectToAction("Labs"); }
private void SetFont(Labs.Controls.ExtendedEntry view) { UIFont uiFont; if (view.Font != Font.Default && (uiFont = view.Font.ToUIFont()) != null) Control.Font = uiFont; else if (view.Font == Font.Default) Control.Font = UIFont.SystemFontOfSize(17f); }
public bool delete(int id) { if (0 <= id && id < size()) { Labs.RemoveAt(id); return(true); } return(false); }
private static void SetText(Labs.Controls.IconButton iconButton, UIButton targetButton) { var renderedIcon = iconButton.Icon; // if no IconFontName is provided on the IconButton, default to FontAwesome var iconFontName = string.IsNullOrEmpty(iconButton.IconFontName) ? "fontawesome" : iconButton.IconFontName; var iconSize = iconButton.IconSize == default(float) ? 17f : iconButton.IconSize; var faFont = UIFont.FromName(iconFontName, iconSize); // set the icon to either be on the left or right of the button's text string combinedText = iconButton.Orientation == ImageOrientation.ImageToLeft ? string.Format("{0} {1}", renderedIcon, iconButton.Text) : string.Format("{0} {1}", iconButton.Text, renderedIcon); // string attributes for the icon var iconAttributes = new UIStringAttributes { ForegroundColor = iconButton.IconColor.ToUIColor(), BackgroundColor = targetButton.BackgroundColor, Font = faFont, TextAttachment = new NSTextAttachment() }; // string attributes for the button's text. // TODO: Calculate an appropriate BaselineOffset for the main button text in order to center it vertically relative to the icon var btnAttributes = new UIStringAttributes { BackgroundColor = iconButton.BackgroundColor.ToUIColor(), ForegroundColor = iconButton.TextColor.ToUIColor(), Font = GetButtonFont(iconButton,targetButton) }; // Give the overall string the attributes of the button's text var prettyString = new NSMutableAttributedString(combinedText,btnAttributes); // Set the font for only the icon (1 char) prettyString.SetAttributes(iconAttributes.Dictionary, iconButton.Orientation == ImageOrientation.ImageToLeft ? new NSRange(0, 1) : new NSRange(prettyString.Length - 1, 1)); // set the final formatted string as the button's text targetButton.SetAttributedTitle(prettyString, UIControlState.Normal); // center the button's contents targetButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; targetButton.TitleLabel.TextAlignment = UITextAlignment.Center; }
public void DeleteLaboratoryProject(Labs laboratory) { try { unitOfWork.Repository <Labs>().Delete(laboratory); } catch (Exception ex) { throw ex; } }
public LabsDataViewModel(Labs labs) { Theme = labs.Theme; LabsId = labs.Id; Duration = labs.Duration; SubjectId = labs.SubjectId; Order = labs.Order; PathFile = labs.Attachments; ShortName = labs.ShortName; Attachments = FilesManagementService.GetAttachments(labs.Attachments); }
public void AddLabs(Labs lab) { try { _db.Insert(lab); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Create([Bind("Id,Name,Address")] Labs lab) { if (ModelState.IsValid) { _context.Add(lab); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(lab)); }
public static Lab getLab(Labs lab) { switch (lab) { case Labs.Eluler: return(new Lab6.Euler(1, 0, 0.9, 0.05, "2*[x]*[y]*[y]")); case Labs.Milne: return(new Lab7.Milne(0, 5, 1, "[y]+3*[x]-Pow([x],2)")); default: throw new Exception("Not implemented"); } }
public static void Main() { Labs lab = new Labs(); Console.WriteLine("Select task of Labs:"); Console.WriteLine("1. CountOdd:"); Console.WriteLine("2. OddNumber:"); Console.WriteLine("3. Synonyms:"); Console.WriteLine("4. Largest3:"); Console.WriteLine("5. WordFilter:"); int switch_on = int.Parse(Console.ReadLine()); switch (switch_on) { case 1: { lab.CountOdd(); break; } case 2: { lab.OddNumber(); break; } case 3: { lab.Synonyms(); break; } case 4: { lab.Largest3(); break; } case 5: { lab.WordFilter(); break; } default: Console.WriteLine("Exit:"); break; } }
public ActionResult Edit(Labs l) { int id = Convert.ToInt32(Request["id"]); if ((id > 0) && (l != null) && (ModelState.IsValid)) { daolabs.UpdateLabs(l); return(RedirectToAction("ProffIndex", "DAOPattern")); } else { return(View("Edit")); } }
//удаление оценок за лабораторные по идентификатору public bool DeleteLabs(int id) { try { Labs lb = GetLabs(id); entities.Labs.Remove(lb); entities.SaveChanges(); } catch { return(false); } return(true); }
private void SetTextAlignment(Labs.Controls.ExtendedEntry view) { switch (view.XAlign) { case TextAlignment.Center: Control.TextAlignment = UITextAlignment.Center; break; case TextAlignment.End: Control.TextAlignment = UITextAlignment.Right; break; case TextAlignment.Start: Control.TextAlignment = UITextAlignment.Left; break; } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address")] Labs lab) { if (id != lab.Id) { return(NotFound()); } if (ModelState.IsValid) { _context.Update(lab); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(lab)); }
public ActionResult AssignLabProject(Labs labs) { try { if (!ModelState.IsValid) { return(View()); } var updateLabProject = Mapper.Map <DATA.Labs>(labs); lab.UpdateLabProject(updateLabProject); return(RedirectToAction("Index", "Home")); } catch { return(View()); } }
public Labs SaveLabs(Labs labs, IList <Attachment> attachments, int userId) { using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { if (!string.IsNullOrEmpty(labs.Attachments)) { var deleteFiles = repositoriesContainer.AttachmentRepository.GetAll( new Query <Attachment>(e => e.PathName == labs.Attachments)).ToList() .Where(e => attachments.All(x => x.Id != e.Id)).ToList(); foreach (var attachment in deleteFiles) { FilesManagementService.DeleteFileAttachment(attachment); } } else { labs.Attachments = GetGuidFileName(); } FilesManagementService.SaveFiles(attachments.Where(e => e.Id == 0), labs.Attachments); foreach (var attachment in attachments) { if (attachment.Id == 0) { attachment.PathName = labs.Attachments; repositoriesContainer.AttachmentRepository.Save(attachment); } } repositoriesContainer.LabsRepository.Save(labs); repositoriesContainer.ApplyChanges(); if (labs.IsNew && labs.Subject.SubjectModules.All(m => m.Module.ModuleType != ModuleType.Practical) && labs.Subject.SubjectModules.Any(m => m.Module.ModuleType == ModuleType.Labs)) { ConceptManagementService.AttachFolderToLabSection(labs.Theme, userId, labs.SubjectId); } } return(labs); }
public static List <Labs> GetLab(string prefixText, int count) { List <Labs> items = new List <Labs>(); ILabFunctions LabTestsMgrDate; LabTestsMgrDate = (ILabFunctions)ObjectFactory.CreateInstance("BusinessProcess.Laboratory.BLabFunctions, BusinessProcess.Laboratory"); string sqlQuery; //creating Sql Query //sqlQuery = "select l.LabTestID,l.LabName,l.LabDepartmentID,d.labdepartmentname from mst_labtest l"; //sqlQuery += " inner join mst_labdepartment d on l.LabDepartmentID=d.LabDepartmentID where labname like '%" + prefixText + "%' group by l.labtestid,l.labname,l.LabDepartmentID,d.labdepartmentname"; sqlQuery = "select a.SubTestId[LabTestID], a.SubTestName[LabName], b.LabDepartmentID, c.labdepartmentname"; sqlQuery += " from lnk_testparameter a inner join mst_labtest b on a.TestId=b.LabTestId"; sqlQuery += " inner join mst_labdepartment c on c.LabDepartmentId=b.LabDepartmentID"; sqlQuery += " where a.SubTestName like '%" + prefixText + "%' group by a.SubTestId, a.SubTestName, b.LabDepartmentID, c.labdepartmentname"; //filling data from database dtLabResult = (DataTable)LabTestsMgrDate.ReturnLabQuery(sqlQuery); if (dtLabResult.Rows.Count > 0) { foreach (DataRow row in dtLabResult.Rows) { try { Labs item = new Labs(); item.SubTestId = (int)row["LabTestID"]; item.SubTestName = (string)row["LabName"]; item.LabDepartmentId = (int)row["LabDepartmentID"]; item.LabDepartmentName = (string)row["labdepartmentname"]; items.Add(item); } catch (Exception ex) { } } } return(items); }
public ActionResult CreateLabProject(Labs laboratory) { var listProjectType = proType.ListProjectTypes(); ViewBag.listProjectTypeDll = new SelectList(listProjectType, "Project_type_id", "Project_type_name"); var listPhaseTypes = phaseType.ListPhaseTypes(); ViewBag.listPhaseTypesDll = new SelectList(listPhaseTypes, "Phase_id", "Phase_name"); var listSpeedConnectionsTypes = speedType.ListSpeedConnectionTypes(); ViewBag.listSpeedConnectionsTypesDll = new SelectList(listSpeedConnectionsTypes, "Speed_connection_id", "Speed_connection_name"); var listLabScopes = labScop.ListLabScopes(); ViewBag.listLabScopesDll = new SelectList(listLabScopes, "Lab_scope_id", "Lab_scope_name"); if (laboratory.Lab_requestor_id != null) { //Changes the lab project null to 2=Laboratory laboratory.Project_type = 2; try { if (!ModelState.IsValid) { return(View()); } var labToAdd = Mapper.Map <DATA.Labs>(laboratory); lab.AddLabs(labToAdd); return(RedirectToAction("CreateLabProject")); } catch (Exception ex) { throw ex; } } else { return(View()); } }
//изменение информации оценок за лабораторные public bool UpdateLabs(Labs labs) { try { var Entity = entities.Labs.FirstOrDefault(x => x.Id == labs.Id); Entity.FirstLab = labs.FirstLab; Entity.SecondLab = labs.SecondLab; Entity.ThirdLab = labs.ThirdLab; Entity.FourthLab = labs.FourthLab; Entity.FifthLab = labs.FifthLab; entities.SaveChanges(); } catch { return(false); } return(true); }
/// <summary> /// Sets the image source. /// </summary> /// <param name="targetButton">The target button.</param> /// <param name="model">The model.</param> /// <returns>A <see cref="Task"/> for the awaited operation.</returns> private async Task SetImageSourceAsync(Android.Widget.Button targetButton, Labs.Controls.ImageButton model) { const int Padding = 10; var source = model.Source; using (var bitmap = await this.GetBitmapAsync(source)) { if (bitmap != null) { Drawable drawable = new BitmapDrawable(bitmap); var scaledDrawable = GetScaleDrawable(drawable, GetWidth(model.ImageWidthRequest), GetHeight(model.ImageHeightRequest)); Drawable left = null; Drawable right = null; Drawable top = null; Drawable bottom = null; targetButton.CompoundDrawablePadding = Padding; switch (model.Orientation) { case ImageOrientation.ImageToLeft: targetButton.Gravity = GravityFlags.Left | GravityFlags.CenterVertical; left = scaledDrawable; break; case ImageOrientation.ImageToRight: targetButton.Gravity = GravityFlags.Right | GravityFlags.CenterVertical; right = scaledDrawable; break; case ImageOrientation.ImageOnTop: top = scaledDrawable; break; case ImageOrientation.ImageOnBottom: bottom = scaledDrawable; break; } targetButton.SetCompoundDrawables(left, top, right, bottom); } } }
public async Task<IActionResult> EditLabAsync(int? id, Labs labs, IFormFile PicturePath) { var foundLab = db.Labs.Where(labs => labs.Id == id).FirstOrDefault(); foundLab.Name = labs.Name; foundLab.Description = labs.Description; foundLab.AddUserID = (int)HttpContext.Session.GetInt32("User_ID"); foundLab.AdditionDate = DateTime.Now; foundLab.Language = labs.Language; foundLab.SubstructureID = labs.SubstructureID; // * resim yolu if (PicturePath != null) { string imageExtension = Path.GetExtension(PicturePath.FileName); string imageName = Guid.NewGuid() + imageExtension; string path = Path.Combine($"wwwroot/img/Labs/{imageName}"); using var stream = new FileStream(path, FileMode.Create); await PicturePath.CopyToAsync(stream); labs.PicturePath = path; labs.PicturePath = labs.PicturePath.Substring(labs.PicturePath.IndexOf("wwwroot")).Replace("wwwroot", string.Empty); } foundLab.PicturePath = labs.PicturePath; db.Labs.Update(foundLab); db.SaveChanges(); return RedirectToAction("Labs"); }
public ObservableCollection <Labs> GetLabs(string connectionString, TimeSpan timeSpan) { string GetLabsQuery = "SELECT DISTINCT * FROM labs WHERE labs.CloseTime > CONVERT(time,'" + timePicker1.Time.ToString() + "')"; var labs = new ObservableCollection <Labs>(); try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); if (conn.State == System.Data.ConnectionState.Open) { using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = GetLabsQuery; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { var lab = new Labs(); lab.LabName = dr.GetString(0); lab.LabLocation = dr.GetString(1); lab.SelectedTime = timePicker1.Time.ToString(); lab.Level = "Level " + dr.GetInt32(2).ToString(); labs.Add(lab); } } } } } return(labs); } catch (Exception exSql) { Helpers.ShowMsgComplete(exSql.Message, "Unable to connect to the database."); } return(null); }
public ObservableCollection <Labs> Getlabs(string connectionString) { GetLabsQuery = "SELECT * FROM labs WHERE Level=@level"; var labs = new ObservableCollection <Labs>(); try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); if (conn.State == System.Data.ConnectionState.Open) { using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = GetLabsQuery; cmd.Parameters.Add("@level", System.Data.SqlDbType.Int, 1).Value = parameter; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { var lab = new Labs(); lab.LabName = dr.GetString(0); lab.LabLocation = dr.GetString(1); lab.Level = "Level " + dr.GetInt32(2).ToString(); labs.Add(lab); } } } } } return(labs); } catch (Exception exSql) { Helpers.ShowMsgComplete(exSql.Message, "Unable to connect to the database"); } return(null); }
/// <summary> /// Gets the lab. /// </summary> /// <param name="prefixText">The prefix text.</param> /// <param name="count">The count.</param> /// <returns></returns> public static List <Labs> GetLab(string prefixText, int count) { List <Labs> items = new List <Labs>(); ILabFunctions LabTestsMgrDate; LabTestsMgrDate = (ILabFunctions)ObjectFactory.CreateInstance("BusinessProcess.Laboratory.BLabFunctions, BusinessProcess.Laboratory"); //string query; //query = "Exec dbo.Laboratory_GetLabTestID @LabName='" + prefixText + "' ,@ExcludeLabDepartment=8"; // DataTable dt = LabTestsMgrDate.ReturnLabQuery(query); DataTable dt = new DataTable(); dt = LabTestsMgrDate.FindLabByName(prefixText, null, 8); HttpContext.Current.Session["DTLABRESULT"] = dt; if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { try { Labs item = new Labs(); item.SubTestId = (int)row["LabTestID"]; item.SubTestName = (string)row["LabName"]; item.LabDepartmentId = (int)row["LabDepartmentID"]; item.LabDepartmentName = (string)row["labdepartmentname"]; item.DataType = row["DataType"].ToString(); items.Add(item); } catch { } } } return(items); }
/// <summary> /// Gets the font for the button (applied to all button text EXCEPT the icon) /// </summary> /// <param name="iconButton"></param> /// <param name="targetButton"></param> /// <returns></returns> private static UIFont GetButtonFont(Labs.Controls.IconButton iconButton, UIButton targetButton) { UIFont btnTextFont = iconButton.Font.ToUIFont(); if (iconButton.Font != Font.Default && btnTextFont != null) return btnTextFont; else if (iconButton.Font == Font.Default) return UIFont.SystemFontOfSize(17f); return btnTextFont; }
public static Labs CreateLabs(int ID, byte[] rowVersion, global::System.DateTime labDate, int labs_People) { Labs labs = new Labs(); labs.Id = ID; labs.RowVersion = rowVersion; labs.LabDate = labDate; labs.Labs_People = labs_People; return labs; }
public void UpdateLabProject(Labs lab) { _db.Update(lab); }
public void AddToLabsSet(Labs labs) { base.AddObject("LabsSet", labs); }
public IEnumerator <Lab> GetEnumerator() { return(Labs.GetEnumerator()); }
public LocalCourse(string courseName, string teacherName, IList<string> students, Labs lab) : base(courseName, teacherName, students) { this.Lab = lab; }
public void add(Lab crs) { Labs.Add(crs); }