protected void BtnSave_Click(object sender, EventArgs e) { try { Save(); Session["isSaved"] = 1; using (PerformanceAppEntities db = new PerformanceAppEntities()) { var query = db.Appraisal_t.Where(m => m.EmpId == empId); if (query.Count() != 0) { Appraisal_t app_raisal = query.Single(); app_raisal.Status = 1; db.SaveChanges(); } } } catch (Exception ex) { using (PerformanceAppEntities db = new PerformanceAppEntities()) { Log_t log = new Log_t(); log.Error_Message = ex.Message; log.Page = "PerformanceAppraisal"; log.Method = "BtnSave_Click"; log.Datetime = DateTime.Now; db.Log_t.Add(log); db.SaveChanges(); Response.Redirect("~/Login.aspx", false); } } }
protected void Page_Load(object sender, EventArgs e) { try { emp = Session["Employee"] as List <Employee_t>; if (emp != null) { if (emp[0].PwdReset == 1) { Response.Redirect("~/ResetPassword.aspx", false); } name.Text = emp[0].Firstname + "" + emp[0].Lastname; using (PerformanceAppEntities db = new PerformanceAppEntities()) { int empId = emp[0].Emp_Id; var query = db.Appraisal_t.Where(m => m.EmpId == empId); Appraisal_t app = null; if (query.Count() != 0) { app = query.ToList().Single(); } DataTable Self_Emp = new DataTable(); DataColumn Emp_Id = new DataColumn("Emp_Id", System.Type.GetType("System.Int32")); Self_Emp.Columns.Add(Emp_Id); DataColumn Name = new DataColumn("Name", System.Type.GetType("System.String")); Self_Emp.Columns.Add(Name); DataColumn AppPeriod = new DataColumn("AppPeriod", System.Type.GetType("System.String")); Self_Emp.Columns.Add(AppPeriod); DataColumn AppStatus = new DataColumn("AppStatus", System.Type.GetType("System.String")); Self_Emp.Columns.Add(AppStatus); for (int i = 0; i < emp.Count; i++) { DataRow row = Self_Emp.NewRow(); row["Emp_Id"] = emp[i].Emp_Id; row["Name"] = emp[i].Firstname + "" + emp[i].Lastname; if (app != null) { DateTime from = app.From ?? DateTime.Now; DateTime to = app.To ?? DateTime.Now; row["AppPeriod"] = from.ToString("dd-MM-yyyy") + " to " + to.ToString("dd-MM-yyyy"); } else { row["AppPeriod"] = DateTime.Now.ToString("dd-MM-yyyy") + " to " + DateTime.Now.AddDays(30).ToString("dd-MM-yyyy"); } if (app == null) { row["AppStatus"] = "Not Completed"; } else if (app.Status == 1 || app.Status == null) { row["AppStatus"] = "partially Completed"; } else { row["AppStatus"] = "Completed"; } Self_Emp.Rows.Add(row); Self_Emp.AcceptChanges(); } if (app != null) { if (app.Status == 0 || app.Status == 1) { SelfGrid.DataSource = Self_Emp; SelfGrid.DataBind(); } else { SelfGrid.DataSource = null; SelfGrid.DataBind(); } } else { SelfGrid.DataSource = Self_Emp; SelfGrid.DataBind(); } var query1 = db.Employee_t.Where(m => m.Appraiser == empId); List <Employee_t> AppEmployee = null; DataTable App_Emp = new DataTable(); DataColumn AppEmp_Id = new DataColumn("Emp_Id", System.Type.GetType("System.Int32")); App_Emp.Columns.Add(AppEmp_Id); DataColumn AppName = new DataColumn("Name", System.Type.GetType("System.String")); App_Emp.Columns.Add(AppName); DataColumn AppPeriod1 = new DataColumn("AppPeriod", System.Type.GetType("System.String")); App_Emp.Columns.Add(AppPeriod1); DataColumn AppStatus1 = new DataColumn("AppStatus", System.Type.GetType("System.String")); App_Emp.Columns.Add(AppStatus1); if (query1.Count() != 0) { AppEmployee = query1.ToList(); } else { tabs1.Visible = false; } if (AppEmployee != null) { for (int i = 0; i < AppEmployee.Count; i++) { DataRow row = App_Emp.NewRow(); int Id = AppEmployee[i].Emp_Id; row["Emp_Id"] = AppEmployee[i].Emp_Id; row["Name"] = AppEmployee[i].Firstname + "" + AppEmployee[i].Lastname; var appappraisal = db.Appraisal_t.Where(m => m.EmpId == Id); Appraisal_t appAppr = null; if (appappraisal.Count() != 0) { appAppr = appappraisal.Single(); DateTime from = appAppr.From ?? DateTime.Now; DateTime to = appAppr.To ?? DateTime.Now; row["AppPeriod"] = from.ToString("dd-MM-yyyy") + " to " + to.ToString("dd-MM-yyyy"); } else { row["AppPeriod"] = DateTime.Now.ToString("dd-MM-yyyy") + " to " + DateTime.Now.AddDays(30).ToString("dd-MM-yyyy"); } if (appAppr == null) { row["AppStatus"] = "Not Completed"; } else if (appAppr.Status == 1) { row["AppStatus"] = "partially Completed"; } else if (appAppr.Status == 2) { row["AppStatus"] = "Completed"; } else if (appAppr.Status == 3) { row["AppStatus"] = "Appraiser Review Completed"; } else if (appAppr.Status == 4) { row["AppStatus"] = "Reviewer Review Completed"; } App_Emp.Rows.Add(row); App_Emp.AcceptChanges(); } AppGrid.DataSource = App_Emp; AppGrid.DataBind(); } var query2 = db.Employee_t.Where(m => m.Reviewer == empId); List <Employee_t> RevEmployee = null; DataTable Rev_Emp = new DataTable(); DataColumn RevEmp_Id = new DataColumn("Emp_Id", System.Type.GetType("System.Int32")); Rev_Emp.Columns.Add(RevEmp_Id); DataColumn RevName = new DataColumn("Name", System.Type.GetType("System.String")); Rev_Emp.Columns.Add(RevName); DataColumn AppPeriod2 = new DataColumn("AppPeriod", System.Type.GetType("System.String")); Rev_Emp.Columns.Add(AppPeriod2); DataColumn AppStatus2 = new DataColumn("AppStatus", System.Type.GetType("System.String")); Rev_Emp.Columns.Add(AppStatus2); if (query2.Count() != 0) { RevEmployee = query2.ToList(); } else { tabs2.Visible = false; } if (RevEmployee != null) { for (int i = 0; i < RevEmployee.Count; i++) { DataRow row = Rev_Emp.NewRow(); int Id = RevEmployee[i].Emp_Id; row["Emp_Id"] = RevEmployee[i].Emp_Id; row["Name"] = RevEmployee[i].Firstname + "" + RevEmployee[i].Lastname; var appappraisal1 = db.Appraisal_t.Where(m => m.EmpId == Id); Appraisal_t RevAppr = null; if (appappraisal1.Count() != 0) { RevAppr = appappraisal1.Single(); DateTime from = RevAppr.From ?? DateTime.Now; DateTime to = RevAppr.To ?? DateTime.Now; row["AppPeriod"] = from.ToString("dd-MM-yyyy") + " to " + to.ToString("dd-MM-yyyy"); } else { row["AppPeriod"] = DateTime.Now.ToString("dd-MM-yyyy") + " to " + DateTime.Now.AddDays(30).ToString("dd-MM-yyyy"); } if (RevAppr == null) { row["AppStatus"] = "Not Completed"; } else if (RevAppr.Status == 1) { row["AppStatus"] = "partially Completed"; } else if (RevAppr.Status == 2) { row["AppStatus"] = "Completed"; } else if (RevAppr.Status == 3) { row["AppStatus"] = "Appraiser Review Completed"; } else if (RevAppr.Status == 4) { row["AppStatus"] = "Reviewer Review Completed"; } Rev_Emp.Rows.Add(row); Rev_Emp.AcceptChanges(); } RevGrid.DataSource = Rev_Emp; RevGrid.DataBind(); } } } else { Response.Redirect("~/Login.aspx", false); } } catch (Exception ex) { using (PerformanceAppEntities db = new PerformanceAppEntities()) { Log_t log = new Log_t(); log.Error_Message = ex.Message; log.Page = "Dashboard"; log.Method = "Page_Load"; log.Datetime = DateTime.Now; db.Log_t.Add(log); db.SaveChanges(); Response.Redirect("~/Login.aspx", false); } } }
public void Save() { try { Session["Understanding"] = Understanding.Text; Session["Responsibility"] = Responsibility.Text; Session["From"] = FromTextBox.Text; Session["To"] = ToTextBox.Text; using (PerformanceAppEntities db1 = new PerformanceAppEntities()) { Appraisal_t appraisals = new Appraisal_t(); if (appraisal != null) { int empId = emp[0].Emp_Id; appraisals = db1.Appraisal_t.Where(m => m.EmpId == empId).Single(); } else { appraisals.AppId = Guid.NewGuid(); } appraisals.EmpId = emp[0].Emp_Id; //appraisals.EmpProjects = Session["EmpProjectId"] as String; //appraisals.EmpSkills = Empskills; //appraisals.SelfOverall = SelfAssessment0.SelectedValue; //appraisals.AssessorOverAll = AssessorRating0.SelectedValue; //appraisals.FinalOverAll = FinalizedRating.SelectedValue; //appraisals.RecPromotion = RecommendedforPromotion0.Text; //appraisals.NotPromoting = notpromoting0.Text; appraisals.DoAssessment = DateTime.Parse("1753-01-01 00:00:00"); appraisals.DoAssessmentDisc = DateTime.Parse("1753-01-01 00:00:00"); appraisals.DoAssessorCompletion = DateTime.Parse("1753-01-01 00:00:00"); appraisals.DoFinalization = DateTime.Parse("1753-01-01 00:00:00"); appraisals.Understanding = Session["Understanding"] as String; appraisals.Responsibility = Session["Responsibility"] as String; appraisals.From = Convert.ToDateTime(Session["From"] as String); appraisals.To = Convert.ToDateTime(Session["To"] as String); //appraisals.Weightage = Weightage0.Text; if (appraisal == null) { db1.Appraisal_t.Add(appraisals); } db1.SaveChanges(); Session["appraisal"] = appraisals; } } catch (Exception ex) { using (PerformanceAppEntities db = new PerformanceAppEntities()) { Log_t log = new Log_t(); log.Error_Message = ex.Message; log.Page = "PerformanceAppraisal"; log.Method = "Save"; log.Datetime = DateTime.Now; db.Log_t.Add(log); db.SaveChanges(); Response.Redirect("~/Login.aspx", false); } } }
protected void Page_Load(object sender, EventArgs e) { try { emp = Session["Employee"] as List <Employee_t>; Role_t role = new Role_t(); if (emp != null) { if (Session["Type"] != null) { type = Convert.ToInt32(Session["Type"].ToString()); } if (emp[0].PwdReset == 1) { Response.Redirect("~/ResetPassword.aspx", false); } if (!Page.IsPostBack) { if (type == 1 || type == 2) { int empId = Convert.ToInt32(Request.QueryString["EmpId"].ToString()); using (PerformanceAppEntities db = new PerformanceAppEntities()) { Session["Firstname"] = emp[0].Firstname; Session["Lastname"] = emp[0].Lastname; //Getting the Reviewer or the appraiser object backup.. Session["Employee_Bckup"] = Session["Employee"]; emp = db.Employee_t.Where(m => m.Emp_Id == empId).ToList(); Session["Employee"] = emp; } } using (PerformanceAppEntities db = new PerformanceAppEntities()) { if (Session["Type"] != null) { if (type == 1) { FromTextBox.Enabled = false; ToTextBox.Enabled = false; Responsibility.Enabled = false; Understanding.Enabled = false; } else if (type == 2) { FromTextBox.Enabled = false; ToTextBox.Enabled = false; Responsibility.Enabled = false; Understanding.Enabled = false; } else if (type == 0) { } } empId = emp[0].Emp_Id; var query = db.Appraisal_t.Where(m => m.EmpId == empId).ToList(); if (query.Count() != 0) { appraisal = query.Single(); } Guid roleId = emp[0].RoleId ?? Guid.Empty; role = db.Role_t.Where(m => m.RoleId == roleId).Single(); Session["Role"] = role; Role.Text = role.Name; if (appraisal != null) { Session["appraisal"] = appraisal; } } if (appraisal != null) { FromTextBox.Text = appraisal.From.Value.ToString("dd-MM-yyyy"); ToTextBox.Text = appraisal.To.Value.ToString("dd-MM-yyyy"); Responsibility.Text = appraisal.Responsibility; Understanding.Text = appraisal.Understanding; } NameTextBox.Text = emp[0].Firstname + "" + emp[0].Lastname; if (type == 0) { name.Text = emp[0].Firstname + " " + emp[0].Lastname; } else { name.Text = Session["Firstname"].ToString() + " " + Session["Lastname"].ToString(); } DateofJoiningTextBox.Text = emp[0].Dateofjoining.Value.ToString("dd-MM-yyyy"); using (PerformanceAppEntities db1 = new PerformanceAppEntities()) { if (emp[0].Appraiser != null) { int appr = emp[0].Appraiser ?? 0; Employee_t app = db1.Employee_t.Where(m => m.Emp_Id == appr).Single(); AppraiserTextBox.Text = app.Firstname + "" + app.Lastname; } else { AppraiserTextBox.Text = ""; } if (emp[0].Reviewer != null) { int revr = emp[0].Reviewer ?? 0; Employee_t rev = db1.Employee_t.Where(m => m.Emp_Id == revr).Single(); ReviewerTextBox.Text = rev.Firstname + "" + rev.Lastname; } else { ReviewerTextBox.Text = ""; } } if (appraisal == null) { FromTextBox.Text = DateTime.Now.ToString("dd-MM-yyyy"); ToTextBox.Text = DateTime.Now.AddDays(30).ToString("dd-MM-yyyy"); } } } else { Response.Redirect("~/Login.aspx", false); } } catch (Exception ex) { using (PerformanceAppEntities db = new PerformanceAppEntities()) { Log_t log = new Log_t(); log.Error_Message = ex.Message; log.Page = "PerformanceAppraisal"; log.Method = "Page_Load"; log.Datetime = DateTime.Now; db.Log_t.Add(log); db.SaveChanges(); Response.Redirect("~/Login.aspx", false); } } }
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); } } }
public void Save() { try { string EmpProjectId = ""; for (int i = 0; i < ProjectGrid.Rows.Count; i++) { using (PerformanceAppEntities db = new PerformanceAppEntities()) { GridViewRow item = ProjectGrid.Rows[i]; int empId = emp[0].Emp_Id; EmpProject_t pro = new EmpProject_t(); var query = db.EmpProject_t.Where(m => m.EmpId == empId && m.Type == i); if (query.Count() != 0) { pro = query.Single(); } pro.EmpId = emp[0].Emp_Id; DropDownList combo_Self = item.FindControl("SelfRating") as DropDownList; pro.Self_Rating = combo_Self.SelectedValue; TextBox text_Self = item.FindControl("SelfComment") as TextBox; pro.SelfComments = text_Self.Text; DropDownList combo_App = item.FindControl("AppraiserRating") as DropDownList; pro.App_Rating = combo_App.SelectedValue; TextBox text_App = item.FindControl("AppraiserComment") as TextBox; pro.AppComments = text_App.Text; if (query.Count() == 0) { pro.EmpProjId = Guid.NewGuid(); } EmpProjectId += pro.EmpProjId.ToString() + ";"; pro.Type = i; if (query.Count() == 0) { db.EmpProject_t.Add(pro); } db.SaveChanges(); } } Session["EmpProjectId"] = EmpProjectId; { using (PerformanceAppEntities db1 = new PerformanceAppEntities()) { Appraisal_t appraisals = new Appraisal_t(); if (appraisal != null) { int empId = emp[0].Emp_Id; appraisals = db1.Appraisal_t.Where(m => m.EmpId == empId).Single(); } else { appraisals.AppId = Guid.NewGuid(); } appraisals.EmpId = emp[0].Emp_Id; appraisals.EmpProjects = Session["EmpProjectId"] as String; //appraisals.EmpSkills = Empskills; //appraisals.SelfOverall = SelfAssessment0.SelectedValue; //appraisals.AssessorOverAll = AssessorRating0.SelectedValue; //appraisals.FinalOverAll = FinalizedRating.SelectedValue; //appraisals.RecPromotion = RecommendedforPromotion0.Text; //appraisals.NotPromoting = notpromoting0.Text; if (appraisals.DoAssessment == null) { appraisals.DoAssessment = DateTime.Parse("1753-01-01 00:00:00"); } if (appraisals.DoAssessmentDisc == null) { appraisals.DoAssessmentDisc = DateTime.Parse("1753-01-01 00:00:00"); } if (appraisals.DoAssessorCompletion == null) { appraisals.DoAssessorCompletion = DateTime.Parse("1753-01-01 00:00:00"); } if (appraisals.DoFinalization == null) { appraisals.DoFinalization = DateTime.Parse("1753-01-01 00:00:00"); } appraisals.Understanding = Session["Understanding"] as String; appraisals.Responsibility = Session["Responsibility"] as String; appraisals.From = Convert.ToDateTime(Session["From"] as String); appraisals.To = Convert.ToDateTime(Session["To"] as String); appraisals.SkillRevRating = ReviewerRating.SelectedValue; appraisals.SkillRevComment = ReviewerComment.Text; appraisals.ProAppOtherCmnt = OtherTextBox.Text; if (appraisal == null) { db1.Appraisal_t.Add(appraisals); } db1.SaveChanges(); Session["appraisal"] = appraisals; } } } catch (Exception ex) { using (PerformanceAppEntities db = new PerformanceAppEntities()) { Log_t log = new Log_t(); log.Error_Message = ex.Message; log.Page = "PerformanceAppraisal3"; log.Method = "Save"; log.Datetime = DateTime.Now; db.Log_t.Add(log); db.SaveChanges(); Response.Redirect("~/Login.aspx", false); } } }