public UnitOfWork(InformationDbContext context) { Context = context; Projects = new ProjectRepository(Context); Employees = new EmployeeRepository(Context); EmployeeProjects = new EmployeeProjectRepository(context); }
private void bestEmploees() { string text = ""; EmployeesRepository er = new EmployeesRepository(); EmployeeProjectRepository ep = new EmployeeProjectRepository(); DataTable dt = er.getTopEmploees(); if (dt.Rows.Count != 0) { for (int i = 0; i < dt.Rows.Count; i++) { string fullName = dt.Rows[i][0].ToString(); string score = dt.Rows[i][1].ToString(); int id = dt.Rows[i][2].ToString().ToInt(); string projectCount = ep.getEmployeeProjectCount(id).ToString(); string img = er.getEmployeeByID(id).empImage; text += "<div class='item '><div class='theBest '><div class='imgDiv'><img class='empImg' src='"; text += img; text += "'/></div ><div class='employeeName'><h3>"; text += ""; text += fullName; string txt = ResolveUrl("images/testimonial/down-arrow.png"); text += "</h3></div><div class='arrow row m0'><img src='" + txt + "'/></div><div class='projectNum'><h4>"; text += " تعداد پروژه ها"; text += "</h4><h3>"; text += projectCount; text += "</h3></div><div class='EmployeeScore'><h4>"; text += "امتیاز</h4><h3>"; text += score; text += "</h3></div></div></div>"; } best.InnerHtml = text; } }
protected void btnSave_Click(object sender, EventArgs e) { EmployeeProjectRepository ep = new EmployeeProjectRepository(); if (loi.Count == 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('هیچ کارمندی انتخاب نشده است!حداقل یک کارمند را انتخاب کنید')", true); return; } int projid = Session["ProjectLastIDForEmployeeFilterEdit"].ToString().ToInt(); Session.Remove("ProjectLastIDForEmployeeFilterEdit"); ep.deleteByProjectID(projid); EmployeeProject em; foreach (int i in loi) { em = new EmployeeProject(); em.EmployeeID = i; em.ProjectID = projid; ep.SaveEmployeeProject(em); } Response.Redirect("/Admin/ManageProjects"); }