protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == "") { Response.Redirect("Login.aspx"); } if (!IsPostBack) { try { OHDBLL obll = new OHDBLL(); List <string> Details = new List <string>(); Details = obll.GetProfileDetailsBll(Session["UserName"].ToString()); TxtFirstName.Text = Details[0]; TxtLastName.Text = Details[1]; TxtDOB.Text = Details[2]; TxtAddress.Text = Details[3]; TxtPh.Text = Details[4]; TxtEmail.Text = Details[5]; if (GridView1.Rows.Count == 0) { Label2.Visible = true; } else { Label2.Visible = false; } } catch (Exception exp) { Response.Write(exp.Message); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataSet ds; ds = null; ds = new DataSet(); try { OHDBLL obll = new OHDBLL(); ds = obll.ViewRaisedTicketsBLL(Session["UserName"].ToString()); if (ds.Tables[0].Rows.Count == 0) { Response.Redirect("Errorpage.aspx"); } else { GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } } catch (Exception exp) { Response.Write(exp.Message); } } }
protected void ButtonGetMyPassword_Click(object sender, EventArgs e) { try { OHDBLL obll = new OHDBLL(); DataSet SecA = obll.ForgotPwdBll(TxtUserName.Text); string answer = SecA.Tables[0].Rows[0][1].ToString(); if (txtEnterAnswer.Text == answer) { LabelYourPasswordIs.Visible = true; LabelPasswordDisplay.Visible = true; LabelPasswordDisplay.Text = SecA.Tables[0].Rows[0][2].ToString(); ButtonLoginFromForgotPassword.Visible = true; } else { throw new Exception("Wrong Answer!!!"); } } catch (Exception exp) { MessageBox.Show(exp.Message, "OnlineHelpDesk"); } }
protected void BtnLogin_Click(object sender, EventArgs e) { Session["UserName"] = TxtUserName.Text; try { OHDBLL obll = new OHDBLL(); string role = obll.UserLoginBLL(Session["UserName"].ToString(), TxtPwd.Text); Session["Role"] = role; if (role == "ADM") { Response.Redirect("AdminHome.aspx", false); } else if (role == "FAC" || role == "HOD") { Response.Redirect("FacultyHome.aspx", false); } else if (role == "STU") { Response.Redirect("StudentHome.aspx", false); } } catch (Exception exp) { MessageBox.Show(exp.Message, "OnlineHelpDesk"); // Response.Write(exp.Message,"Online_HelpDesk"); } finally { TxtUserName.Text = ""; TxtPwd.Text = ""; } }
protected void ButtonRegister_Click(object sender, EventArgs e) { string gender; try { OHDBLL obll = new OHDBLL(); string address = TxtStreet.Text + TxtCity.Text + TxtState.Text + Txtcountry.Text + TxtPincode.Text; string deptid; if (RadioButtonListGender.SelectedItem.Text.ToString() == "Male") { gender = "Male"; } else { gender = "Female"; } string Username = obll.RegisterBll(TxtFirstName.Text, TxtLastName.Text, gender, TxtDOB.Text, address, TxtPh.Text, TxtEmail.Text, DropDownListSelectDepartment.SelectedValue.ToString(), TxtDesiredPassword.Text, DropDownListSelectSecurityQn.SelectedValue.ToString(), TxtAnswer.Text); MessageBox.Show("Registration Successfull!!! UserName is " + Username); reset(); } catch (Exception exp) { MessageBox.Show(exp.Message, "OnlineHelpDesk"); } }
public void ds() { DataSet ds; ds = null; ds = new DataSet(); try { OHDBLL obll = new OHDBLL(); ds = obll.ViewTicketsToAssignBLL(Session["UserName"].ToString()); if (ds.Tables[0].Rows.Count == 0) { Response.Redirect("Errorpage.aspx"); } else { GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } } catch (Exception exp) { Response.Write(exp.Message); } }
protected void ButtonCloseTicket_Click(object sender, EventArgs e) { bool flag = false; try { if (GridView1.Rows.Count == 0) { Response.Redirect("Errorpage.aspx"); } else { if (TextBoxReason0.Text == "") { Response.Write("<script>alert('Please give a reason to close')</script>"); ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Please give a reason to close the ticket')", true); } else { OHDBLL obll = new OHDBLL(); foreach (GridViewRow gr in GridView1.Rows) { CheckBox cb = (CheckBox)gr.Cells[0].FindControl("chk"); if (cb.Checked == true) { flag = true; string ReqID = gr.Cells[1].Text.ToString(); obll.UpdatestatusBll(TextBoxReason0.Text, ReqID, "Closed"); } } if (flag == false) { Response.Write("<script>alert('Please select a row')</script>"); ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Please select a row')", true); } else { Response.Write("<script>alert('Ticket Closed')</script>"); Response.Write("<script>"); Response.Write("window.close()"); Response.Write("</script>"); ds(); } } } } catch (Exception exp) { Response.Write(exp.Message); } }
protected void ButtonUpdate_Click(object sender, EventArgs e) { try { OHDBLL obll = new OHDBLL(); obll.UpdateProfilebll(Session["UserName"].ToString(), TxtFirstName.Text, TxtLastName.Text, TxtDOB.Text, TxtAddress.Text, TxtPh.Text, TxtEmail.Text); Response.Write("<script>alert('Profile Updated Successfully')</script>"); } catch (Exception exp) { Response.Write(exp.Message); } ButtonUpdate.Visible = false; ButtonClear.Visible = false; }
//protected void ButtonCloseTicket_Click(object sender, EventArgs e) //{ // bool flag = false; // try // { // if (GridView1.Rows.Count == 0) // { // ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('No Ticket Assigned')", true); // } // else // { // OHDBLL obll = new OHDBLL(); // foreach (GridViewRow gr in GridView1.Rows) // { // CheckBox cb = (CheckBox)gr.Cells[0].FindControl("chk"); // if (cb.Checked == true) // { // flag = true; // string ReqID = gr.Cells[1].Text.ToString(); // obll.UpdatestatusBll(TextBoxReason0.Text, ReqID, "Closed"); // } // } // if (flag == false) // { // ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Please select a row')", true); // } // else // { // Response.Write("<script>alert('Ticket Closed')</script>"); // Response.Write("<script>"); // Response.Write("window.close()"); // Response.Write("</script>"); // } // } // } // catch (Exception exp) // { // Response.Write(exp.Message); // } // ds(); //} protected void ButtonAccept_Click(object sender, EventArgs e) { bool flag = false; try { if (GridView1.Rows.Count == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('No Ticket Assigned')", true); } else { OHDBLL obll = new OHDBLL(); foreach (GridViewRow gr in GridView1.Rows) { CheckBox cb = (CheckBox)gr.Cells[0].FindControl("chk"); if (cb.Checked == true) { flag = true; string ReqID = gr.Cells[1].Text.ToString(); obll.UpdatestatusBll("Work in Progress", ReqID, "Accepted"); } } if (flag == false) { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Please select a row')", true); } else { Response.Write("<script>alert('Ticket Accepted')</script>"); Response.Write("<script>"); Response.Write("window.close()"); Response.Write("</script>"); } } } catch (Exception exp) { Response.Write(exp.Message); } ds(); }
protected void ButtonSubmit_Click(object sender, EventArgs e) { try { OHDBLL obll = new OHDBLL(); obll.ChangePasswordBll(Session["UserName"].ToString(), TextBox1.Text, TextBox2.Text); Response.Write("<script>alert('Password Changed Successfully')</script>"); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; } catch (Exception exp) { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('" + exp.Message + "')", true); } }
public void ds() { DataSet ds; ds = null; ds = new DataSet(); try { OHDBLL obll = new OHDBLL(); ds = obll.ViewAssignedTicketsBLL(Session["UserName"].ToString()); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } catch (Exception exp) { Response.Write(exp.Message); } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { try { OHDBLL obll = new OHDBLL(); obll.RaiseTicketBLL(DropDownList1.SelectedValue.ToString(), TxtDescription.Text, DropDownListSelectDepartment.SelectedValue.ToString(), DropDownListClassName.SelectedValue.ToString(), TxtEmail.Text, TxtMobile.Text, Session["UserName"].ToString()); MessageBox.Show("Ticket Raised Successfully"); Response.Write("<script>"); Response.Write("window.close()"); Response.Write("</script>"); } catch (Exception exp) { MessageBox.Show(exp.Message, "OnlineHelpDesk"); } finally { } }
protected void ButtonUpdate_Click(object sender, EventArgs e) { try { OHDBLL obll = new OHDBLL(); obll.UpdateProfilebll(Session["UserName"].ToString(), TxtFirstName.Text, TxtLastName.Text, TxtDOB.Text, TxtAddress.Text, TxtPh.Text, TxtEmail.Text); Response.Write("<script>alert('Profile Updated Successfully')</script>"); ButtonUpdate.Visible = false; ButtonClear.Visible = false; TxtFirstName.ReadOnly = true; TxtLastName.ReadOnly = true; TxtDOB.ReadOnly = true; TxtAddress.ReadOnly = true; TxtPh.ReadOnly = true; TxtEmail.ReadOnly = true; } catch (Exception exp) { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('" + exp.Message + "')", true); } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { try { OHDBLL obll = new OHDBLL(); DataSet SecQ = obll.ForgotPwdBll(TxtUserName.Text); LabelSecurityQuestionDisplay.Text = SecQ.Tables[0].Rows[0][0].ToString(); LabelYourSecurityQuestion.Visible = true; LabelSecurityQuestionDisplay.Visible = true; LabelEnterYourAnswer.Visible = true; txtEnterAnswer.Visible = true; ButtonGetMyPassword.Visible = true; } catch (Exception exp) { MessageBox.Show(exp.Message, "OnlineHelpDesk"); // Response.Write(exp.Message,"Online_HelpDesk"); } finally { } }
protected void Button1_Click(object sender, EventArgs e) { bool flag = false; try { if (GridView1.Rows.Count == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('No Pending Tickets')", true); } else { if (DropDownListName.SelectedItem == null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Select an Assignee')", true); } else { string Username = DropDownListName.SelectedValue.ToString(); OHDBLL obll = new OHDBLL(); foreach (GridViewRow gr in GridView1.Rows) { CheckBox cb = (CheckBox)gr.Cells[0].FindControl("chk"); if (cb.Checked == true) { flag = true; string ReqID = gr.Cells[1].Text.ToString(); obll.AssignTicketBll(Session["Username"].ToString(), Username, "Ticket Assigned!!!", ReqID, "Assigned"); } } if (flag == false) { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Please select a row')", true); } else { Response.Write("<script>alert('Tickets assigned successfully')</script>"); Response.Write("<script>"); Response.Write("window.close()"); Response.Write("</script>"); } } } } catch (Exception exp) { Response.Write(exp.Message); } ds1(); }
protected void DropDownListtype_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownListtype.SelectedItem.Text == "Administrator") { DropDownListName.Items.Clear(); DataSet ds = new DataSet(); OHDBLL obll = new OHDBLL(); try { ds = obll.GetAdminlistBLL(Session["UserName"].ToString()); for (int index = 0; index < ds.Tables[0].Rows.Count; index++) { DropDownListName.Items.Add(ds.Tables[0].Rows[index][0].ToString()); } } catch (Exception exp) { Response.Write(exp.Message); } finally { } } else if (DropDownListtype.SelectedItem.Text == "HOD") { DropDownListName.Items.Clear(); DataSet ds = new DataSet(); OHDBLL obll = new OHDBLL(); try { ds = obll.GetHODlistBLL(); for (int index = 0; index < ds.Tables[0].Rows.Count; index++) { DropDownListName.Items.Add(ds.Tables[0].Rows[index][0].ToString()); } } catch (Exception exp) { Response.Write(exp.Message); } } else if (DropDownListtype.SelectedItem.Text == "Faculty") { DropDownListName.Items.Clear(); DataSet ds = new DataSet(); OHDBLL obll = new OHDBLL(); try { ds = obll.GetFaclistBLL(Session["UserName"].ToString()); for (int index = 0; index < ds.Tables[0].Rows.Count; index++) { DropDownListName.Items.Add(ds.Tables[0].Rows[index][0].ToString()); } } catch (Exception exp) { Response.Write(exp.Message); } } }