protected void Display_Click(object sender, EventArgs e) { string name = Session["LoginName"].ToString(); staffinfo stf = dbmanager.GetLoginUserId(name); string sectionid = stf.Section; int questionID = ddlSelectQuestion.SelectedIndex; populateChartFunctionViaSection(sectionid, questionID); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dtReg = new DataTable(); staffinfo sObj = new staffinfo(); dtReg = sObj.ExecuteSelectQueries(); if (dtReg.Rows.Count > 0) { staffinfo.DataSource = dtReg; staffinfo.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["LoginName"] != null) { try { System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(Server.MapPath("Charts/")); Empty(directory); } catch { } string name = Session["LoginName"].ToString(); if (name != null) { staffinfo stf = dbmanager.GetLoginUserId(name); if (stf != null) { string role = stf.Role; Session["UserID"] = stf.Uid; Session["Name"] = stf.Name; Session["Role"] = stf.Role; if (role == "Admin") { Response.Redirect("~/Adminmain.aspx"); } else { Response.Redirect("~/Staffmain.aspx"); } } else { Response.Redirect("~/accessdenied.aspx"); } } else { Response.Redirect("~/accessdenied.aspx"); } } else { Response.Redirect("LoginPage.aspx?timeout"); } }
protected void ConfirmBtn_Click(object sender, EventArgs e) { staffinfo stf = (staffinfo)Session["Staff"]; bool result = dbmanager.InsertStaffInformation(stf); string password = CreateRandomPassword(8); string hashpassw = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "sha1"); bool result2 = dbmanager.InsertUserIDandPassw(stf.Uid, hashpassw); if (result == true && result2 == true) { bool sentemail = email.SendMail("Thank you for using the 360° leadership system." + Environment.NewLine + Environment.NewLine + "Your new password for login to the system is: " + password + "" + Environment.NewLine + Environment.NewLine + "You are advised to change your password once you have logged in." + Environment.NewLine + "For login, please visit: " + "http://ascapps.tp.edu.sg/360Leadership/LoginPage.aspx" + Environment.NewLine + Environment.NewLine + "For any enquiries to the system, please contact asc webmaster or (x5376)", stf.Uid + "@tp.edu.sg", "360° Leadership System New Password"); if (sentemail == true) { MessageBoxShow("User added successfully."); } } else { MessageBoxShow("Fail to add."); } }
protected void BindDropDownListOfficer() { try { string uid = Session["UserID"].ToString(); staffinfo stfinfo = dbmanager.GetStaffDetailsViaUid(uid); ArrayList listofquestion = dbmanager.GetAllQuestionList(); if (listofquestion.Count > 0) { listofquestion.Insert(0, "<--------All question(s)------->"); ddlSelectQuestion.DataSource = listofquestion; ddlSelectQuestion.DataBind(); } else { MessageBoxShow("Error reading data from database."); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private ArrayList ReadListOfDataFromCSVStaffInfo(DataTable listofStaffInformation) { ArrayList listofStaff = new ArrayList(); try { int emptyvalue = 0; int invalidrelation = 0; int invaliddataformat = 0; StringBuilder SqlQuery = new StringBuilder(); SqlQuery.Append(""); if (listofStaffInformation.Rows.Count != 0) { foreach (DataRow dr in listofStaffInformation.Rows) { if (dr["UserID"].ToString() != "") { string designationstring = ""; bool checksec = false; string staffname = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(dr["Name"].ToString().Trim()); string designation = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(dr["Designation"].ToString().Trim()); string[] designarray = designation.Split('/'); if (designarray.LongLength > 0) { int counter = 0; foreach (string de in designarray) { if (de != "") { if (counter > 0) { designationstring += "/" + CultureInfo.CurrentCulture.TextInfo.ToTitleCase(de.Trim()); } else { designationstring += CultureInfo.CurrentCulture.TextInfo.ToTitleCase(de.Trim()); } counter++; } } } else { designationstring = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(designation); } string section = dr["Section"].ToString().ToUpper().Trim(); string sectionstring = ""; string[] secinfo = section.Split(','); string[] secarray = RemoveDuplicates(secinfo); int countstring = 0; foreach (string se in secarray) { if (se != "") { checksec = dbmanager.CheckSectionExist(se.Trim()); if (checksec == true) { if (countstring > 0) { sectionstring += "," + se.Trim(); } else { sectionstring += se.Trim(); } countstring++; } if (checksec == false) { break; } } } string function = dr["Functions"].ToString().Trim(); bool checkfunc = dbmanager.CheckFunctionExist(function); string staffuid = dr["UserID"].ToString().ToLower().Trim(); string role = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(dr["Role"].ToString().Trim()); bool checkrole = dbmanager.CheckRoleExist(role); if (staffname != "" && staffuid != "" && checksec == true && checkfunc == true && checkrole == true) { if (sectionstring.Contains("ALL")) { sectionstring = "ALL"; } staffinfo staffinfo = new staffinfo(staffname, designationstring, sectionstring, function, staffuid, role); listofStaff.Add(staffinfo); } else if (checksec == false || checkfunc == false || checkrole == false) { invalidrelation++; } if (staffname.Length > 100 || staffuid.Length > 30) { invaliddataformat++; } } else { emptyvalue++; } } if (invalidrelation > 0) { listofStaff.Clear(); MessageBoxShow(invalidrelation + " record(s) found with invalid data. might need relation data from other tables."); } if (invaliddataformat > 0) { listofStaff.Clear(); MessageBoxShow(invaliddataformat + " record(s) found with invalid data format."); } if (emptyvalue > 0) { listofStaff.Clear(); MessageBoxShow(emptyvalue + " record(s) found with empty data field."); } } else { StaffErrorMsgLbl.ForeColor = System.Drawing.Color.Red; StaffErrorMsgLbl.Text = "Fail to read file."; } } catch { StaffErrorMsgLbl.ForeColor = System.Drawing.Color.Red; StaffErrorMsgLbl.Text = "Invalid data format found."; } return(listofStaff); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["Role"] != null) { string role = Session["Role"].ToString(); if (role != "Admin") { Response.Redirect("accessdenied.aspx"); } else { int count = dbmanager.CheckNotCompletedAppraisal(); if (count != 0) { #region populate result string content = ""; content += "<table width='95%' border='0' style=padding-left:10px><tr><td>"; content += "<table width='100%' border='1' style='border-color:#000080' cellspacing='0'><tr style='border-color:#000080'><td style='border-color:#000080'>"; content += "<b>Total number of staffs who have not completed the peer evaluation: " + count + "</b>"; content += "</td></tr></table><br>"; ArrayList listofFunction = dbmanager.GetDistinctFunctions(); foreach (string funct in listofFunction) { ArrayList listofCompleted = dbmanager.GetDistinctNameUidCompletedAppraisal(funct); if (listofCompleted.Count != 0) { #region function by function content += "<b><font color='blue'>" + funct + "</font></b>"; content += "<table width='60%' border='1' style='border-color:#000080' cellspacing='0'>"; content += "<tr style='border-color:#000080' align='center'>"; content += "<td style='border-color:#000080' width='40%'><b>Name</b></td><td style='border-color:#000080' width='20%'><b>User ID</b></td>" + "<td style='border-color:#000080' width='30%'><b>Section<></b/td></tr>"; content += "<tr style='border-color:#000080' align='center'>"; foreach (staffappraisal stfapp in listofCompleted) { string staffname = dbmanager.GetNameViaUserID(stfapp.Uid); staffinfo stf = dbmanager.GetStaffDetailsViaUid(stfapp.Uid); content += "<td width='40%' align='left' style='border-color:#000080'>" + staffname + "</td>"; content += "<td width='20%' align='left' style='border-color:#000080'>" + stfapp.Uid.ToString() + "</td>"; content += "<td width='30%' align='left' style='border-color:#000080'>" + stf.Section.ToString() + "</td>"; content += "</tr>"; } content += "</table><br>"; #endregion } } //content += "</td></tr></table>"; lblStaffSummary.Text += content; #endregion } else { Response.Redirect("default.aspx"); } } } else { Response.Redirect("accessdenied.aspx"); } } }
protected void NextBtn_Click(object sender, EventArgs e) { ArrayList listofSectionItems = new ArrayList(); bool chkresult = true; string name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(NameTbx.Text.Trim()); string uid = UserIdTbx.Text.ToLower().Trim(); string sect = ""; int count = 1; foreach (ListItem listItem in listSection.Items) { if (listItem.Selected == true) { listofSectionItems.Add(listItem.Text); } } foreach (string s in listofSectionItems) { if (count == listofSectionItems.Count) { sect += s; } else { sect += s + ","; } count++; } if (chkresult == true) { lblValidatorSection.Text = ""; string[] design = designationTbx.Text.Trim().Split('/'); string designation = ""; if (design.LongLength > 0) { int counter = 0; foreach (string de in design) { if (de != "") { if (counter > 0) { designation += "/" + CultureInfo.CurrentCulture.TextInfo.ToTitleCase(de.Trim()); } else { designation += CultureInfo.CurrentCulture.TextInfo.ToTitleCase(de.Trim()); } counter++; } } } else { designation = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(designationTbx.Text.Trim()); } string funct = ddlFunction.Text; string role = ddlRole.Text; staffinfo stf = null; if (name != "" && uid != "" && sect != "") { bool chk = dbmanager.CheckUserIDExist(uid); if (sect.Contains("ALL")) { sect = "ALL"; } if (chk == false) { stf = new staffinfo(name, designation, sect, funct, uid, role); Session["Staff"] = stf; mainView.ActiveViewIndex = 1; InformationLbl.Text = "Please preview what you have selected. If the information is incorrect, click 'Back' to re-select."; string summary = ""; summary += "<table><tr><td><b>New system user information<b></td></tr></table>"; summary += "<table>"; summary += "<tr><td>Name:</td><td>" + name + "</td></tr>"; summary += "<tr><td>Designation:</td><td>" + designation + "</td></tr>"; summary += "<tr><td>Section:</td><td>" + sect.Replace(';', ',') + "</td></tr>"; summary += "<tr><td>Function:</td><td>" + funct + "</td></tr>"; summary += "<tr><td>User ID:</td><td>" + uid + "</td></tr>"; summary += "<tr><td>Role:</td><td>" + role + "</td></tr>"; summary += "</table>"; SummaryLbl.Text = summary; } else { lblValidatorUserId.ForeColor = System.Drawing.Color.Red; lblValidatorUserId.Text = "Id already exist. Please enter another id."; } } } }
protected void UpdateBtn_Click(object sender, EventArgs e) { try { #region update fields try { bool chkresult = true; int count = 1; string sect = ""; ArrayList listofSectionItem = new ArrayList(); for (int i = 0; i < listSection.Items.Count; i++) { if (listSection.Items[i].Selected == true) { listofSectionItem.Add(listSection.Items[i].Text); } } foreach (string s in listofSectionItem) { if (count == listofSectionItem.Count) { sect += s; } else { sect += s + ","; } count++; } if (listofSectionItem.Count == 0) { MessageBoxShowWithOutRedirect("Please select at least one section."); chkresult = false; } if (chkresult == true) { if (sect.Contains("ALL")) { sect = "ALL"; } string name = lblStaffName.Text; string designation = tbxStaffDesignation.Text; string function = ddlFunction.Text; string role = ddlRole.Text; string uid = lblUid.Text; staffinfo stf = new staffinfo(name, designation, sect, function, uid, role); bool result = dbmanager.UpdateUserInformation(stf); { if (result == true) { MessageBoxShow("Updated successfully."); } else { MessageBoxShow("Fail to update."); } } } } catch (Exception ex) { MessageBoxShow(ex.Message); } #endregion } catch (Exception ex) { MessageBoxShow(ex.Message); } }
//public static string status; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Response.Clear(); if (Session["Role"] != null) { string role = Session["Role"].ToString(); if (role == "Admin") { Response.Redirect("accessdenied.aspx"); } else { Session["Submitted"] = null; Session["HomeClicked"] = true; string uid = Session["UserID"].ToString(); string username = Session["Name"].ToString(); if (role == "Officer") { ArrayList listofsec = new ArrayList(); bool checkifappraisalsec = false; ManageAppraisalPanel.Visible = true; staffinfo stfinfo = dbmanager.GetStaffDetailsViaUid(uid); if (stfinfo.Section != "ALL") { string[] arraysec = stfinfo.Section.Split(','); foreach (string sec in arraysec) { if (sec != "") { listofsec.Add(sec); } } checkifappraisalsec = dbmanager.CheckIfExistSection(listofsec); } else { checkifappraisalsec = dbmanager.CountAllAppraisal(); } if (checkifappraisalsec == true) { ViewIndividualAllLbl.Text = "To view by section or individual staff report, click "; } else { ViewIndividualAllLbl.Text = "No staff evaluation of the same section is <b>found<b>"; ViewIndividualAllLink.Visible = false; } bool checkapp = dbmanager.CountAllAppraisal(); if (checkapp == true) { ViewAppraisalChart.Text = "To view peer evaluation chart, click "; ViewAppraisalChartLink.Visible = true; } else { ViewAppraisalChart.Text = "No chart is <b>found<b> "; ViewAppraisalChartLink.Visible = false; } } else { ManageAppraisalPanel.Visible = false; } //staffName.Text = username; //if appriasal submitted bool result = dbmanager.CheckIfAppraisalSubmitted(uid); //if appraisal started Systemtime st = dbmanager.GetSystemTime(); DateTime today = DateTime.Today; if (st != null) { int zzp = datediff.dateDiff(st.Enddate); Session["EndTime"] = st.Enddate; if (st.Startdate > today) { SubmitAppraisalLbl.Text = "System period <b>is closed<b>"; SubmitLink.Visible = false; } else if (zzp <= (-1)) { SubmitAppraisalLbl.Text = "System period <b>is closed<b>"; SubmitLink.Visible = false; } else if (result == true) { Session["Submitted"] = true; SubmitAppraisalLbl.Text = "Your evaluation has been <b>submitted<b>"; SubmitLink.Visible = false; } else { Session["Submitted"] = null; SubmitAppraisalLbl.Text = "To start peer evaluation, click "; SubmitLink.Visible = true; } } else { SubmitLink.Visible = false; } int countapp = dbmanager.GetCountYourAppraisal(uid); if (countapp != 0) { //if appraisal submitted //ViewAppraisalLbl.Text = "To view own evaluation report, click "; ViewAppraisalLbl.Text = "To view own evaluation report, click here"; ViewAppraisalLink.Visible = false; } else { ViewAppraisalLbl.Text = "You have 0 evaluation(s) <b>received<b>"; ViewAppraisalLink.Visible = false; } } } else { Response.Redirect("accessdenied.aspx"); } //ViewAppraisalLbl.Visible = false; //ViewAppraisalLink.Visible = false; } }
protected void btnSave_Click(object sender, EventArgs e) { DataTable dtReg = new DataTable(); staffinfo sObj = new staffinfo(); }
protected void BindDropDownListOfficer() { try { string uid = Session["UserID"].ToString(); staffinfo stfinfo = dbmanager.GetStaffDetailsViaUid(uid); //if director if (stfinfo.Section == "ALL") { ArrayList listofsection = RemoveDups(dbmanager.GetAllSectionnByLimit()); ArrayList listoffunction = dbmanager.GetAllFunctionByLimit(); ArrayList listofquestion = dbmanager.GetAllQuestionList(); ArrayList listofselectfunction = new ArrayList(); ArrayList listofselectsection = new ArrayList(); if (listoffunction.Count > 0 && listofsection.Count > 0 && listofquestion.Count > 0) { listofsection.Insert(0, "<----Please select one---->"); listofsection.Insert(1, "<--------ASC School-------->"); ddlSelectSection.DataSource = listofsection; ddlSelectSection.DataBind(); //for ddlselectQuestion listofquestion.Insert(0, "<--------All question(s)------->"); ddlSelectQuestion.DataSource = listofquestion; ddlSelectQuestion.DataBind(); listofselectfunction.Insert(0, "<--------Autoupdate-------->"); ddlFilterFunction.DataSource = listofselectfunction; ddlFilterFunction.DataBind(); listoffunction.Insert(0, "<----Please select one---->"); listoffunction.Insert(1, "<--------ASC School-------->"); ddlSelectFunction.DataSource = listoffunction; ddlSelectFunction.DataBind(); listofselectsection.Insert(0, "<--------Autoupdate-------->"); ddlFilterBySection.DataSource = listofselectsection; ddlFilterBySection.DataBind(); SearchPanelFunctionViaSection.Visible = false; } else { MessageBoxShow("Error reading data from database."); } } else { ArrayList listofsection = new ArrayList(); string[] arraysection = stfinfo.Section.Split(','); if (arraysection.LongLength > 0) { foreach (string sect in arraysection) { listofsection.Add(sect); } } ArrayList listoffunction = RemoveDups(dbmanager.GetAllFunctionByLimitViaOfficer(stfinfo.Section)); ArrayList listofquestion = dbmanager.GetAllQuestionList(); ArrayList listofselectfunction = new ArrayList(); ArrayList listofselectsection = new ArrayList(); if (listoffunction.Count > 0 && listofsection.Count > 0 && listofquestion.Count > 0) { listofsection.Insert(0, "<----Please select one---->"); ddlSelectSection.DataSource = listofsection; ddlSelectSection.DataBind(); // for ddlselectQuestion listofquestion.Insert(0, "<--------All question(s)------->"); ddlSelectQuestion.DataSource = listofquestion; ddlSelectQuestion.DataBind(); listofselectfunction.Insert(0, "<--------Autoupdate-------->"); ddlFilterFunction.DataSource = listofselectfunction; ddlFilterFunction.DataBind(); listoffunction.Insert(0, "<----Please select one---->"); ddlSelectFunction.DataSource = listoffunction; ddlSelectFunction.DataBind(); listofselectsection.Insert(0, "<--------Autoupdate-------->"); ddlFilterBySection.DataSource = listofselectsection; ddlFilterBySection.DataBind(); SearchPanelFunctionViaSection.Visible = false; } else { MessageBoxShow("Error reading data from database."); } } } catch { } }