private void BindGridStd()
        {
            DataTable StdDT = StdMst.GetAllActiveData();

            GvStd.DataSource = StdDT;
            GvStd.DataBind();
        }
Esempio n. 2
0
        protected void bindStd()
        {
            DataTable StdDT = StdMst.GetAllActiveData();

            drpstd.DataSource     = StdDT;
            drpstd.DataTextField  = "STDName";
            drpstd.DataValueField = "SID";
            drpstd.DataBind();
            drpstd.Items.Insert(0, new ListItem("Select", "-1"));
        }
        protected void bindstd()
        {
            DataTable StdDT = StdMst.GetAllActiveData();

            drpstd.DataSource     = StdDT;
            drpstd.DataTextField  = "STDName";
            drpstd.DataValueField = "SID";
            drpstd.DataBind();
            drpstd.Items.Insert(0, "SELECT");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                //  StuDT = StuAdapter.Select_UNAME(Session["sname"].ToString());

                DataTable std = StdMst.GetAllActiveData();

                int       month        = DateTime.Now.Month;
                DataTable attendancedt = CHECKINOUT.GetAllMonthlyAttendanceRecord(int.Parse(Session["Sid"].ToString()), month);

                if (attendancedt != null && attendancedt.Rows.Count > 0)
                {
                    lbltotalatt.Text = attendancedt.Rows.Count.ToString();


                    // AttDT = AttAdapter.Select_Roll_Atatus(StuDT.Rows[0]["rollno"].ToString(), "Present");

                    try
                    {
                        lblpresent.Text = attendancedt.Select("Status='Present' OR Status='Holiday'").CopyToDataTable().Rows.Count.ToString();
                    }
                    catch
                    {
                        lblpresent.Text = "0";
                    }
                    try
                    {
                        lblabsent.Text = attendancedt.Select("Status='Abscent'").CopyToDataTable().Rows.Count.ToString();
                    }
                    catch
                    {
                        lblabsent.Text = "0";
                    }
                    // AttDT = AttAdapter.Select_Roll_Atatus(StuDT.Rows[0]["rollno"].ToString(), "Absent");

                    try
                    {
                        lblleave.Text = attendancedt.Select("Status='Leave'").CopyToDataTable().Rows.Count.ToString();
                    }
                    catch
                    {
                        lblleave.Text = "0";
                    }


                    DataTable LeaveDT = LeaveMst.GetAllDataRecordByStId("", null, int.Parse(Session["Sid"].ToString()));
                    lbltotalleave.Text = LeaveDT.Rows.Count.ToString();


                    DataTable CompDT = Complainmst.GetAllDataRecordByStId("", null, int.Parse(Session["Sid"].ToString()));
                    lbltotalattcompl.Text = CompDT.Rows.Count.ToString();
                }
            }
        }
        protected void GvStd_RowEditing(object sender, GridViewEditEventArgs e)
        {
            GvStd.EditIndex = e.NewEditIndex;
            DataRow drRole = StdMst.GetDataByKey(int.Parse((GvStd.Rows[e.NewEditIndex].FindControl("lbl_SID") as Label).Text));

            GvStd.SelectedIndex = e.NewEditIndex;
            StdID           = int.Parse((GvStd.Rows[e.NewEditIndex].FindControl("lbl_SID") as Label).Text);
            txtstdname.Text = drRole["StdName"].ToString();
            e.Cancel        = true;

            btnaddstd.Text = "Update";
            BindGridStd();
        }
        protected void GvStd_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            StdMst std = new StdMst();

            if (std.Delete(Convert.ToInt32(GvStd.DataKeys[e.RowIndex].Value)) == 1)
            {
                lbl.Text = "Record Deleted Successfully.";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
            }
            else
            {
                lbl.Text = "fail to delete ";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
            }
            BindGridStd();
        }
        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 GvStd_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            TextBox tname = GvStd.Rows[e.RowIndex].Cells[1].Controls[0] as TextBox;
            DataRow dr    = StdMst.GetDataByKey(Convert.ToInt32(GvStd.DataKeys[e.RowIndex].Value));

            if (dr != null)
            {
                StdMst std = new StdMst();
                std.SID     = Convert.ToInt32(GvStd.DataKeys[e.RowIndex].Value);
                std.StdName = txtstdname.Text;
                std.EDate   = DateTime.Parse(dr["EDate"].ToString());
                std.UpdateDataByKey();
                lbl.Text = "Record Updated Successfully";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
            }

            GvStd.EditIndex = -1;
            BindGridStd();
        }
        protected void btnsarch_Click(object sender, EventArgs e)
        {
            DataRow StuDT = StdMst.GetDataByKey(Convert.ToInt32(drpstudent.SelectedValue));

            if (StuDT != null)
            {
                //lblroll.Text = StuDT["rollno"].ToString();
                //lblname.Text = StuDT["name"].ToString();
                //lblemail.Text = StuDT["email"].ToString();
                //lblmobile.Text = StuDT["mobile"].ToString();
                //lbldob.Text = StuDT["dob"].ToString();
                //lbladd.Text = StuDT["add"].ToString();
                //lblcity.Text = StuDT["city"].ToString();
                //lblpin.Text = StuDT["pincode"].ToString();
                //lbluname.Text = StuDT["uname"].ToString();
                //lblpass.Text = StuDT["pass"].ToString();
                //imgg.ImageUrl = StuDT["image"].ToString();
                //MultiView1.ActiveViewIndex = 0;
            }
            else
            {
                //MultiView1.ActiveViewIndex = -1;
            }
        }
        protected void btnaddstd_Click(object sender, EventArgs e)
        {
            StdMst Standard = new StdMst();

            Standard.StdName = txtstdname.Text;
            Standard.EDate   = DateTime.Now;
            if (txtstdname.Text == "")
            {
                lbl.Text = "standard name is required.";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                return;
            }
            if (StdID != null)
            {
                Standard.SID = int.Parse(StdID.ToString());
                Standard.UpdateDataByKey();
                lbl.Text = "Standered update Successfully.";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                BindGridStd();
                txtstdname.Text = "";
                StdID           = 0;
            }

            else
            {
                Standard.SID = StdMst.GetNewSID();
                Standard.Insert();
                lbl.Text = "Standered update Successfully.";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
                hidStdId = null;
                BindGridStd();
                txtstdname.Text = "";
            }

            btnaddstd.Text = "ADD";
        }