protected void Page_Load(object sender, EventArgs e)
        {
            lbl.Text = "";
            if (!Page.IsPostBack)
            {
                if (Session["SID"] != null)
                {
                    DataRow StaffDT = StaffMst.GetDataByKey(int.Parse(Session["SID"].ToString()));


                    if (StaffDT != null && StaffDT["StdId"].ToString() != "")
                    {
                        lbl_standard.Text = StaffDT["StdName"].ToString();
                        BindDiv(int.Parse(StaffDT["StdId"].ToString()));
                        BindExam();
                        // BindGridiv();
                    }

                    if (!string.IsNullOrEmpty(Request.QueryString["ResultId"]))
                    {
                        string id = Request.QueryString["ResultId"];
                        loaddata(int.Parse(id));
                    }
                }
            }
        }
예제 #2
0
 private void loaddata(int id)
 {
     try
     {
         DataRow dr = StaffMst.GetDataByKey(id);
         if (dr != null)
         {
             txtadd.Text    = dr["Add"].ToString();
             txtcity.Text   = dr["Name"].ToString();
             txtemail.Text  = dr["Email"].ToString();
             txtmobile.Text = dr["Mobile"].ToString();
             txtname.Text   = dr["Name"].ToString();
             txtpin.Text    = dr["Pincode"].ToString();
             txtqual.Text   = dr["Qualification"].ToString();
             txtuname.Text  = dr["Uname"].ToString();
             if (!string.IsNullOrEmpty(dr["StdId"].ToString()))
             {
                 drpstd.SelectedValue = dr["StdId"].ToString();
             }
             DropDownList1.SelectedItem.Text = dr["Gender"].ToString();
             StaffId     = id;
             btnadd.Text = "Update";
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #3
0
        protected void btnchangepass_Click(object sender, EventArgs e)
        {
            // DataTable StaffDT = StaffMst.Select_Current_Pass(txtcurrent.Text, Session["uname"].ToString());

            DataRow StaffDr = StaffMst.GetNameandPassword(Session["uname"].ToString(), txtcurrent.Text);

            if (StaffDr != null)
            {
                StaffMst staffmst = new StaffMst();
                staffmst.SID           = Convert.ToInt32(StaffDr["SID"].ToString());
                staffmst.StdName       = StaffDr["StdName"].ToString();
                staffmst.Qualification = StaffDr["StdName"].ToString();
                staffmst.Pass          = txtnewpass.Text;
                staffmst.Name          = StaffDr["Name"].ToString();
                staffmst.Mobile        = StaffDr["Mobile"].ToString();
                staffmst.Image         = StaffDr["Image"].ToString();
                staffmst.Pincode       = StaffDr["PinCode"].ToString();
                staffmst.Uname         = StaffDr["Uname"].ToString();
                staffmst.UpdateDataByKey();
                lbl.Text = "Password Changed";
            }
            else
            {
                lbl.Text = "Invalid Current Pass";
            }
        }
        protected void GvStaff_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            StaffMst.Delete(Convert.ToInt32(GvStaff.DataKeys[e.RowIndex].Value));
            DataTable StaffDT = StaffMst.GetAllActiveData();

            GvStaff.DataSource = StaffDT;
            GvStaff.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataTable StaffDT = StaffMst.GetAllActiveData();
         GvStaff.DataSource = StaffDT;
         GvStaff.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         DataTable StaffDT = StaffMst.GetAllActiveData();
         GvStaff.DataSource = StaffDT;
         GvStaff.DataBind();
         lblstaff.Text = GvStaff.Rows.Count.ToString();
     }
 }
        protected void btnstafflogin_Click(object sender, EventArgs e)
        {
            DataRow StaffDr = StaffMst.StaffLogin(txtstaffuname.Text, txtstaffpass.Text);

            if (StaffDr != null)
            {
                Session["uname"] = txtstaffuname.Text;
                Session["SID"]   = StaffDr["SID"].ToString();
                Response.Redirect("Staff/Default.aspx");
            }
            else
            {
                lblstafferror.Text = "Login Error !!";
            }
        }
예제 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         if (Session["SID"] != null)
         {
             DataRow staffsr = StaffMst.GetDataByKey(int.Parse(Session["SID"].ToString()));
             if (staffsr != null)
             {
                 Image4.ImageUrl = staffsr["Image"].ToString();
                 Label1.Text     = "Welcome " + staffsr["name"].ToString();
                 Session["std"]  = staffsr["stdname"].ToString();
             }
         }
     }
 }
        protected void GvStudent_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            // StudentMst.Delete(Convert.ToInt32(GvwResult.DataKeys[e.RowIndex].Value));
            if (Session["SID"] != null)
            {
                DataRow StaffDT = StaffMst.GetDataByKey(int.Parse(Session["SID"].ToString()));


                if (StaffDT != null && StaffDT["StdId"].ToString() != "")
                {
                    DataTable Student_dt = StudentResult.GetAllResultDataByStId(int.Parse(StaffDT["StdId"].ToString()));
                    GvwResult.DataSource = Student_dt;
                    GvwResult.DataBind();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                if (Session["SID"] != null)
                {
                    DataRow StaffDT = StaffMst.GetDataByKey(int.Parse(Session["SID"].ToString()));


                    if (StaffDT != null && StaffDT["StdId"].ToString() != "")
                    {
                        DataTable Student_dt = StudentResult.GetAllResultDataByStId(int.Parse(StaffDT["StdId"].ToString()));
                        GvwResult.DataSource = Student_dt;
                        GvwResult.DataBind();
                    }
                }
                BindExam();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DataRow staffdr = StaffMst.GetDataByKey(int.Parse(Session["SID"].ToString()));
         if (staffdr != null)
         {
             lblname.Text        = staffdr["Name"].ToString();
             lblstd.Text         = staffdr["stdname"].ToString();
             txtemail.Text       = staffdr["email"].ToString();
             txtmobile.Text      = staffdr["mobile"].ToString();
             txtadd.Text         = staffdr["add"].ToString();
             txtcity.Text        = staffdr["city"].ToString();
             txtpin.Text         = staffdr["pincode"].ToString();
             Imgprofile.ImageUrl = staffdr["image"].ToString();
             ViewState["sid"]    = staffdr["SID"].ToString();
         }
     }
 }
예제 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //  lblatt.Text = "";
     // lblcnt.Text = "";
     if (Page.IsPostBack == false)
     {
         DataRow staffdr = StaffMst.GetDataByKey(int.Parse(Session["SID"].ToString()));
         if (staffdr != null)
         {
             //StdDT = StdAdapter.SelectStd();
             //drpstd.DataSource = StdDT;
             //drpstd.DataTextField = "STDName";
             //drpstd.DataValueField = "SID";
             //drpstd.DataBind();
             //  drpstd.Items.Insert(0, "SELECT");
             BindStandard(int.Parse(staffdr["StdId"].ToString()));
             lblstd.Text = staffdr["StdName"].ToString();
         }
     }
 }
예제 #13
0
        protected void Bindgridview(string status)
        {
            try
            {
                if (Session["SID"] != null)
                {
                    int staffId = int.Parse(Session["SID"].ToString());

                    DataRow drstaff = StaffMst.GetDataByKey(staffId);
                    if (drstaff != null)
                    {
                        DataTable LeaveDT = LeaveMst.GetAllDataRecordByStId(status, int.Parse(drstaff["StdId"].ToString()));
                        GridView3.DataSource = LeaveDT;
                        GridView3.DataBind();
                    }
                }
            }
            catch
            {
            }
        }
        protected void bindgrid()
        {
            try
            {
                if (Session["SID"] != null)
                {
                    int staffId = int.Parse(Session["SID"].ToString());

                    DataRow drstaff = StaffMst.GetDataByKey(staffId);
                    if (drstaff != null)
                    {
                        DataTable compdt = Complainmst.GetAllDataRecordByStId("", int.Parse(drstaff["StdId"].ToString()));
                        GridView1.DataSource = compdt;
                        GridView1.DataBind();
                        lblcomplain.Text = GridView1.Rows.Count.ToString();
                    }
                }
            }
            catch
            {
            }
        }
        protected void btnupdate_Click(object sender, EventArgs e)
        {
            try
            {
                StaffMst staff = new StaffMst(Convert.ToInt32(ViewState["sid"].ToString()));
                /// staff.SID = Convert.ToInt32(ViewState["sid"].ToString());
                staff.StdName = txtadd.Text;
                staff.Email   = txtemail.Text;
                staff.Mobile  = txtmobile.Text;
                staff.Image   = Imgprofile.ImageUrl.ToString();
                staff.Pincode = txtpin.Text;
                staff.City    = txtcity.Text;

                staff.UpdateDataByKey();
                Response.Redirect("/Staff/Default.aspx", false);
            }
            catch (Exception ex)
            {
                lblcnt.Text = "Fail to update profile";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
            }
        }
        protected void btnsarch_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow StaffDT = StaffMst.GetDataByKey(int.Parse(Session["SID"].ToString()));

                DataTable Student_dt = null;
                if (StaffDT != null && StaffDT["StdId"].ToString() != "")
                {
                    DataTable StuDT = StudentResult.GetAllResultDataByStId(int.Parse(StaffDT["StdId"].ToString()));
                    if (StuDT != null)
                    {
                        try
                        {
                            Student_dt = StuDT.Select("ExamId= " + drpExam.SelectedValue).CopyToDataTable();

                            if (Student_dt != null && Student_dt.Rows.Count > 0)
                            {
                                GvwResult.DataSource = Student_dt;
                                GvwResult.DataBind();
                            }
                        }
                        catch
                        {
                            GvwResult.DataSource = Student_dt;
                            GvwResult.DataBind();
                        }
                    }
                }
            }
            catch
            {
            }

            //else
            //{
            //    //MultiView1.ActiveViewIndex = -1;
            //}
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                if (Session["SID"] != null)
                {
                    DataRow StaffDT = StaffMst.GetDataByKey(int.Parse(Session["SID"].ToString()));


                    if (StaffDT != null && StaffDT["StdId"].ToString() != "")
                    {
                        DataTable DivDT = DivMst.GetDataByStandardId(int.Parse(StaffDT["StdId"].ToString()));
                        lblstd.Text           = StaffDT["StdName"].ToString();
                        drpdiv.DataSource     = DivDT;
                        drpdiv.DataTextField  = "DivName";
                        drpdiv.DataValueField = "DID";
                        drpdiv.DataBind();
                        drpdiv.Items.Insert(0, "SELECT");
                        drpstudent.Items.Insert(0, "SELECT");
                    }
                }
            }
        }
예제 #18
0
        protected void btnadd_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable StaffDT = StaffMst.Select_UNAME(txtuname.Text);
                if (string.IsNullOrEmpty(txtname.Text) || string.IsNullOrEmpty(txtemail.Text))
                {
                    lbl.Text = "Name and email can't be null !!";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                    return;
                }

                if (string.IsNullOrEmpty(txtuname.Text) || string.IsNullOrEmpty(txtpass.Text))
                {
                    lbl.Text = "user name and and password can't be null !!";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                    return;
                }

                else
                {
                    StaffMst staff = new StaffMst();
                    staff.Name = txtname.Text;
                    if (drpstd.SelectedIndex > 0)
                    {
                        staff.StdName = drpstd.SelectedItem.Text;
                        staff.StdId   = int.Parse(drpstd.SelectedValue);
                    }
                    staff.Email  = txtemail.Text;
                    staff.Mobile = txtmobile.Text;
                    if (!string.IsNullOrEmpty(FileUpload1.FileName))
                    {
                        FileUpload1.SaveAs(Server.MapPath("~/StaffImg/" + FileUpload1.FileName));
                        staff.Image = "~/StaffImg/" + FileUpload1.FileName;
                    }
                    staff.Qualification = txtqual.Text;
                    staff.Pass          = txtpass.Text;
                    staff.Pincode       = txtpin.Text;
                    staff.Uname         = txtuname.Text;
                    staff.Add           = txtadd.Text;
                    staff.City          = txtcity.Text;
                    staff.Gender        = DropDownList1.SelectedItem.Text;
                    if (StaffId != null)
                    {
                        staff.SID = int.Parse(StaffId.ToString());
                        if (staff.UpdateDataByKey())
                        {
                            lbl.Text = "Record updated Successfully";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                            resret();
                            Response.Redirect("StaffReport.aspx", false);
                        }
                    }
                    else
                    {
                        if (StaffDT != null && StaffDT.Rows.Count == 1)
                        {
                            lbl.Text = "UserName alredy exists !!";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                        }

                        staff.SID = StaffMst.GetNewSID();
                        staff.Insert();
                        lbl.Text = "Record Added Successfully";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                        resret();
                    }
                }
            }
            catch (Exception ex)
            {
                lbl.Text = "Fail to Add record";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
            }
        }