protected void Page_Load(object sender, EventArgs e) { try { emp = Session["Employee"] as List <Employee_t>; if (emp == null) { Response.Redirect("~/Login.aspx", false); } empId = emp[0].Emp_Id; role = Session["Role"] as Role_t; appraisal = Session["appraisal"] as Appraisal_t; Rating = new List <int>(); for (int i = 1; i <= 5; i++) { Rating.Add(i); } RatingItem = new List <string>(); RatingItem.Add("Extraordinary"); RatingItem.Add("Exemplary +"); RatingItem.Add("Exemplary"); RatingItem.Add("Enabler +"); RatingItem.Add("Enabler"); appraisal = Session["appraisal"] as Appraisal_t; if (Session["Type"] != null) { type = Convert.ToInt32(Session["Type"].ToString()); } if (!Page.IsPostBack) { //jquery drop ReviewerRating.DataSource = RatingItem; ReviewerRating.DataBind(); using (PerformanceAppEntities db = new PerformanceAppEntities()) { string[] CriteriaIds = role.CriteriaIds.Split(';'); for (int i = 0; i < CriteriaIds.Length; i++) { Guid Id = Guid.Parse(CriteriaIds[i]); Parameter_t Localparameter = db.Parameter_t.Where(m => m.CriteriaId == Id).Single(); Parameters.Add(Localparameter); } ProjectGrid.DataSource = Parameters; ProjectGrid.DataBind(); if (appraisal != null) { if (appraisal.EmpProjects != null) { ReviewerRating.Text = appraisal.ProRevRating; ReviewerComment.Text = appraisal.ProRevComment; OtherTextBox.Text = appraisal.ProAppOtherCmnt; ProjectIds = appraisal.EmpProjects.Split(';'); empProject = new List <EmpProject_t>(); for (int t = 0; t < ProjectIds.Length - 1; t++) { Guid ID = Guid.Parse(ProjectIds[t]); EmpProject_t empPro = db.EmpProject_t.Where(m => m.EmpProjId == ID).Single(); empProject.Add(empPro); } if (empProject != null) { int total = 0; foreach (var item in empProject.OrderBy(order => order.Type)) { GridViewRow row = ProjectGrid.Rows[total]; if (item.Type == total) { DropDownList combo1 = (DropDownList)row.FindControl("SelfRating"); combo1.SelectedValue = item.Self_Rating.ToString(); TextBox text_Self = row.FindControl("SelfComment") as TextBox; text_Self.Text = item.SelfComments; DropDownList combo2 = (DropDownList)row.FindControl("AppraiserRating"); combo2.SelectedValue = item.App_Rating.ToString(); TextBox text_App = row.FindControl("AppraiserComment") as TextBox; text_App.Text = item.AppComments; } total++; } } } } } if (type == 0) { name.Text = emp[0].Firstname + " " + emp[0].Lastname; Reviwer.Visible = false; OtherComments.Visible = false; OtherTextBox.Visible = false; } else { name.Text = Session["Firstname"].ToString() + " " + Session["Lastname"].ToString(); } } } catch (Exception ex) { using (PerformanceAppEntities db = new PerformanceAppEntities()) { Log_t log = new Log_t(); log.Error_Message = ex.Message; log.Page = "PerformanceAppraisal3"; log.Method = "Page_Load"; log.Datetime = DateTime.Now; db.Log_t.Add(log); db.SaveChanges(); Response.Redirect("~/Login.aspx", false); } } }