protected void LoadEmployees() { Employee emp = new Employee(); List <Employee> empL = emp.getEmployeeList(); ShiftsEmployee shiftEmp = new ShiftsEmployee(); List <ShiftsEmployee> shiftEmpList = shiftEmp.GetShiftsList(); foreach (Employee empTemp in empL) { HtmlGenericControl divEmpl = new HtmlGenericControl("div"); divEmpl.Attributes["class"] = "btn list"; divEmpl.ID = empTemp.First_name; divEmpl.Attributes["draggable"] = "true"; divEmpl.Attributes["ondragstart"] = "drag(event)"; string list = ""; foreach (ShiftsEmployee item in empTemp.Last_shift) { if (list == "") { list = Convert.ToString(item.Type); } else { list += "0" + Convert.ToString(item.Type); } } divEmpl.Attributes["onmouseover"] = "employeePerfernce(" + list + ")"; divEmpl.Attributes["onmouseout"] = "clearShiftTable()"; divEmpl.InnerHtml = empTemp.First_name + " " + empTemp.Last_name; divEmpl.InnerHtml += " <span class='badge badge-pill badge-danger tooltipC'> <span class='tooltiptext'>" + empTemp.Minimum + " משמרות</span><span id='" + empTemp.User_name + "'>" + 0 + "<span></span>"; divEmpl.ID = Convert.ToString(empTemp.First_name + "_" + empTemp.Last_name + "_" + empTemp.User_name); EmployeeList.Controls.Add(divEmpl); } }
protected void LoadAlgorithm(object sender, EventArgs e) { ShiftsEmployee shiftEmp = new ShiftsEmployee(); List <ShiftsEmployee> shiftEmpList = shiftEmp.GetShiftsList(); Employee emp = new Employee(); List <Employee> empL = emp.getEmployeeList(); foreach (ShiftsEmployee shift in shiftEmpList) { HtmlGenericControl divShift = new HtmlGenericControl("button"); divShift.Attributes["class"] = "btn btn-light"; foreach (Employee empT in empL) { if (shift.Title == empT.First_name) { divShift.ID = empT.User_name + "_" + shift.Type; } } divShift.Attributes.CssStyle.Add("width", "80px"); divShift.Attributes.CssStyle.Add("margin-bottom", "2px"); divShift.InnerHtml = shift.Title + " <img src='img/delete.png' style='height: 15px; '/>"; if (shift.Type == 11) { PlaceHolder11.Controls.Add(divShift); continue; } else if (shift.Type == 21) { PlaceHolder21.Controls.Add(divShift); continue; } else if (shift.Type == 31) { PlaceHolder31.Controls.Add(divShift); continue; } else if (shift.Type == 41) { PlaceHolder41.Controls.Add(divShift); continue; } else if (shift.Type == 51) { PlaceHolder51.Controls.Add(divShift); continue; } else if (shift.Type == 61) { PlaceHolder61.Controls.Add(divShift); continue; } else if (shift.Type == 71) { PlaceHolder71.Controls.Add(divShift); continue; } else if (shift.Type == 12) { PlaceHolder12.Controls.Add(divShift); continue; } else if (shift.Type == 22) { PlaceHolder22.Controls.Add(divShift); continue; } else if (shift.Type == 32) { PlaceHolder32.Controls.Add(divShift); continue; } else if (shift.Type == 42) { PlaceHolder42.Controls.Add(divShift); continue; } else if (shift.Type == 52) { PlaceHolder52.Controls.Add(divShift); continue; } else if (shift.Type == 62) { PlaceHolder62.Controls.Add(divShift); continue; } else if (shift.Type == 72) { PlaceHolder72.Controls.Add(divShift); continue; } else if (shift.Type == 13) { PlaceHolder13.Controls.Add(divShift); continue; } else if (shift.Type == 23) { PlaceHolder23.Controls.Add(divShift); continue; } else if (shift.Type == 33) { PlaceHolder33.Controls.Add(divShift); continue; } else if (shift.Type == 43) { PlaceHolder43.Controls.Add(divShift); continue; } else if (shift.Type == 53) { PlaceHolder53.Controls.Add(divShift); continue; } else if (shift.Type == 63) { PlaceHolder63.Controls.Add(divShift); continue; } else if (shift.Type == 73) { PlaceHolder73.Controls.Add(divShift); continue; } } EmployeeList.Controls.Clear(); foreach (Employee empTemp in empL) { HtmlGenericControl divEmpl = new HtmlGenericControl("div"); divEmpl.Attributes["class"] = "btn list"; divEmpl.ID = empTemp.First_name; divEmpl.Attributes["draggable"] = "true"; divEmpl.Attributes["ondragstart"] = "drag(event)"; string list = ""; foreach (ShiftsEmployee item in empTemp.Last_shift) { if (list == "") { list = Convert.ToString(item.Type); } else { list += "0" + Convert.ToString(item.Type); } } divEmpl.Attributes["onmouseover"] = "employeePerfernce(" + list + ")"; divEmpl.Attributes["onmouseout"] = "clearShiftTable()"; divEmpl.InnerHtml = empTemp.First_name + " " + empTemp.Last_name; int counter = 0; foreach (ShiftsEmployee shift in shiftEmpList) { if (shift.Title == empTemp.First_name) { counter++; } } if (counter > empTemp.Minimum) { divEmpl.InnerHtml += " <span class='badge badge-pill badge-primary tooltipC'> <span class='tooltiptext'>" + empTemp.Minimum + " משמרות</span><span id='" + empTemp.User_name + "'>" + counter + "<span></span>"; } else if (counter == empTemp.Minimum) { divEmpl.InnerHtml += " <span class='badge badge-pill badge-success tooltipC'> <span class='tooltiptext'>" + empTemp.Minimum + " משמרות</span><span id='" + empTemp.User_name + "'>" + counter + "<span></span>"; } else if (counter > empTemp.Minimum) { divEmpl.InnerHtml += " <span class='badge badge-pill badge-warning tooltipC'> <span class='tooltiptext'>" + empTemp.Minimum + " משמרות</span><span id='" + empTemp.User_name + "'>" + counter + "<span></span>"; } else if (counter == 0) { divEmpl.InnerHtml += " <span class='badge badge-pill badge-danger tooltipC'> <span class='tooltiptext'>" + empTemp.Minimum + " משמרות</span><span id='" + empTemp.User_name + "'>" + 0 + "<span></span>"; } divEmpl.ID = Convert.ToString(empTemp.First_name + "_" + empTemp.Last_name + "_" + empTemp.User_name); EmployeeList.Controls.Add(divEmpl); } }