protected void Page_Load(object sender, EventArgs e) { Assert.ArgumentNotNull(currentGuid, "Source category guid is null"); Assert.ArgumentNotNullOrEmpty(ItemPaths.WorkoutCategories, "Workout category paths empty"); List<WorkoutCategory> categoryList = new List<WorkoutCategory>(); foreach (Item category in Sitecore.Context.Database.GetItem(ItemPaths.WorkoutCategories).Children) { DropDownItem cat = new DropDownItem(category); if (category.ID.ToString().Equals(CurrentGuid)) { ContextCategory = new WorkoutCategory(cat.ID.ToString(), cat.Id.Raw, cat.Value.Raw, Sitecore.Context.Item); categoryList.Add(ContextCategory); } else { categoryList.Add(new WorkoutCategory(cat.ID.ToString(), cat.Id.Raw, cat.Value.Raw)); } } CategoryList.DataSource = categoryList; ZoneLinkList.DataSource = ContextCategory.WorkoutZones; ZoneList.DataSource = ContextCategory.WorkoutZones; CategoryList.DataBind(); ZoneLinkList.DataBind(); ZoneList.DataBind(); }
/// <summary> /// Defines a item. /// </summary> /// <returns></returns> public DropDownItemBuilder Add() { DropDownItem item = new DropDownItem(); container.Add(item); return new DropDownItemBuilder(item); }
/// <summary> /// Binding data to the control /// </summary> protected override void PerformDataBinding() { //this.Items.Clear(); if (this.ShowAll) { DropDownItem li = new DropDownItem(); li.Text = "(Show All)"; li.Value = string.Empty; li.Persistent = DropDownPersistenceType.Always; this.Items.Add(li); } string storesWhat = string.Empty; if (this.StorageAreaType != StoresWhat.All) { storesWhat = this.StorageAreaType.ToString(); } string usableInventory = string.Empty; if (UsableInventoryAreaOnly) { usableInventory = "true"; } var areas = GetAreas(this.ConnectionString, this.ProviderName, storesWhat, usableInventory); foreach (var item in areas) { if (this.StorageAreaType != StoresWhat.All || !this.DisplayStorageTypeGroups) { item.OptionGroup = string.Empty; } this.Items.Add(item); } }
protected void ultEnContent_ToolbarItemRender(object sender, ToolbarItemRenderEventArgs e) { DropDownItem ddi; if (e.ToolbarItem.ID == "InsertHTML") { strSQL = "SELECT FileID,FileName,FileLabel FROM Port_FilesSchool WHERE CoursePlanner = 1 AND CPFileType = 1 AND SchoolID = 28150"; DataTable dtbImages = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(strSQL); ddi = new DropDownItem(); ddi.ItemText = "Insert image..."; ddi.ItemValue = ""; e.ToolbarItem.DropDown.Add(ddi); foreach (DataRow drRow in dtbImages.Rows) { ddi = new DropDownItem(); ddi.ItemText = drRow["FileLabel"].ToString(); ddi.ItemValue = "<img src='..//schoolfiles//" + "28150" + "//" + CareerCruisingWeb.CCLib.Common.Strings.GetURIString(drRow["FileName"].ToString()) + "' alt='" + drRow["FileLabel"].ToString() + "'>"; e.ToolbarItem.DropDown.Add(ddi); } //e.ToolbarItem.OnBeforeChange = "InsertHTMLBeforeChange();"; //e.ToolbarItem.OnAfterChange = "InsertHTMLAfterChange();"; } }
protected void ddlHabilidades_TextChanged(object sender, EventArgs e) { if (!String.IsNullOrEmpty(ddlHabilidades.SelectedItem.Text)) { string desc = ddlHabilidades.SelectedItem.Text; int code = Convert.ToInt32(ddlHabilidades.SelectedItem.Value); DropDownItem item = new DropDownItem(code, desc); if (!ListaCompetencias.Contains(item) && !String.IsNullOrEmpty(desc) && ListaCompetencias.Count < 10) { ListaCompetencias.Add(item); grvSelecionados.DataSource = ListaCompetencias; grvSelecionados.DataBind(); } else if (ListaCompetencias.Count == 10) { Master.OpenWarningModal("A lista de competência pode ter no máximo 10 itens!"); } else if (ListaCompetencias.Contains(item)) { Master.OpenWarningModal("A competência " + desc + " já está cadastrada!"); } } }
private void StartSelectedSearch() { DropDownItem item = new DropDownItem(); item = (DropDownItem)ListView1.SelectedItem; Process.Start(item.Path + item.Content); TextBar1.Clear(); }
internal int method_5(DropDownItem A_0) { return(base.InnerList.Add(A_0)); }
public ActionResult SaveProfile(EmployeeProfile employee) { bool isValid = true; if (ModelState.IsValid) { Regex regex = new Regex(@"^[\w!#$%&'*+\-/=?\^_`{|}~]+(\.[\w!#$%&'*+\-/=?\^_`{|}~]+)*" + "@" + @"((([\-\w]+\.)+[a-zA-Z]{2,4})|(([0-9]{1,3}\.){3}[0-9]{1,3}))$"); if (employee.EmailAddress != null) { if (employee.EmailAddress.Trim() != "") { Match match = regex.Match(employee.EmailAddress); if (!match.Success) { employee.ErrorMesage = "Invalid Email Address format."; isValid = false; } } } if ((!employee.IsActive) && (employee.RelievingDate == null)) { employee.ErrorMesage = "Enter Relieving Date."; isValid = false; } else if (employee.DOJ > employee.RelievingDate) { employee.ErrorMesage = "Relieving Date should be greater than Joining Date."; isValid = false; } else if (employee.DOJ > employee.ConfirmationDate) { employee.ErrorMesage = "Confirmation Date should be greater than Joining Date."; isValid = false; } if (employee.IsActive) { employee.RelievingDate = null; } if (isValid) { employee.LogonId = employee.LogonId.ToUpper(); employee.FirstName = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(employee.FirstName.ToLower().Trim()); employee.LastName = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(employee.LastName.ToLower().Trim()); employee.EmailAddress = employee.EmailAddress?.ToLower().Trim(); using (var client = new EmployeeClient()) { string result = client.UpdateEmployeeProfile(employee, UserId); if (result == "Saved") { employee.ErrorMesage = "Saved"; } else if (result == "NeedRole") { employee.ErrorMesage = "Only the user with role 'HR' is allowed to do this action."; } else if (result == "noChanges") { employee.ErrorMesage = "No changes made to Employee Profile."; } else if (result == "Duplicate") { employee.ErrorMesage = "The employee Id already exists."; } else if (result == "DupCorp") { employee.ErrorMesage = "The logon id was already assigned to another employee."; } else if (result == "DupCard") { employee.ErrorMesage = "The card number was already assigned to another employee."; } } } } else { employee.ErrorMesage = "Fix the error messages shown and try to Save again."; } using (var client = new OfficeLocationClient()) { var lstOfc = client.GetAllOfficeLocations(); ViewBag.EmpOffice = lstOfc.Where(x => x.Key == Convert.ToString(OfficeId)).ToList(); DropDownItem di = new DropDownItem { Key = "", Value = "" }; lstOfc.Insert(0, di); ViewBag.OfficeLocationList = lstOfc; } using (var client = new RoleClient()) { ViewBag.RoleList = client.GetAllRoles(); } using (var client = new ShiftClient()) { ViewBag.ShiftList = client.GetShiftMaster(); } using (var client = new EmployeeClient()) { var lstEmploymentTypes = client.GetEmploymentTypes(); DropDownItem di = new DropDownItem { Key = "", Value = "" }; lstEmploymentTypes.Insert(0, di); ViewBag.EmploymentTypeList = lstEmploymentTypes; } using (var client = new EmployeeClient()) { IList <DropDownItem> reptList = new List <DropDownItem>(); if (employee.Mode == "Add") { ViewBag.ReportToList = client.GetActiveEmpList(employee.OfficeId, null); } else { ViewBag.ReportToList = client.GetActiveEmpList(employee.OfficeId, employee.UserId); } DropDownItem di = new DropDownItem { Key = "", Value = "" }; reptList.Insert(0, di); } return(View("EmployeeProfile", employee)); }
public ActionResult ViewProfile() { ViewBag.PageTile = "Employee Profile"; ViewBag.TagLine = ""; ViewBag.IsSelfProfile = true; Int64 userIdForProfile = 0; EmployeeProfile profile = null; if (TempData["UserId"] == null) { userIdForProfile = UserId; } else { userIdForProfile = Convert.ToInt64(TempData["UserId"].ToString()); } using (var client = new EmployeeClient()) { profile = client.GetEmployeeProfile(userIdForProfile); } using (var client = new ShiftClient()) { ViewBag.ShiftList = client.GetShiftMaster(); } using (var client = new OfficeLocationClient()) { List <DropDownItem> lstOfc = client.GetAllOfficeLocations(); DropDownItem di = new DropDownItem(); ViewBag.EmpOffice = lstOfc.Where(x => x.Key == Convert.ToString(OfficeId)).ToList(); di.Key = ""; di.Value = ""; lstOfc.Insert(0, di); ViewBag.OfficeLocationList = lstOfc; } using (var client = new RoleClient()) { ViewBag.RoleList = client.GetAllRoles(); } using (var client = new EmployeeClient()) { var lstEmploymentTypes = client.GetEmploymentTypes(); DropDownItem di = new DropDownItem(); ViewBag.EmploymentTypeList = lstEmploymentTypes; } if (profile != null) { using (var client = new EmployeeClient()) { IList <DropDownItem> reptList = client.GetActiveEmpList(profile.OfficeId, userIdForProfile); DropDownItem di = new DropDownItem { Key = "", Value = "" }; reptList.Insert(0, di); ViewBag.ReportToList = reptList; } } if (TempData["Mode"] == null) { profile.Mode = "View"; } else { profile.Mode = TempData["Mode"].ToString(); } return(View("EmployeeProfile", profile)); }
public void AddItem(DropDownItem item) { items.Add(item); CalculateDimensions(); }
private void ListView1_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return && !ListView1.Items.IsEmpty && mode == "search") { StartSelectedSearch(); } else if (e.Key == Key.Return && !ListView1.Items.IsEmpty && mode == "calc") { try { DropDownItem item = new DropDownItem(); item = (DropDownItem)ListView1.SelectedItem; if (!item.Option.Equals("")) Clipboard.SetDataObject(item.Content); TextBar1.Clear(); } catch (Exception ex) { } } else if (e.Key == Key.Return && !ListView1.Items.IsEmpty && mode == "app") { StartSelectedApp(); } else if (e.Key == Key.Return && !ListView1.Items.IsEmpty && mode == "file") { StartSelectedFile(); } else if(e.Key == Key.Return && !ListView1.Items.IsEmpty && mode == "command") { StartSelectedCommand(); } else if (e.Key == Key.Up && ListView1.SelectedItem == ListView1.Items[0]) { TextBar1.Focus(); } else if (e.Key != Key.Up && e.Key != Key.Down) { TextBar1.Focus(); } }
private async void TextBar1_TextChanged(object sender, TextChangedEventArgs e) { string text = TextBar1.Text; if (string.IsNullOrEmpty(TextBar1.Text)) { ListView1.Items.Clear(); ListView1.Visibility = Visibility.Hidden; this.Height = 95; } text = TextBar1.Text; dropDownList = await Task.Run(() => AppSearch(text)); mode = "app"; ListView1.Items.Clear(); if (dropDownList != null && dropDownList.Count > 0) { for (int i = 0; i < dropDownList.Count; i++) { DropDownAdd(dropDownList[i]); } } else { text = await Task.Run(() => Calculator(text)); if (mode == "calc") { ContentColumn.Width = 300; OptionColumn.Width = 250; Uri imageUri = new Uri(@"..\Content\calc.ico", UriKind.Relative); BitmapImage imageBitmap = new BitmapImage(imageUri); DropDownItem item = new DropDownItem { Content = text, Option = "Copy with enter", ImgSrc = imageBitmap }; ListView1.Items.Clear(); if (item.Content.Equals("Please use a valid expression")) item.Option = ""; DropDownAdd(item); } else { text = TextBar1.Text; dropDownList = WebSearch(text); //////////// try { if (text.ToLower().StartsWith("find ") && text.Length > 5) { dropDownList = await Task.Run(() => FileSearcher(text.Substring(5, text.Length - 5))); } } catch (Exception excep) { System.Windows.MessageBox.Show(excep.Message); } if (text.ToLower().StartsWith("-")) { dropDownList = await Task.Run(()=>Commands(text)); } ////////////// ListView1.Items.Clear(); if (dropDownList != null) { for (int i = 0; i < dropDownList.Count; i++) { DropDownAdd(dropDownList[i]); } } } } if (string.IsNullOrEmpty(TextBar1.Text)) { ListView1.Items.Clear(); ListView1.Visibility = Visibility.Hidden; this.Height = 95; } this.Height = 95 + (ListView1.Items.Count * 40); }
/// <summary> /// Initializes a new instance of the <see cref="DropDownItemBuilder"/> class. /// </summary> /// <param name="item">The item.</param> public DropDownItemBuilder(DropDownItem item) { Guard.IsNotNull(item, "item"); this.item = item; }
private async void StartSelectedFile() { DropDownItem item = new DropDownItem(); item = (DropDownItem)ListView1.SelectedItem; try { Process.Start(item.Path); } catch (Exception ex) { var folderPath = item.Path.Substring(0, item.Path.LastIndexOf("\\")); Process.Start("explorer.exe", folderPath); } item.LastUsed = DateTime.Now; item.TotalTimesUsed++; await Task.Run(() => DatabaseManager.UpdateFilesTable(item)); TextBar1.Clear(); }
private async void StartSelectedApp() { DropDownItem item = new DropDownItem(); item = (DropDownItem)ListView1.SelectedItem; try { if (SharedHelper.BringProcessToFront(item.Content.Substring(0, item.Content.LastIndexOf('.')), item.Path)) { this.Hide(); } else { Process.Start(item.Path); } TextBar1.Clear(); } catch (Exception ex) { var folderPath = item.Path.Substring(0, item.Path.LastIndexOf("\\")); Process.Start("explorer.exe", folderPath); } item.LastUsed = DateTime.Now; item.TotalTimesUsed++; await Task.Run(() =>DatabaseManager.UpdateFilesTable(item)); TextBar1.Clear(); }
private void crearDD() { LeyendaDropDown sel = new LeyendaDropDown(new Point(250, 15)); DropDownItem item = new DropDownItem("hola", Color.Red); DropDownItem item2 = new DropDownItem("r", Color.Green); DropDownItem item3 = new DropDownItem("d", Color.Yellow); DropDownItem item4 = new DropDownItem("v", Color.Blue); DropDownItem item5 = new DropDownItem("j", Color.Orange); sel.Items.Add(item); sel.Items.Add(item2); sel.Items.Add(item3); sel.Items.Add(item4); sel.Items.Add(item5); this.Controls.Add(sel); MenuButton bt = new MenuButton(); //bt.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image"))); bt.Name = "toolStripDropDownButton1"; bt.Size = new System.Drawing.Size(29, 22); bt.Text = "toolStripDropDownButton1"; ContextMenuStrip menu = new ContextMenuStrip(); menu.Items.Add("Hola", Utilities.Controls.Leyenda.Menu.GetImagen(Color.Red)); bt.Menu = menu; this.Controls.Add(bt); //ToolStripDropDownButton bt = new ToolStripDropDownButton(); //bt.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; ////bt.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image"))); //bt.ImageTransparentColor = System.Drawing.Color.Magenta; //bt.Name = "toolStripDropDownButton1"; //bt.Size = new System.Drawing.Size(29, 22); //bt.Text = "toolStripDropDownButton1"; //this.Controls.Add(bt); //ContextMenuStrip menu = new ContextMenuStrip(); //Bitmap imagen = new Bitmap(16, 16); //using (Graphics g = Graphics.FromImage(imagen)) //{ // using (Brush b = new SolidBrush(Color.Red)) // { // g.DrawRectangle(Pens.White, 0, 0, imagen.Width, imagen.Height); // g.FillRectangle(b, 1, 1, imagen.Width - 1, imagen.Height - 1); // } //} //menu.Items.Add("Hola", imagen); //MenuButton bt = new MenuButton(); //bt.Menu = menu; //this.Controls.Add(bt); }
public static async Task<bool> UpdateFilesTable(DropDownItem item) { try { var SqlConnection = new SQLiteConnection("Data Source=" + DBLocation + "; Version=3"); SqlConnection.Open(); string sql = "UPDATE FilesFound SET TotalUsed = " + item.TotalTimesUsed + ", LastUsed = \"" + item.LastUsed + "\" WHERE ID = " + item.ID; SQLiteCommand cmd = new SQLiteCommand(sql, SqlConnection); cmd = new SQLiteCommand(sql, SqlConnection); cmd.ExecuteNonQuery(); SqlConnection.Close(); return true; } catch (Exception e) { return false; throw e; } }
public DropDownItemBuilderTests() { item = new DropDownItem(); builder = new DropDownItemBuilder(item); }
public static bool UpdateCommand(DropDownItem item) { try { var SqlConnection = new SQLiteConnection("Data Source=" + DBLocation + "; Version=3"); SqlConnection.Open(); string sql = "UPDATE Commands SET TotalUsed = " + item.TotalTimesUsed+ ", Name = \"" + item.Content + "\", Path = \"" + item.Path + "\" WHERE ID = " + item.ID; SQLiteCommand cmd = new SQLiteCommand(sql, SqlConnection); cmd = new SQLiteCommand(sql, SqlConnection); cmd.ExecuteNonQuery(); SqlConnection.Close(); return true; } catch (Exception e) { return false; throw e; } }
private void StartSelectedCommand() { try { DropDownItem item = new DropDownItem(); item = (DropDownItem)ListView1.SelectedItem; try { if (item.Path.Contains(".exe") && SharedHelper.BringProcessToFront(item.Path.Substring(item.Path.LastIndexOf("\\")) ,item.Path)) { this.Hide(); } else { Process.Start(item.Path); } TextBar1.Clear(); } catch (Exception ex) { } item.TotalTimesUsed++; DatabaseManager.UpdateCommand(item); TextBar1.Clear(); } catch (Exception e) { Console.WriteLine(e.Message); } }
private void DropDownAdd(DropDownItem item) { this.ListView1.Items.Add(item); ListView1.SelectedItem = ListView1.Items[0]; ListView1.Visibility = Visibility.Visible; }
protected void UltimateEditor1_ToolbarItemRender(object sender, ToolbarItemRenderEventArgs e) { if (e.ToolbarItem.ID == "InsertHTML") { DropDownItem ddi; ddi = new DropDownItem(); ddi.ItemText = "Insert..."; ddi.ItemValue = ""; e.ToolbarItem.DropDown.Add(ddi); System.Text.StringBuilder sbSQL = new System.Text.StringBuilder(""); sbSQL.Append("SELECT FileID, FileName, FileLabel FROM Port_FilesSchool WHERE CoursePlanner = 1 AND CPFileType = 1 AND SchoolID = "); sbSQL.Append(strSchoolID); sbSQL.Append(";"); sbSQL.Append("SELECT FileID, FileName, FileLabel FROM Port_FilesSchool WHERE CoursePlanner = 1 AND CPFileType = 2 AND SchoolID = "); sbSQL.Append(strSchoolID); sbSQL.Append(";"); sbSQL.Append("SELECT FileID, FileName, FileLabel FROM Port_FilesSchool WHERE CoursePlanner Is Null AND CPFileType Is Null AND SchoolID = "); sbSQL.Append(strSchoolID); DataTable[] arrFileTables = CCLib.Common.DataAccess.GetDataTables(sbSQL.ToString()); //Fill the image items DataTable dtbImages = arrFileTables[0]; if (dtbImages.Rows.Count > 0) { ddi = new DropDownItem(); ddi.ItemText = "UPLOAD CENTER IMAGES"; ddi.ItemValue = "IMAGES"; e.ToolbarItem.DropDown.Add(ddi); foreach (DataRow drRow in dtbImages.Rows) { ddi = new DropDownItem(); ddi.ItemText = @"-> " + drRow["FileLabel"].ToString(); ddi.ItemValue = "<img src='https://www.careercruising.com/schoolfiles/" + strSchoolID + @"/" + CCLib.Common.Strings.GetURIString(drRow["FileName"].ToString()) + @"' alt='" + drRow["FileLabel"].ToString() + "'>"; e.ToolbarItem.DropDown.Add(ddi); } } //Fill the document items DataTable dtbDocs = arrFileTables[1]; if (dtbDocs.Rows.Count > 0) { ddi = new DropDownItem(); ddi.ItemText = "UPLOAD CENTER DOCS"; ddi.ItemValue = "DOCS"; e.ToolbarItem.DropDown.Add(ddi); foreach (DataRow drRow in dtbDocs.Rows) { ddi = new DropDownItem(); ddi.ItemText = @"-> " + drRow["FileLabel"].ToString(); ddi.ItemValue = @"<a href='https://www.careercruising.com/schoolfiles/" + strSchoolID + @"/" + CCLib.Common.Strings.GetURIString(drRow["FileName"].ToString()) + @"' alt='" + drRow["FileLabel"].ToString() + @"'>" + drRow["FileLabel"].ToString() + @"</a>"; e.ToolbarItem.DropDown.Add(ddi); } } //Fill the portfolio document items DataTable dtbPHDocs = arrFileTables[2]; if (dtbPHDocs.Rows.Count > 0) { ddi = new DropDownItem(); ddi.ItemText = "PORTFOLIO HOMEPAGE DOCS"; ddi.ItemValue = "PH DOCS"; e.ToolbarItem.DropDown.Add(ddi); foreach (DataRow drRow in dtbPHDocs.Rows) { ddi = new DropDownItem(); ddi.ItemText = @"-> " + drRow["FileLabel"].ToString(); ddi.ItemValue = @"<a href='https://www.careercruising.com/schoolfiles/" + strSchoolID + @"/" + CCLib.Common.Strings.GetURIString(drRow["FileName"].ToString()) + @"' alt='" + drRow["FileLabel"].ToString() + @"'>" + drRow["FileLabel"].ToString() + @"</a>"; e.ToolbarItem.DropDown.Add(ddi); } } e.ToolbarItem.OnBeforeChange = "InsertHTMLBeforeChange();"; e.ToolbarItem.OnAfterChange = "InsertHTMLAfterChange();"; } }
private void LoadEmployees() { var dbPath = Utilities.GetDbPath(); if (dbPath == "") { return; } var connString = Utilities.BuildConnectionString(dbPath); var myConnection = new FbConnection(connString); myConnection.Open(); var command = new FbCommand( "SELECT a.EMP_NO, a.NAME, a.SURNAME FROM EMP a ORDER BY a.EMP_NO ASC NULLS LAST", myConnection); var adapter = new FbDataAdapter(command); var dt = new DataTable(); var i = adapter.Fill(dt); if (i > 0) { foreach (var row in dt.Rows) { var employee = $"{((DataRow) row)[0]} ({((DataRow) row)[2]}, {((DataRow) row)[1]})"; var employeeItem = new DropDownItem { Id = ((DataRow) row)[0].ToString(), Text = employee }; cmbEmployeeFrom.Properties.Items.Add(employeeItem); cmbEmployeeTo.Properties.Items.Add(employeeItem); } cmbEmployeeFrom.SelectedIndex = 0; cmbEmployeeTo.SelectedIndex = cmbEmployeeTo.Properties.Items.Count - 1; } }