protected void btnsarch_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable StuDT = StudentMst.GetAllActiveData();
                if (StuDT != null)
                {
                    DataTable Student_dt = StuDT.Select("DivId= " + drpdiv.SelectedValue).CopyToDataTable();

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

            //else
            //{
            //    //MultiView1.ActiveViewIndex = -1;
            //}
        }
        private void loaddata(int id)
        {
            try
            {
                DataRow dr = StudentResult.GetDataByKey(id);
                if (dr != null)
                {
                    txttotalMarks.Text  = dr["TotalMarks"].ToString();
                    txtObtainMarks.Text = dr["ObtainMarks"].ToString();

                    if (!string.IsNullOrEmpty(dr["ExamId"].ToString()))
                    {
                        drpExam.SelectedValue = dr["ExamId"].ToString();
                        //  drpstd.SelectedValue = dr["StdId"].ToString();
                    }
                    if (!string.IsNullOrEmpty(dr["StudentId"].ToString()))
                    {
                        DataRow drStd = StudentMst.GetDataByKey(int.Parse(dr["StudentId"].ToString()));
                        if (drStd != null)
                        {
                            drpdiv.SelectedValue = drStd["DivId"].ToString();
                            bindStudent();
                            drpstudent.SelectedValue = drStd["SID"].ToString();
                        }
                        ResultID = id;
                        //  drpstd.SelectedValue = dr["StdId"].ToString();
                    }
                    btnadd.Text = "Update";
                }
            }
            catch
            {
            }
        }
        protected void GvStudent_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            StudentMst.Delete(Convert.ToInt32(GvStudent.DataKeys[e.RowIndex].Value));
            DataTable StudentDT = StudentMst.GetAllActiveData();

            GvStudent.DataSource = StudentDT;
            GvStudent.DataBind();
        }
Exemplo n.º 4
0
        public ActionResult Create(StudentMst student)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            return(View());
        }
Exemplo n.º 5
0
        protected void Button8_Click(object sender, EventArgs e)
        {
            MultiView1.ActiveViewIndex = 1;
            DataRow Studr = StudentMst.GetDataByKey(int.Parse(Session["SID"].ToString()));
            //StuAdapter.Select_UNAME(Session["sname"].ToString());
            DataTable LeaveDT = LeaveMst.GetAllActiveData().Select("studentId = '" + Studr["SID"].ToString() + "'").CopyToDataTable();

            GridView1.DataSource = LeaveDT;
            GridView1.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         int     studentId = int.Parse(Session["SID"].ToString());
         DataRow studentdr = StudentMst.GetDataByKey(studentId);
         if (studentdr != null)
         {
             Image4.ImageUrl = studentdr["image"].ToString();
             Label1.Text     = studentdr["name"].ToString();
         }
     }
 }
        protected void bindStudent()
        {
            DataTable dt = StudentMst.GetAllActiveData();

            if (dt != null && dt.Rows.Count > 0)
            {
                drpstudent.DataSource     = dt;
                drpstudent.DataTextField  = "rollno";
                drpstudent.DataValueField = "sid";
                drpstudent.DataBind();
                drpstudent.Items.Insert(0, "SELECT");
            }
        }
 protected void drpdiv_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (drpdiv.SelectedIndex > 0)
     {
         DataTable dt = StudentMst.GetAllResultDataByDivID(int.Parse(drpdiv.SelectedValue));
         if (dt != null && dt.Rows.Count > 0)
         {
             drpstudent.DataSource     = dt;
             drpstudent.DataTextField  = "rollno";
             drpstudent.DataValueField = "sid";
             drpstudent.DataBind();
             drpstudent.Items.Insert(0, "SELECT");
         }
     }
 }
        protected void btnstudenlogin_Click(object sender, EventArgs e)
        {
            DataRow StuDr = StudentMst.StdLogin(txtstuuname.Text, txtstupass.Text);

            if (StuDr != null)
            {
                Session["sname"] = txtstuuname.Text;
                Session["SID"]   = StuDr["SID"].ToString();
                Response.Redirect("Student/Main.aspx");
            }
            else
            {
                lblstuerror.Text = "Login Error !!";
            }
        }
        private void loaddata(int id)
        {
            try
            {
                DataRow dr = StudentMst.GetDataByKey(id);
                if (dr != null)
                {
                    txtadd.Text   = dr["Add"].ToString();
                    txtcity.Text  = dr["Name"].ToString();
                    txtemail.Text = dr["Email"].ToString();
                    txtmobi.Text  = dr["Mobile"].ToString();
                    txtroll.Text  = dr["RollNo"].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();
                    txt_MachineId.Text = dr["MachineCode"].ToString();
                    if (!string.IsNullOrEmpty(dr["DOB"].ToString()))
                    {
                        DateTime date = Convert.ToDateTime(dr["DOB"].ToString());
                        drpdd.SelectedItem.Text   = date.ToString("dd");
                        drpmm.SelectedItem.Text   = date.ToString("MM");
                        drpyyyy.SelectedItem.Text = date.ToString("yyyy");
                    }

                    if (!string.IsNullOrEmpty(dr["StdId"].ToString()))
                    {
                        drpstd.SelectedValue = dr["StdId"].ToString();
                    }
                    if (!string.IsNullOrEmpty(dr["DivId"].ToString()))
                    {
                        binddiv(int.Parse(dr["StdId"].ToString()));
                        drpdiv.SelectedValue = dr["DivId"].ToString();
                    }
                    //  DropDownList1.SelectedItem.Text = dr["Gender"].ToString();
                    StudentId = id;

                    btnstuadd.Text = "Update";
                }
            }
            catch
            {
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                DataTable StdDT = StdMst.GetAllActiveData();
                drpstd.DataSource     = StdDT;
                drpstd.DataTextField  = "StdName";
                drpstd.DataValueField = "Sid";
                drpstd.DataBind();

                drpstd.Items.Insert(0, "SELECT");
                drpstudent.Items.Insert(0, "SELECT");

                DataTable Student_dt = StudentMst.GetAllActiveData();
                GvStudent.DataSource = Student_dt;
                GvStudent.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                int     id    = 1;
                DataRow Studr = StudentMst.GetDataByKey(id);
                if (Studr != null)
                {
                    lblname.Text = Studr["Name"].ToString();
                    lblroll.Text = Studr["rollno"].ToString();

                    txtemail.Text       = Studr["email"].ToString();
                    txtmobile.Text      = Studr["mobile"].ToString();
                    txtadd.Text         = Studr["add"].ToString();
                    txtcity.Text        = Studr["city"].ToString();
                    txtpin.Text         = Studr["pincode"].ToString();
                    Imgprofile.ImageUrl = Studr["image"].ToString();
                    ViewState["sid"]    = Studr["SID"].ToString();
                }
            }
        }
Exemplo n.º 13
0
 protected void btnappluleave_Click(object sender, EventArgs e)
 {
     try
     {
         DataRow StuDT = StudentMst.GetDataByKey(int.Parse(Session["SID"].ToString()));
         //St StuAdapter.Select_UNAME(Session["sname"].ToString());
         LeaveMst leaveobj = new LeaveMst();
         leaveobj.LID       = LeaveMst.GetNewLID();
         leaveobj.Name      = StuDT["Name"].ToString();
         leaveobj.StudentId = int.Parse(Session["SID"].ToString());
         leaveobj.Nodays    = DropDownList1.SelectedIndex > 0 ? int.Parse(DropDownList1.SelectedValue) : 1;
         leaveobj.Rollno    = "";
         leaveobj.Message   = txtmsg.Text;
         leaveobj.Insert();
         lbl.Text    = "Apply for leave successfully";
         txtmsg.Text = "";
         DropDownList1.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         lbl.Text = "Apply for leave failed";
     }
 }
        private void getRollNo()
        {
            int     rno       = 0;
            DataRow studentdt = StudentMst.GetMaxRow();

            //int rstu = Convert.ToInt32(DivDT.Rows[0]["Seat"].ToString()) - Convert.ToInt32(StuDT.Rows.Count.ToString());
            //lblstudent.Text = "Total Admitted =" + StuDT.Rows.Count.ToString() + " , Remaining Student = " + rstu;

            //string stddd = lblstd.Text.Substring(0, 1);
            if (studentdt != null)
            {
                rno = Convert.ToInt32(studentdt["RollNo"].ToString()) + 1;
            }
            if (rno.ToString().Length < 2)
            {
                string newrno = DateTime.Now.ToString("YY") + "000" + rno.ToString();
                txtroll.Text = newrno;
            }
            else
            {
                txtroll.Text = rno.ToString();
            }
        }
        protected void btnsarch_Click(object sender, EventArgs e)
        {
            DataRow StuDr = StudentMst.GetDataByKey(Convert.ToInt32(drpstudent.SelectedValue));

            if (StuDr != null)
            {
                lblroll.Text   = StuDr["rollno"].ToString();
                lblname.Text   = StuDr["name"].ToString();
                lblemail.Text  = StuDr["email"].ToString();
                lblmobile.Text = StuDr["mobile"].ToString();
                lbldob.Text    = StuDr["dob"].ToString();
                lbladd.Text    = StuDr["add"].ToString();
                lblcity.Text   = StuDr["city"].ToString();
                lblpin.Text    = StuDr["pincode"].ToString();
                lbluname.Text  = StuDr["uname"].ToString();
                //lblpass.Text = StuDr["pass"].ToString();
                imgg.ImageUrl = StuDr["image"].ToString();
                MultiView1.ActiveViewIndex = 0;
            }
            else
            {
                MultiView1.ActiveViewIndex = -1;
            }
        }
Exemplo n.º 16
0
 protected void btnchangepass_Click(object sender, EventArgs e)
 {
     try
     {
         int     studentId = 1;
         DataRow dr        = StudentMst.GetDataByKey(studentId);
         if (dr != null && dr["Pass"].ToString() == txtcurrent.Text)
         {
             StudentMst studentObj = new StudentMst();
             studentObj.Name    = dr["Name"].ToString();
             studentObj.StdName = dr["StdName"].ToString();
             studentObj.DivName = dr["DivName"].ToString();
             studentObj.DOB     = dr["DOB"].ToString();
             studentObj.EDate   = dr["DOB"].ToString() != "" ? (DateTime?)Convert.ToDateTime(dr["DOB"].ToString()) : null;
             studentObj.Email   = dr["Email"].ToString();
             studentObj.Mobile  = dr["Mobile"].ToString();
             studentObj.RollNo  = dr["RollNo"].ToString();
             studentObj.Pincode = dr["Pincode"].ToString();
             studentObj.Uname   = dr["Uname"].ToString();
             studentObj.Pass    = txtnewpass.Text;
             studentObj.City    = dr["City"].ToString();
             studentObj.Add     = dr["Add"].ToString();
             studentObj.Image   = dr["Image"].ToString();
             studentObj.UpdateDataByKey();
             lbl.Text = "Password Changed";
         }
         else
         {
             lbl.Text = "Invalid Current Password";
         }
     }
     catch (Exception ex)
     {
         lbl.Text = "update password fail";
     }
 }
        protected void btnstuadd_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable studentDT = StudentMst.GetAllActiveData();

                if (string.IsNullOrEmpty(txtroll.Text))
                {
                    lblmsg.Text = "Roll can't be null !!";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                    return;
                }

                if (string.IsNullOrEmpty(txtname.Text) || string.IsNullOrEmpty(txtemail.Text))
                {
                    lblmsg.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))
                {
                    lblmsg.Text = "user name and and password can't be null !!";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                    return;
                }

                else
                {
                    DateTime   bdate  = Convert.ToDateTime(drpdd.SelectedItem.Text + " " + drpmm.SelectedItem.Text + " " + drpyyyy.SelectedItem.Text);
                    StudentMst stdobj = new StudentMst();
                    stdobj.Name = txtname.Text;
                    // stdobj.StdName = lblstd.Text;
                    // stdobj.DivName = drpdiv.SelectedItem.Text;
                    stdobj.DOB         = bdate.GetDateTimeFormats()[8].ToString();
                    stdobj.EDate       = DateTime.Now;
                    stdobj.Email       = txtemail.Text;
                    stdobj.Mobile      = txtmobi.Text;
                    stdobj.RollNo      = txtroll.Text;
                    stdobj.Pincode     = txtpin.Text;
                    stdobj.Uname       = txtuname.Text;
                    stdobj.Pass        = txtpass.Text;
                    stdobj.City        = txtcity.Text;
                    stdobj.MachineCode = txt_MachineId.Text != "" ? (int?)Convert.ToInt32(txt_MachineId.Text): null;
                    if (drpdiv.SelectedIndex > 0)
                    {
                        stdobj.DivName = drpdiv.SelectedItem.Text;
                        stdobj.DivId   = int.Parse(drpstd.SelectedValue);
                    }

                    if (drpstd.SelectedIndex > 0)
                    {
                        stdobj.StdName = drpdiv.SelectedItem.Text;
                        stdobj.StdId   = int.Parse(drpstd.SelectedValue);
                    }

                    if (!string.IsNullOrEmpty(FileUpload1.FileName))
                    {
                        FileUpload1.SaveAs(Server.MapPath("~/Studentimg/" + FileUpload1.FileName));
                        stdobj.Image = "~/Studentimg/" + FileUpload1.FileName;
                    }

                    if (StudentId != null)
                    {
                        stdobj.SID = int.Parse(StudentId.ToString());
                        if (stdobj.UpdateDataByKey())
                        {
                            lblmsg.Text = "Record updated Successfully";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                            resret();
                            Response.Redirect("StudentReport.aspx", false);
                        }
                    }
                    else
                    {
                        if (studentDT != null && studentDT.Rows.Count == 1)
                        {
                            lblmsg.Text = "UserName alredy exists !!";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                        }

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