public List<Branch_Model> GetListTrungTam()
    {
        List<Branch_Model> rs = new List<Branch_Model>();
        ThuVien tv = new ThuVien();
        try
        {
            DataTable tbBranch = tv.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" });
            if (tbBranch.Rows.Count > 0)
            {
                for (int i = 0; i < tbBranch.Rows.Count; i++)
                {
                    Branch_Model bmodel = new Branch_Model();
                    bmodel.BranchID = tbBranch.Rows[i]["BranchID"].ToString();
                    bmodel.BranchName = tbBranch.Rows[i]["BranchName"].ToString();

                    rs.Add(bmodel);
                }
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        return rs;
    }
    public List<cAdMin_DMObject_Model> GetDMObject(string PeopleID)
    {
        List<cAdMin_DMObject_Model> rs = new List<cAdMin_DMObject_Model>();
        ThuVien tv = new ThuVien();
        try
        {
            DataTable tbDMObject = tv.SP_SelectDataTable("USP_DMObject_GetByID", new string[] { "@PeopleID" }, new object[] { PeopleID });
            if (tbDMObject.Rows.Count > 0)
            {
                for (int i = 0; i < tbDMObject.Rows.Count; i++)
                {
                    cAdMin_DMObject_Model omodel = new cAdMin_DMObject_Model();
                    //omodel.PeopleID = tbDMObject.Rows[i]["PeopleID"].ToString();
                    //omodel.PeopleName = tbDMObject.Rows[i]["PeopleName"].ToString();
                    omodel.ObjectCode = tbDMObject.Rows[i]["ObjectCode"].ToString();
                    omodel.ParentObjectCode = tbDMObject.Rows[i]["ParentObjectCode"].ToString();
                    //omodel.Level = tbDMObject.Rows[i]["Level"].ToString();
                    //omodel.GroupName = tbDMObject.Rows[i]["GroupName"].ToString();
                    //omodel.ModifyPeopleID = tbDMObject.Rows[i]["ModifyPeopleID"].ToString();

                    rs.Add(omodel);
                }
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        return rs;
    }
    public List<People_Model> GetListGiaoVien(string BranchID)
    {
        List<People_Model> rs = new List<People_Model>();
        ThuVien tv = new ThuVien();
        try
        {
            DataTable tbBranch = tv.SP_SelectDataTable("USP_People_GetBySomeConditional", new string[] { "@flag", "@PeopleCode", "@BranchID" }, new object[] { 4,"GV", BranchID });
            if (tbBranch.Rows.Count > 0)
            {
                for (int i = 0; i < tbBranch.Rows.Count; i++)
                {
                    People_Model pmodel = new People_Model();
                    pmodel.PeopleID = tbBranch.Rows[i]["TeacherID"].ToString();
                    pmodel.PeopleName = tbBranch.Rows[i]["PeopleName"].ToString();
                    //pmodel.PeopleCode = tbBranch.Rows[i]["PeopleCode"].ToString();

                    rs.Add(pmodel);
                }
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        return rs;
    }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //Top Lời giới thiệu
     tv = new ThuVien();
     DataTable tb = tv.SP_SelectDataTable("USP_Article_GetBySomeConditional", new string[] { "@flag", "@Count" }, new object[] { 3, 3 });
     cd.DataSource = tb;
     cd.DataBind();
 }
    public List<SchoolFeeOfStudent_Model> SearchSchoolFeeOfStudent(string BranchID, string PPID, string PPCode, string HPFrom, string HPTo, string TrangThaiHP, string isDangHoc, string isNgungHoc)
    {
        List<SchoolFeeOfStudent_Model> rs = new List<SchoolFeeOfStudent_Model>();
        ThuVien tv = new ThuVien();
        try
        {
            if (isDangHoc == "true")
                isDangHoc = "2";

            if (isNgungHoc == "true")
                isNgungHoc = "1";
            else isNgungHoc = "0";

            DataTable tbSchoolFeeOfStudent = tv.SP_SelectDataTable("USP_SchoolFeeOfStudent_GetBySomeConditional", new string[] { "@BranchID", "@PeopleID", "@peopleCode", "@From", "@To", "@StudentStatusID" }, new object[] { BranchID, PPID, PPCode, HPFrom, HPTo, isDangHoc + ", " + isNgungHoc });
            if (tbSchoolFeeOfStudent.Rows.Count > 0)
            {
                int OrderNumber = 1;
                for (int i = 0; i < tbSchoolFeeOfStudent.Rows.Count; i++)
                {
                    SchoolFeeOfStudent_Model sfmodel = new SchoolFeeOfStudent_Model();

                    sfmodel.OrderNumber = OrderNumber++;
                    sfmodel.PeopleID = tbSchoolFeeOfStudent.Rows[i]["PeopleID"].ToString();
                    sfmodel.LastName = tbSchoolFeeOfStudent.Rows[i]["LastName"].ToString();
                    sfmodel.FirstName = tbSchoolFeeOfStudent.Rows[i]["FirstName"].ToString();
                    sfmodel.ClassID = tbSchoolFeeOfStudent.Rows[i]["ClassID"].ToString();
                    sfmodel.ClassName = tbSchoolFeeOfStudent.Rows[i]["ClassName"].ToString().Replace("-","_");
                    sfmodel.DegreeID = tbSchoolFeeOfStudent.Rows[i]["DegreeID"].ToString();
                    sfmodel.DegreeCode = tbSchoolFeeOfStudent.Rows[i]["DegreeCode"].ToString();
                    sfmodel.DegreeName = tbSchoolFeeOfStudent.Rows[i]["DegreeNameVN"].ToString();
                    sfmodel.BranchID = tbSchoolFeeOfStudent.Rows[i]["BranchID"].ToString();
                    sfmodel.BranchName = tbSchoolFeeOfStudent.Rows[i]["BranchName"].ToString();
                    sfmodel.Money = tbSchoolFeeOfStudent.Rows[i]["Money"].ToString();
                    sfmodel.PayDate = tbSchoolFeeOfStudent.Rows[i]["PayDate"].ToString();
                    sfmodel.From = tbSchoolFeeOfStudent.Rows[i]["From"].ToString();
                    sfmodel.To = tbSchoolFeeOfStudent.Rows[i]["To"].ToString();
                    sfmodel.Period = tbSchoolFeeOfStudent.Rows[i]["Period"].ToString();
                    sfmodel.StudiedSessionNumber = tbSchoolFeeOfStudent.Rows[i]["StudiedSessionNumber"].ToString();
                    sfmodel.SessionNumber = tbSchoolFeeOfStudent.Rows[i]["SessionNumber"].ToString();

                    rs.Add(sfmodel);
                }
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        return rs;
    }
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     tv = new ThuVien();
     ddlThanhVien.Items.Clear();
     string Name = txtTimTV.Text;
     tbPeople = tv.SP_SelectDataTable("USP_People_GetByName", new string[] { "@flag", "@PeopleName", "@PeopleCode" }, new object[] { 1, Name, "" });
     DataRow drPeople = tbPeople.NewRow();
     drPeople["PeopleID"] = 0;
     drPeople["PeopleName"] = "-- Chọn --";
     tbPeople.Rows.InsertAt(drPeople, 0);
     ddlThanhVien.DataSource = tbPeople;
     ddlThanhVien.DataTextField = "PeopleName";
     ddlThanhVien.DataValueField = "MaPhanQuyen";
     //ddlThanhVien.DataValueField = "PeopleID";
     ddlThanhVien.DataBind();
 }
    public List<Student_Model> GetDSHV_trongTrungTam(string BranchID)
    {
        List<Student_Model> rs = new List<Student_Model>();
        ThuVien tv = new ThuVien();

        DataTable tbStudent = tv.SP_SelectDataTable("USP_Student_GetBySomeConditional", new string[] { "@flag", "@BranchID" }, new object[] { 12, BranchID });
            if (tbStudent.Rows.Count > 0)
            {
                for (int i = 0; i < tbStudent.Rows.Count; i++)
                {
                    Student_Model stmodel = new Student_Model();
                    stmodel.StudentID = tbStudent.Rows[i]["StudentID"].ToString();
                    stmodel.StudentName = tbStudent.Rows[i]["StudentName"].ToString();
                    rs.Add(stmodel);
                }
            }

        return rs;
    }
    //Lấy danh sách các buổi có thể học thử
    public List<NgayCoTheHocThu_Model> GetListNgayCoTheHocThu(string ClassID)
    {
        ThuVien tv = new ThuVien();
        List<NgayCoTheHocThu_Model> rs = new List<NgayCoTheHocThu_Model>();

        DataTable dtNgayCoTheHocThu = tv.SP_SelectDataTable("USP_Student_NgayCoTheHocThu", new string[] { "@ClassID" }, new object[] { ClassID });
        if (dtNgayCoTheHocThu.Rows.Count > 0)
        {
            for (int i = 0; i < dtNgayCoTheHocThu.Rows.Count; i++)
            {
                NgayCoTheHocThu_Model HocThumodel = new NgayCoTheHocThu_Model();
                HocThumodel.ScheduleID = dtNgayCoTheHocThu.Rows[i]["ScheduleID"].ToString();
                HocThumodel.NgayHocThu = dtNgayCoTheHocThu.Rows[i]["NgayHoc"].ToString();
                HocThumodel.ThuTrongTuan = dtNgayCoTheHocThu.Rows[i]["ThuTrongTuan"].ToString();
                rs.Add(HocThumodel);
            }
        }

        return rs;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Page.Title = "Nghi phep";
            if (Session["PeopleCode"].ToString().IndexOf("GH") == -1)
            {
                Response.Redirect("?s=sigin");
            }

            //Bind data cho combobox ddlTrungTam Start
            tv1 = new ThuVien();
            tbBranch = tv1.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" });
            DataRow drBranch = tbBranch.NewRow();
            drBranch["BranchID"] = 0;
            drBranch["BranchName"] = "-- Chọn --";
            tbBranch.Rows.InsertAt(drBranch, 0);
            ddlTrungTam.DataSource = tbBranch;
            ddlTrungTam.DataTextField = "BranchName";
            ddlTrungTam.DataValueField = "BranchID";
            ddlTrungTam.DataBind();

            lblOperator.Text = Session["PeopleName"].ToString();

            gvPhongHc.PageSize = Convert.ToInt32(WebConfigurationManager.AppSettings["PageSize"]);
        }
    }
    protected void ddlLop_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlLop.SelectedIndex == 0)
        {
            lblGiaoVien.Text = "";
        }
        else
        {
            tbClass = (DataTable)Session["tbClass"];
            //Lấy tên giáo viên chủ nhiệm
            tbClass.PrimaryKey = new DataColumn[] { tbClass.Columns["ClassID"] };

            DataRow dr = tbClass.Rows.Find(Convert.ToInt32(ddlLop.SelectedValue));
            ClassID = dr["ClassID"].ToString();
            lblGiaoVien.Text = dr["TeacherName"].ToString();
        }

        //Lịch học của lớp này
        tv1 = new ThuVien();
        DataTable tbSchedule = tv1.SP_SelectDataTable("USP_Schedule_GetBySomeConditional", new string[] { "@flag", "@ClassID" }, new object[] { 2, ClassID });
        //if (tbSchedule.Rows.Count > 0)
        //{
            DataRow drSchedule = tbSchedule.NewRow();
            drSchedule["ScheduleID"] = 0;
            drSchedule["Date"] = "-- Chọn ngày --";
            tbSchedule.Rows.InsertAt(drSchedule, 0);

            ddlNgayThuNhat.DataSource = tbSchedule;
            ddlNgayThuNhat.DataTextField = "Date";
            ddlNgayThuNhat.DataValueField = "ScheduleID";
            ddlNgayThuNhat.DataBind();

            ddlNgayThuHai.DataSource = tbSchedule;
            ddlNgayThuHai.DataTextField = "Date";
            ddlNgayThuHai.DataValueField = "ScheduleID";
            ddlNgayThuHai.DataBind();
           // }

        //Danh sách Học viên
        tv1 = new ThuVien();
        tbPeople = tv1.SP_SelectDataTable("USP_Student_GetBySomeConditional", new string[] { "@flag", "@ClassID", "@StudentStatusID" }, new object[] { 11, ClassID, 2 });
        if (tbPeople.Rows.Count > 0)
        {
            DataRow drPeople = tbPeople.NewRow();
            drPeople["StudentID"] = 0;
            drPeople["StudentName"] = "-- Chọn tên --";
            tbPeople.Rows.InsertAt(drPeople, 0);

            ddlHocVien.DataSource = tbPeople;
            ddlHocVien.DataTextField = "StudentName";
            ddlHocVien.DataValueField = "StudentID";
            ddlHocVien.DataBind();
        }
    }
    protected void ddlHocVien_SelectedIndexChanged(object sender, EventArgs e)
    {
        StudentID = ddlHocVien.SelectedValue;
        tv1 = new ThuVien();
        tbEnterClass = tv1.SP_SelectDataTable("USP_EnterClass_GetBySomeConditional", new string[] { "@flag", "@StudentID" }, new object[] { 2, StudentID });

        if (tbEnterClass.Rows.Count > 0)
        {
            lblNgayNhapHoc.Text = Convert.ToDateTime(tbEnterClass.Rows[0]["EnterClassDate"]).ToString("dd/MM/yyyy");
            lblNgayTinhHP.Text = Convert.ToDateTime(tbEnterClass.Rows[0]["PayDate"]).ToString("dd/MM/yyyy");
            Session["EnterClassID"] = tbEnterClass.Rows[0]["EnterClassID"];
        }

        //Danh sách những ngày học tiếp theo
        tv2 = new ThuVien();
        DataTable tb = tv2.SP_SelectDataTable("USP_Study_GetBySomeConditional", new string[] { "@flag", "@StudentID" }, new object[] { 0, StudentID });
        if (tb.Rows.Count > 0)
        {
            DataRow dr = tb.NewRow();
            dr["StudyID"] = 0;
            dr["Ngay"] = "-- Chọn ngày --";
            tb.Rows.InsertAt(dr, 0);

            ddlNgayThuNhat.DataSource = tb;
            ddlNgayThuNhat.DataTextField = "Ngay";
            ddlNgayThuNhat.DataValueField = "StudyID";
            ddlNgayThuNhat.DataBind();

            //
            ddlNgayThuHai.DataSource = tb;
            ddlNgayThuHai.DataTextField = "Ngay";
            ddlNgayThuHai.DataValueField = "StudyID";
            ddlNgayThuHai.DataBind();

        }
    }
Exemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Bind data cho combobox ddlTrungTam Start
            tv1 = new ThuVien();
            tbBranch = tv1.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" });
            DataRow drBranch = tbBranch.NewRow();
            drBranch["BranchID"] = 0;
            drBranch["BranchName"] = "-- Tất cả --";
            tbBranch.Rows.InsertAt(drBranch, 0);
            ddlTrungTam.DataSource = tbBranch;
            ddlTrungTam.DataTextField = "BranchName";
            ddlTrungTam.DataValueField = "BranchID";
            ddlTrungTam.DataBind();

            txtNgayDeIn.Text = DateTime.Now.ToString("dd/MM/yyyy");

        }

        btnPreview_Click(null, null);
    }
Exemplo n.º 13
0
    protected void brnPrint_Click(object sender, EventArgs e)
    {
        ReportDocument rpt = new ReportDocument();
        CrystalReportViewer1.Enabled = true;
        string str = "rptClassReport.rpt";
        rpt.Load(Server.MapPath(str));

        /////////////////////
        //Get danh sách lớp dưới db
        tv1 = new ThuVien();
        DataTable dt = tv1.SP_SelectDataTable("USP_Statistic_ClassesReport", new string[] { "@BranchID" }, new object[] { ddlTrungTam.SelectedValue });

        dsForReport.LopDataTable lopDataTable = new dsForReport.LopDataTable();

        string[] sParam;
        string hs;
        hs = "";

        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow r = lopDataTable.NewRow();  //Khuôn dạng của table trong Dataset
                r["idLop"] = dt.Rows[i]["idLop"];
                r["tenlop"] = dt.Rows[i]["tenlop"];
                r["giaovien"] = dt.Rows[i]["giaovien"];
                //
                sParam = dt.Rows[i]["hs1"].ToString().Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs1"].ToString();
                r["hs1"] = hs;
                r["phone1"] = dt.Rows[i]["phone1"];

                //
                sParam = dt.Rows[i]["hs2"].ToString().Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs2"].ToString();

                r["hs2"] = hs;
                r["phone2"] = dt.Rows[i]["phone2"];

                //
                sParam = dt.Rows[i]["hs2"].ToString().Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs3"].ToString();

                r["hs3"] = hs;
                r["phone3"] = dt.Rows[i]["phone3"];

                //
                sParam = dt.Rows[i]["hs4"].ToString().Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs4"].ToString();

                r["hs4"] = hs;
                r["phone4"] = dt.Rows[i]["phone4"];

                //
                sParam = dt.Rows[i]["hs5"].ToString().Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs5"].ToString();
                r["hs5"] = hs;
                r["phone5"] = dt.Rows[i]["phone5"];

                //
                sParam = dt.Rows[i]["hs6"].ToString().Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs6"].ToString();

                r["hs6"] = hs;
                r["phone6"] = dt.Rows[i]["phone6"];
                lopDataTable.Rows.Add(r);       //Thêm vào bảng có khuôn dạng trong dataset
            }
            //////////////////////////////////////////

            //rpt.SetDataSource((DataTable)lopDataTable);
            CrystalReportViewer1.ReportSource = rpt;
            CrystalReportViewer1.Visible = true;
        }
    }
    private int fnCalBaoLuu()
    {
        tv = new ThuVien();
        dt = tv.SP_SelectDataTable("USP_Study_GetBySomeConditional", new string[] { "@flag", "@StudentID", "@Date" }, new object[] { 3, selectedPeopleID, Convert.ToDateTime(txtNgayBaoLuu.Text).ToString("MM/dd/yyyy") });

        if (txtNgayBaoLuu.Text.Equals(""))
        {
            lblTrangThai.Text = "<br/>Chọn ngày Bảo lưu chuyển";
            return 0;
        }
        else if (Convert.ToDateTime(txtNgayBaoLuu.Text) < DateTime.Now.Date)
        {
            lblTrangThai.Text = "<br/>Ngày Bảo lưu k hợp lý.";
            return 0;
        }
        else if (dt.Rows.Count > 0)
        {
            txtNgayBaoLuu.Text = Convert.ToDateTime(dt.Rows[0]["NgayBaoLuu"]).ToString("dd/MM/yyyy");
            lblTrangThai.ForeColor = System.Drawing.Color.Yellow;
            lblTrangThai.Text = "Học tại: " + dt.Rows[0]["BranchName"] + ", " + dt.Rows[0]["ClassName"] + " chưa học: " + dt.Rows[0]["SoBuoiChuaHoc"] + " , sẽ được bảo lưu";
            return 1;
        }
        else
        {
            lblTrangThai.ForeColor = System.Drawing.Color.Red;
            lblTrangThai.Text = "_Không còn buổi học nào";
            return 0;
        }
    }
Exemplo n.º 15
0
    private void f_ShowData()
    {
        gvPhongHc.Columns[2].Visible = true;
        gvPhongHc.Columns[3].Visible = true;
        gvPhongHc.Columns[5].Visible = true;
        gvPhongHc.Columns[6].Visible = true;
        gvPhongHc.Columns[7].Visible = true;
        gvPhongHc.Columns[12].Visible = true;
        //gvPhongHc.Columns[11].Visible = true;

        tv5 = new ThuVien();
        tbEnterClass = tv5.SP_SelectDataTable("USP_EnterClass_GetBySomeConditional", new string[] { "@flag", "@First", "@Count" }, new object[] { 1, "0", "1000" });
        gvPhongHc.DataSource = tbEnterClass;
        gvPhongHc.DataBind();

        Session["tbEnterClass"] = tbEnterClass;

        //Tự mở khóa Khi chạy
        if (Session["isHideAspectParameter"] + "" == "1")
        {
            gvPhongHc.Columns[2].Visible = false;
            gvPhongHc.Columns[3].Visible = false;
            gvPhongHc.Columns[5].Visible = false;

            gvPhongHc.Columns[6].Visible = false;
            gvPhongHc.Columns[7].Visible = false;

            gvPhongHc.Columns[12].Visible = false;
            //gvPhongHc.Columns[10].Visible = false;
            // gvPhongHc.Columns[11].Visible = false;
        }
        setEmpty();
    }
Exemplo n.º 16
0
    protected void gvPhongHc_SelectedIndexChanged(object sender, EventArgs e)
    {
        //xóa các textbox
        setEmpty();
        try
        {
            EnterClassID = gvPhongHc.SelectedDataKey["EnterClassID"].ToString();
            ddlTrungTam.SelectedIndex = ddlTrungTam.Items.IndexOf(ddlTrungTam.Items.FindByValue(Convert.ToString(gvPhongHc.SelectedRow.Cells[3].Text)));
            ddlTrungTam_SelectedIndexChanged(null, null);

            string BranchID = ddlTrungTam.SelectedValue.ToString();

            ddlLop.Items.Clear();
            ddlHocVien.Items.Clear();

            //Lấy các lớp thuộc chi nhánh
            tv2 = new ThuVien();
            tbClass = tv2.SP_SelectDataTable("USP_Class_GetBySomeConditional", new string[] { "@flag", "@BranchID" }, new object[] { 1, BranchID });
            DataRow drBranchInClass = tbClass.NewRow();
            drBranchInClass["ClassID"] = 0;
            drBranchInClass["ClassName"] = "-- Chọn --";
            tbClass.Rows.InsertAt(drBranchInClass, 0);
            ddlLop.DataSource = tbClass;
            ddlLop.DataTextField = "ClassName";
            ddlLop.DataValueField = "ClassID";
            ddlLop.DataBind();

            ddlLop.SelectedIndex = ddlLop.Items.IndexOf(ddlLop.Items.FindByValue(Convert.ToString(gvPhongHc.SelectedRow.Cells[5].Text)));

            //Lấy tên giáo viên chủ nhiệm
            tbClass.PrimaryKey = new DataColumn[] { tbClass.Columns["ClassID"] };

            DataRow dr = tbClass.Rows.Find(Convert.ToInt32(ddlLop.SelectedValue));

            lblGiaoVien.Text = dr["TeacherName"].ToString();

            ddlTrinhDo.SelectedIndex = ddlTrinhDo.Items.IndexOf(ddlTrinhDo.Items.FindByValue(Convert.ToString(gvPhongHc.SelectedRow.Cells[7].Text)));

            int stuID = Convert.ToInt32(gvPhongHc.SelectedRow.Cells[12].Text);
            string stuName = HttpUtility.HtmlDecode(gvPhongHc.SelectedRow.Cells[13].Text);

            Dictionary<int, string> listItm = new Dictionary<int, string>();
            listItm.Add(stuID, stuName);
            ddlHocVien.DataSource = listItm;
            ddlHocVien.DataTextField = "Value";
            ddlHocVien.DataValueField = "Key";
            ddlHocVien.DataBind();

            //Dont del this: Nếu đã đóng Học phí thì Ẩn textbox Ngày Nhập học
            //tv1 = new ThuVien();
            //int isPayAny = tv1.SP_ExcecutePro("USP_SchoolFee_GetBySomeCondition", new string[] { "@flag", "@StudentID" }, new object[] { "2", stuID });

            //if (isPayAny != 0)
            //{
            //    txtNgayNhapHoc.Enabled = false;
            //}
            //else
            //{
            //    txtNgayNhapHoc.Enabled = true;
            //}

            string strNgayNhapHoc = HttpUtility.HtmlDecode(gvPhongHc.SelectedRow.Cells[16].Text).Trim();
            if (strNgayNhapHoc + "" != "")
            {
                txtNgayNhapHoc.Text = Convert.ToDateTime(strNgayNhapHoc).ToString("dd/MM/yyyy");
            }

            txtGhiChu.Text = HttpUtility.HtmlDecode(gvPhongHc.SelectedRow.Cells[15].Text);

            Session["EnterClassID"] = gvPhongHc.SelectedRow.Cells[2].Text;
            Session["themsua"] = 2;

            f_ThemXoaLuu(true, true, true);
        }
        catch (Exception ex)
        {
            //Gửi email báo lỗi
            sendEmail.SendMailForTechnical("*****@*****.**", "Lỗi", ex.ToString(), true);
        }
    }
Exemplo n.º 17
0
    private void f_ShowData()
    {
        setEmpty();
        //gvPhongHc.Columns[1].Visible = true;
           // gvPhongHc.Columns[2].Visible = true;
        //gvPhongHc.Columns[4].Visible = true;
        //gvPhongHc.Columns[9].Visible = true;
        //gvPhongHc.Columns[13].Visible = true;
        //gvPhongHc.Columns[14].Visible = true;
        //cm
        tv2 = new ThuVien();
        tb = tv2.SP_SelectDataTable("USP_TeacherType_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "100" });
        gvPhongHc.DataSource = tb;
        gvPhongHc.DataBind();

        Session["tbTeacherType"] = tb;
        //gvPhongHc.Columns[1].Visible = false;
        //gvPhongHc.Columns[2].Visible = false;
        //cm gvPhongHc.Columns[4].Visible = false;
        //cm gvPhongHc.Columns[9].Visible = false;
        //cm gvPhongHc.Columns[13].Visible = false;
        //cm gvPhongHc.Columns[14].Visible = false;
        setEmpty();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Page.Title = "Xep luong theo Rank";
            //Nếu không có quyền cho trang thì Cút
            bool ChoDiTiep;
            ChoDiTiep = false;

            DataTable tbQuyen = (DataTable)Session["tbQuyen"];
            if (tbQuyen != null)
            {
                if (tbQuyen.Rows.Count > 0)
                {
                    foreach (DataRow dr_q in tbQuyen.Rows)
                    {
                        if ((dr_q["ObjectCode"].ToString() == "multiLienQuanLuongGV") && (dr_q["AllowAccess"] + "" == "True"))
                        {
                            ChoDiTiep = true;
                            break;
                        }
                    }
                }
            }

            if (ChoDiTiep == false)
            {
                Response.Redirect(WebConfigurationManager.AppSettings["WebHome"]);
            }

            btnXoa.Attributes.Add("onClick", "javascript:return confirm('Bạn có chắc muốn xoá dữ liệu?');");

            //Bind data cho combobox ddlLoaiGiaoVien Start
            tv1 = new ThuVien();
            tbTeacherType = tv1.SP_SelectDataTable("USP_TeacherType_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" });
            DataRow drTeacherType = tbTeacherType.NewRow();
            drTeacherType["TeacherTypeID"] = DBNull.Value;
            drTeacherType["TeacherTypeName"] = "-- Chọn --";
            tbTeacherType.Rows.InsertAt(drTeacherType, 0);
            ddlLoaiGiaoVien.DataSource = tbTeacherType;
            ddlLoaiGiaoVien.DataTextField = "TeacherTypeName";
            ddlLoaiGiaoVien.DataValueField = "TeacherTypeID";
            ddlLoaiGiaoVien.DataBind();

            //Bind data cho combobox ddlTrungTam Start
            tv1 = new ThuVien();
            tbBranch = tv1.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" });
            DataRow drBranch = tbBranch.NewRow();
            drBranch["BranchID"] = DBNull.Value;
            drBranch["BranchName"] = "-- Giống nhau --";
            tbBranch.Rows.InsertAt(drBranch, 0);
            ddlTrungTam.DataSource = tbBranch;
            ddlTrungTam.DataTextField = "BranchName";
            ddlTrungTam.DataValueField = "BranchID";
            ddlTrungTam.DataBind();

            f_ShowData();
        }
    }
    private void f_ShowData()
    {
        gvPhongHc.Columns[3].Visible = true;
        gvPhongHc.Columns[4].Visible = true;

        tv1 = new ThuVien();
        tbTeacherSalary = tv1.SP_SelectDataTable("USP_TeacherSalary_GetBySomeConditional", new string[] { "@flag", "@First", "@Count" }, new object[] { 2, "0", "1000" });
        gvPhongHc.DataSource = tbTeacherSalary;
        gvPhongHc.DataBind();

        Session["tbTeacherSalary"] = tbTeacherSalary;

        gvPhongHc.Columns[3].Visible = false;
        gvPhongHc.Columns[4].Visible = false;

        setEmpty();
    }
Exemplo n.º 20
0
    private void f_ShowData()
    {
        setEmpty();
        gvPhongHc.Columns[2].Visible = true;
        gvPhongHc.Columns[4].Visible = true;
        gvPhongHc.Columns[5].Visible = true;
        gvPhongHc.Columns[8].Visible = true;
        //cmGridview1.Columns[13].Visible = true;
        //cmGridview1.Columns[14].Visible = true;
        //cm
        tv2 = new ThuVien();
        tb = tv2.SP_SelectDataTable("USP_Degree_GetBySomeConditional", new string[] { "@Flag" }, new object[] { 1 });
        gvPhongHc.DataSource = tb;
        gvPhongHc.DataBind();

        Session["tbDegree"] = tb;

        if (Session["isHideAspectParameter"] + "" == "1")
        {
            gvPhongHc.Columns[2].Visible = false;
            gvPhongHc.Columns[4].Visible = false;
            gvPhongHc.Columns[5].Visible = false;
            gvPhongHc.Columns[8].Visible = false;
        }
        setEmpty();
    }
Exemplo n.º 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Page.Title = "Danh muc Trinh do";
            //Nếu không có quyền cho trang thì Cút
            bool ChoDiTiep;
            ChoDiTiep = false;

            //DataTable tbQuyen = (DataTable)Session["tbQuyen"];
            //if (tbQuyen != null)
            //{
            //    if (tbQuyen.Rows.Count > 0)
            //    {
            //        foreach (DataRow dr_q in tbQuyen.Rows)
            //        {
            //            if ((dr_q["ObjectCode"].ToString() == "mnDegree") && (dr_q["AllowAccess"] + "" == "True"))
            //            {
            //                ChoDiTiep = true;
            //                break;
            //            }
            //        }
            //    }
            //}

            //if (ChoDiTiep == false)
            //{
            //    Response.Redirect(WebConfigurationManager.AppSettings["WebHome"]);
            //}
            //..................

            btnXoa.Attributes.Add("onClick", "javascript:return confirm('Bạn có chắc muốn xoá dữ liệu?');");

            Session["themsua"] = 1;

            tv1 = new ThuVien();
            tb = tv1.SP_SelectDataTable("USP_DegreeType_GetBySomeConditional", new string[] { "@flag" }, new object[] { 1 });

            DataRow dr = tb.NewRow();
            dr["DegreeTypeID"] = 0;
            dr["DegreeTypeName"] = "-- Chọn --";
            tb.Rows.InsertAt(dr, 0);
            ddlLoaiChuongTrinh.DataSource = tb;
            ddlLoaiChuongTrinh.DataTextField = "DegreeTypeName";
            ddlLoaiChuongTrinh.DataValueField = "DegreeTypeID";
            ddlLoaiChuongTrinh.DataBind();

            f_ShowData();
            f_ThemXoaLuu(false, false, true);
        }
    }
    private int fnCalChuyenLop()
    {
        txtNgayChuyenLop.Text = txtNgayChuyenLop.Text.Trim();
        //lblSoBuoiCon.ForeColor = System.Drawing.Color.Red;
        lblThongBao.ForeColor = System.Drawing.Color.Red;

        if (!((Session["ClassID"] + "" != "") && (Session["ClassID"] + "" == ddlLop.SelectedValue) && (Session["BranchID"] + "" == ddlTrungTam.SelectedValue)))
        {
            if (txtNgayChuyenLop.Text.Equals(""))
            {
                lblSoBuoiCon.Text = "<br/>Chọn ngày chuyển";
                return 0;
            }
            else if (Convert.ToDateTime(txtNgayChuyenLop.Text) < DateTime.Now.Date)
            {
                lblSoBuoiCon.Text = "<br/>Ngày chuyển k hợp lý.";
                return 0;
            }
            else if (!chkChuyenLop.Checked)
            {
                lblThongBao.Text = "Check để xác nhận chuyển lớp";
                return 0;
            }
            else if (Session["StudentStatusID"] + "" == "2")
            {
                tv = new ThuVien();
                tbDegree = tv.SP_SelectDataTable("USP_Study_GetBySomeConditional", new string[] { "@flag", "@BranchID", "@ClassID", "@DegreeID", "@NewBranchID", "@NewClassID", "@Dic_SchoolFeeID", "@NewEnterClassDate", "@StudentID" }, new object[] { 4, Session["BranchID"], Session["ClassID"], Session["DegreeID"], ddlTrungTam.SelectedValue, ddlLop.SelectedValue, ddlTrinhDo.SelectedValue, Convert.ToDateTime(txtNgayChuyenLop.Text).ToString("MM/dd/yyyy"), Session["selectedPeopleID"] });

                lblSoBuoiCon.Text = tbDegree.Rows[0]["SoBuoiMoi"].ToString();
                Session["NewSchoolFee"] = tbDegree.Rows[0]["NewSchoolFee"];
                return 1;
            }
            else if (Session["StudentStatusID"] + "" == "3") //Đang bảo lưu  -> Đang học: Đi học lại có chuyển lớp
            {
                tv = new ThuVien();
                DataTable dt = tv.SP_SelectDataTable("USP_Study_GetBySomeConditional", new string[] { "@flag", "@Dic_SchoolFeeID", "@StudentID" }, new object[] { 6, ddlTrinhDo.SelectedValue, Session["selectedPeopleID"] });

                lblSoBuoiCon.Text = dt.Rows[0]["TotalSession"].ToString();
                Session["NewSchoolFee"] = dt.Rows[0]["Money"];
                return 1;
            }
        }
        else //Vẫn học lớp cũ
        {
            if (Session["StudentStatusID"] + "" == "3") //Đang bảo lưu  -> Đang học
            {
                tv = new ThuVien();
                DataTable dt = tv.SP_SelectDataTable("USP_Study_GetBySomeConditional", new string[] { "@flag", "@StudentID" }, new object[] { 5, Session["selectedPeopleID"] });

                lblSoBuoiCon.Text = dt.Rows[0]["TotalSession"].ToString();
                Session["NewSchoolFee"] = dt.Rows[0]["Money"];
                return 1;
            }
        }

        return 1;
    }
Exemplo n.º 23
0
 protected void ddlTrungTam_SelectedIndexChanged(object sender, EventArgs e)
 {
     string BranchID = ddlTrungTam.SelectedValue.ToString();
     tv2 = new ThuVien();
     tbClass = tv2.SP_SelectDataTable("USP_Class_GetBySomeConditional", new string[] {"@flag", "@BranchID" }, new object[] {1,  BranchID });
     DataRow drBranchInClass = tbClass.NewRow();
     drBranchInClass["ClassID"] = 0;
     drBranchInClass["ClassName"] = "-- Chọn --";
     tbClass.Rows.InsertAt(drBranchInClass, 0);
     ddlLop.DataSource = tbClass;
     ddlLop.DataTextField = "ClassName";
     ddlLop.DataValueField = "ClassID";
     ddlLop.DataBind();
     Session["tbClass"] = tbClass;
 }
Exemplo n.º 24
0
 protected void ddlXepLoai_SelectedIndexChanged(object sender, EventArgs e)
 {
     tv = new ThuVien();
     dt = tv.SP_SelectDataTable("USP_TeacherSalary_GetBySomeConditional", new string[] { "@flag", "@TeacherTypeID" }, new object[] { 1, ddlXepLoai.SelectedValue });
     if (dt.Rows.Count > 0 && dt.Rows[0]["MonthlySalary"] + "" != "")
     {
         lblLuong.Text = Convert.ToDecimal(dt.Rows[0]["MonthlySalary"]).ToString("#,###");
     }
     else
         lblLuong.Text = "Chưa xác định";
 }
Exemplo n.º 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = "Nhap hoc";
        if (!IsPostBack)
        {
            //Nếu không có quyền cho trang thì Cút
            bool ChoDiTiep;
            ChoDiTiep = false;

            DataTable tbQuyen = (DataTable)Session["tbQuyen"];
            if (tbQuyen != null)
            {
                if (tbQuyen.Rows.Count > 0)
                {
                    foreach (DataRow dr_q in tbQuyen.Rows)
                    {
                        if ((dr_q["ObjectCode"].ToString() == "mnNhapHoc") && (dr_q["AllowAccess"] + "" == "True"))
                        {
                            ChoDiTiep = true;
                            break;
                        }
                    }
                }
            }

            if (ChoDiTiep == false)
            {
                Response.Redirect(WebConfigurationManager.AppSettings["WebHome"]);
            }
            //.......................

            btnXoa.Attributes.Add("onClick", "javascript:return confirm('Bạn có chắc muốn xoá dữ liệu?');");

            //Bind data cho combobox ddlTrungTam Start
            tv1 = new ThuVien();
            tbBranch = tv1.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" });
            DataRow drBranch = tbBranch.NewRow();
            drBranch["BranchID"] = 0;
            drBranch["BranchName"] = "-- Chọn --";
            tbBranch.Rows.InsertAt(drBranch, 0);
            ddlTrungTam.DataSource = tbBranch;
            ddlTrungTam.DataTextField = "BranchName";
            ddlTrungTam.DataValueField = "BranchID";
            ddlTrungTam.DataBind();

            //ddl trình độ
            tv1 = new ThuVien();
            tbDegree = tv1.SP_SelectDataTable("USP_Degree_GetBySomeConditional", new string[] { "@flag" }, new object[] { "2" });
            DataRow drDegree = tbDegree.NewRow();
            drDegree["DegreeID"] = 0;
            drDegree["DegreeNameVN"] = "-- Chọn --";
            tbDegree.Rows.InsertAt(drDegree, 0);
            ddlTrinhDo.DataSource = tbDegree;
            ddlTrinhDo.DataTextField = "DegreeNameVN";
            ddlTrinhDo.DataValueField = "DegreeID";
            ddlTrinhDo.DataBind();

            Session["tbDegree"] = tbDegree;

            Session["themsua"] = 1;
            f_ShowData();

            //set tháng năm hiện tại
            DateTime dtnow = DateTime.Now;
            txtNgayNhapHoc.Text = dtnow.ToString("dd/MM/yyyy");

            //f_ThemXoaLuu(false, false, true);

            //Get giá trị redirect từ trang khác
            string tt = Request.QueryString["tt"];
            if (!string.IsNullOrEmpty(tt))
            {
                ddlTrungTam.SelectedIndex = ddlTrungTam.Items.IndexOf(ddlTrungTam.Items.FindByValue(Convert.ToString(tt)));
                ddlTrungTam_SelectedIndexChanged(null, null);
            }

            string cl = Request.QueryString["cl"];
            if (!string.IsNullOrEmpty(cl))
            {
                ddlLop.SelectedIndex = ddlLop.Items.IndexOf(ddlLop.Items.FindByValue(Convert.ToString(cl)));
                ddlLop_SelectedIndexChanged(null, null);
            }

            if (Session["isHideAspectParameter"] + "" == "1")
            {
                stt_col.Visible = false;
            }

            //gvPhongHc.PageSize = Convert.ToInt32(WebConfigurationManager.AppSettings["PageSize"]);
        }
    }
Exemplo n.º 26
0
    protected void btnPreview_Click(object sender, EventArgs e)
    {
        ReportDocument crystalReport = new ReportDocument();
        crystalReport.Load(Server.MapPath("~/Report/rptClassReport.rpt"));

        DataTable dt;

        dsForReport.LopDataTable lopDataTable = new dsForReport.LopDataTable();

        //Get danh sách lớp dưới db
        tv1 = new ThuVien();
        dt = tv1.SP_SelectDataTable("USP_Statistic_ClassesReport", new string[] { "@BranchID", "@ReportDate" }, new object[] { ddlTrungTam.SelectedValue, Convert.ToDateTime(txtNgayDeIn.Text).ToString("MM/dd/yyyy") });

        string[] sParam;
        string hs;
        hs = "";
        string tenlop="";
        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow r = lopDataTable.NewRow();  //Khuôn dạng của table trong Dataset
                r["idLop"] = dt.Rows[i]["idLop"];

                tenlop= dt.Rows[i]["tenlop"].ToString();
                r["tenlop"] = tenlop.Substring(0, tenlop.IndexOf("(")) + "/ " + dt.Rows[i]["tenphong"];

                r["giaovien"] = dt.Rows[i]["giaovien"];
                //
                sParam = dt.Rows[i]["hs1"].ToString().Replace("  ", " ").Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs1"].ToString();
                r["hs1"] = hs;
                r["phone1"] = dt.Rows[i]["phone1"];

                //
                sParam = dt.Rows[i]["hs2"].ToString().Replace("  ", " ").Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs2"].ToString();

                r["hs2"] = hs;
                r["phone2"] = dt.Rows[i]["phone2"];

                //
                sParam = dt.Rows[i]["hs3"].ToString().Replace("  ", " ").Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs3"].ToString();

                r["hs3"] = hs;
                r["phone3"] = dt.Rows[i]["phone3"];

                //
                sParam = dt.Rows[i]["hs4"].ToString().Replace("  ", " ").Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs4"].ToString();

                r["hs4"] = hs;
                r["phone4"] = dt.Rows[i]["phone4"];

                //
                sParam = dt.Rows[i]["hs5"].ToString().Replace("  ", " ").Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs5"].ToString();
                r["hs5"] = hs;
                r["phone5"] = dt.Rows[i]["phone5"];

                //
                sParam = dt.Rows[i]["hs6"].ToString().Replace("  ", " ").Split(new char[] { ' ' });
                if (sParam.Length > 2)
                    hs = sParam[sParam.Length - 2] + " " + sParam[sParam.Length - 1];
                else
                    hs = dt.Rows[i]["hs6"].ToString();

                r["hs6"] = hs;
                r["phone6"] = dt.Rows[i]["phone6"];
                lopDataTable.Rows.Add(r);       //Thêm vào bảng có khuôn dạng trong dataset
            }

            //QUESTION: dataset đéo chạy, bắt nhập Mật khẩu
            //dsreport.Tables.Add((DataTable)lopDataTable);  //ép kiểu về dạng table bình thường

            //Truyền một số giá trị vào form
            CrystalDecisions.CrystalReports.Engine.TextObject str_txtDate;
            str_txtDate = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalReport.ReportDefinition.ReportObjects["txtDate"];
            str_txtDate.Text = "DATE: " + txtNgayDeIn.Text; //DateTime.Now.ToString("dd/MM/yyyy");

            CrystalDecisions.CrystalReports.Engine.TextObject str_txtTenTT;
            str_txtTenTT = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalReport.ReportDefinition.ReportObjects["txtTenTT"];
            str_txtTenTT.Text = "Center: " + ddlTrungTam.SelectedItem.Text;

            crystalReport.SetDataSource((DataTable)lopDataTable);
            CrystalReportViewer1.ReportSource = crystalReport;

        }
    }
Exemplo n.º 27
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        ddlHocVien.Items.Clear();
        string Name = txtTimHV.Text;

        tv4 = new ThuVien();
        tbPeople = tv4.SP_SelectDataTable("USP_People_GetBySomeConditional", new string[] { "@flag", "@PeopleName", "@PeopleCode" }, new object[] { 7, Name, "HV" });

        if (tbPeople.Rows.Count > 0)
        {
            DataRow drPeople = tbPeople.NewRow();
            drPeople["PeopleID"] = 0;
            drPeople["PeopleName"] = "-- Các học viên tìm được --";
            tbPeople.Rows.InsertAt(drPeople, 0);

            ddlHocVien.DataSource = tbPeople;
            ddlHocVien.DataTextField = "PeopleName";
            ddlHocVien.DataValueField = "PeopleID";
            ddlHocVien.DataBind();
        }
        else
        {
            if (Name.Equals(""))
                lblThongBao.Text = "Các Học viên đã nhập học đầy đủ";
            else
                lblThongBao.Text = "Không tìm được Học viên nào theo điều kiện trên";
        }
    }
    private void BoTriThongTinVaoViTri(string BranchID, string ClassID, string Dic_SchoolFeeID)
    {
        ddlTrungTam.SelectedIndex = ddlTrungTam.Items.IndexOf(ddlTrungTam.Items.FindByValue(BranchID));
        //return;
        //ddlTrungTam_SelectedIndexChanged(null, null);

        ddlLop.Items.Clear();

        //Lấy các lớp thuộc chi nhánh
        tv = new ThuVien();
        tbClass = tv.SP_SelectDataTable("USP_Class_GetBySomeConditional", new string[] { "@flag", "@BranchID" }, new object[] { 1, BranchID });
        DataRow drClassInBranch = tbClass.NewRow();
        drClassInBranch["ClassID"] = 0;
        drClassInBranch["ClassName"] = "-- Chọn --";
        tbClass.Rows.InsertAt(drClassInBranch, 0);
        ddlLop.DataSource = tbClass;
        ddlLop.DataTextField = "ClassName";
        ddlLop.DataValueField = "ClassID";
        ddlLop.DataBind();

        ddlLop.SelectedIndex = ddlLop.Items.IndexOf(ddlLop.Items.FindByValue(ClassID));

        //return;
        //Lấy tên giáo viên chủ nhiệm
        tbClass.PrimaryKey = new DataColumn[] { tbClass.Columns["ClassID"] };

        DataRow dr = tbClass.Rows.Find(Convert.ToInt32(ddlLop.SelectedValue));

        //lblGiaoVien.Text = dr["TeacherName"].ToString();

        ddlTrinhDo.SelectedIndex = ddlTrinhDo.Items.IndexOf(ddlTrinhDo.Items.FindByValue(Dic_SchoolFeeID));

        //question: tại sao cần dòng dưới đây
        //ddlTrinhDo_SelectedIndexChanged(null, null);
    }
Exemplo n.º 29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["PeopleCode"] + "" == "" || Session["PeopleCode"].ToString() == "HV")
            Response.Redirect("?s=home");

        //
        string qs = Request.QueryString["PeopleID"];
        if (!Common.IsNumeric(qs))
        {
            lblThongBao.Text = "Không tìm thấy dữ liệu";
            return;
        }

        selectedPeopleID = Convert.ToInt32(qs);
        if (!IsPostBack)
        {
            Page.Title = "Cap nhat Thanh vien";
            Session["selectedPeopleID"] = selectedPeopleID;

            btnXoa.Attributes.Add("onClick", "javascript:return confirm('Bạn có chắc muốn xoá dữ liệu?');");

            //Xet quyen login vao trang Start
            if (Session["lstLoginMenu"] != null)
            {
                List<LoginMenuAuthority_Model> lstLoginMenu = (List<LoginMenuAuthority_Model>)Session["lstLoginMenu"];
                string url = HttpContext.Current.Request.RawUrl;
                string[] ArrUrl = url.Split('?');
                string urlCheck = "?" + ArrUrl[1];
                for (int i = 0; i < lstLoginMenu.Count; i++)
                {
                    if (lstLoginMenu[i].HREF == urlCheck && lstLoginMenu[i].Security == 0)
                    {
                        //Session["URLRedirectAfterLogin"] = HttpContext.Current.Request.RawUrl;//Luu session cho trang muon vao
                        Response.Redirect("?s=sigin");
                        return;
                    }
                }
            }
            else
            {
                //Session["URLRedirectAfterLogin"] = HttpContext.Current.Request.RawUrl;//Luu session cho trang muon vao
                Response.Redirect("?s=sigin");
                return;
            }
            //Xet quyen login vao trang End

            imgBtnAnhAvatar.Attributes.Add("onclick", "document.getElementById('" + FileUploadAvatar.ClientID + "').click()");

            daPeople.USP_People_GetByID_Reader(selectedPeopleID);
            daPeople.U_Fetch_Reader(true);

            SelectedPeopleCode = daPeople.fPeopleCode;
            Session["SelectedPeopleCode"] = SelectedPeopleCode;

            lblTenDangNhap.Text = daPeople.fUserName.ToString();
            lblEmail.Text = daPeople.fEmail.ToString();

            txtFirstName.Text = daPeople.fFirstName;
            txtLastName.Text = daPeople.fLastName;

            //Xử lý hiển thị ảnh
            if (daPeople.fPhoto != null)
                Session["Image"] = daPeople.fPhoto.ToString();

            if (daPeople.fBirthday + "" != "")
                txtDateNgaySinh.Text = Common.FormatDateddMMyyyy(Convert.ToDateTime(daPeople.fBirthday));

            //Thường trú
            txtThuongTru.Text = daPeople.fResident;
            txtTT_ToaDo.Text = (daPeople.fLatitude + "").ToString().Replace(",", ".") + ", " + (daPeople.fLongitude + "").ToString().Replace(",", ".");

            if (txtTT_ToaDo.Text == ", ")
                txtTT_ToaDo.Text = "";

            if (Convert.ToBoolean(daPeople.fGender) == true)
            {
                RadioButtonList1.Items[0].Selected = true;
            }
            else
            {
                RadioButtonList1.Items[1].Selected = true;
            }

            //Tạm trú
            txtTamTru.Text = daPeople.fStayProvisionally.ToString();
            txtTam_ToaDo.Text = (daPeople.fLatitudeStayProvisionally + "").ToString().Replace(",", ".") + ", " + (daPeople.fLongitudeStayProvisionally + "").ToString().ToString().Replace(",", ".");
            if (txtTam_ToaDo.Text == ", ")
                txtTam_ToaDo.Text = "";

            txtCellPhone.Text = daPeople.fCellPhone.ToString();
            txtHomePhone.Text = daPeople.fHomePhone.ToString();
            txtYahoo.Text = daPeople.fYahoo.ToString();
            txtSkyper.Text = daPeople.fSkyper.ToString();
            txtFaceweb.Text = daPeople.fSocialWebiste.ToString();
            txtNgheNghiep.Text = daPeople.fCareer.ToString();

            //Cập nhật cho Học viên
            if (SelectedPeopleCode == "HV")
            {
                hv1.Visible = true;
                hv2.Visible = true;
                hv3.Visible = true;
                rwTrangThai.Visible = false;

                //Hiển thị ddlTrangThai Học viên
                tbStatus = tv.SP_SelectDataTable("USP_People_GetStatus", new string[] { "@PeopleCode" }, new object[] { "HV" });
                DataRow dr = tbStatus.NewRow();
                dr["StudentStatusID"] = 0;
                dr["StudentStatusName"] = "-- Chọn --";
                tbStatus.Rows.InsertAt(dr, 0);

                ddlTrangThai.DataSource = tbStatus;
                ddlTrangThai.DataTextField = "StudentStatusName";
                ddlTrangThai.DataValueField = "StudentStatusID";
                ddlTrangThai.DataBind();

                //
                tv = new ThuVien();
                dt = tv.SP_SelectDataTable("USP_Student_GetByID", new string[] { "@StudentID" }, new object[] { selectedPeopleID });

                if (dt.Rows.Count > 0)
                {
                    ddlTrangThai.SelectedIndex = ddlTrangThai.Items.IndexOf(ddlTrangThai.Items.FindByValue(dt.Rows[0]["StudentStatusID"].ToString()));
                    if (dt.Rows[0]["StudentStatusID"] + "" == "3")
                    {
                        hvBaoLuu.Visible = false;
                    }

                    Session["StudentStatusID"] = dt.Rows[0]["StudentStatusID"];

                    txtLoiGioiThieu.Text = dt.Rows[0]["Introduction"].ToString();
                    txtBaiHatUaThich.Text = dt.Rows[0]["FavouriteSong"].ToString();
                    txtKhaNangAmNhac.Text = dt.Rows[0]["Ability"].ToString();
                }

                tv = new ThuVien();
                DataTable tbHV = tv.SP_SelectDataTable("USP_EnterClass_GetBySomeConditional", new string[] { "@flag", "@StudentID" }, new object[] { 2, selectedPeopleID });

                if (tbHV.Rows.Count > 0)
                {
                    string BranchID = tbHV.Rows[0]["BranchID"].ToString();
                    string ClassID = tbHV.Rows[0]["ClassID"].ToString();
                    string DegreeID = tbHV.Rows[0]["DegreeID"].ToString();
                    string Dic_SchoolFeeID = tbHV.Rows[0]["Dic_SchoolFeeID"].ToString();

                    Session["BranchID"] = BranchID;
                    Session["ClassID"] = ClassID;
                    Session["DegreeID"] = DegreeID;
                    Session["Dic_SchoolFeeID"] = Dic_SchoolFeeID;
                }
            }
            else if (SelectedPeopleCode.IndexOf("GV") != -1)
            {
                rwTrangThai.Visible = true;
                gv1.Visible = true;
                gv2.Visible = true;
                gv3.Visible = true;

                //load danh sách Trạng  thái giáo viên
                tv = new ThuVien();
                tbStatus = tv.SP_SelectDataTable("USP_People_GetStatus", new string[] { "@PeopleCode" }, new object[] { "GV" });
                DataRow dr = tbStatus.NewRow();
                dr["TeacherStatusID"] = 0;
                dr["TeacherStatusName"] = "-- Chọn --";
                tbStatus.Rows.InsertAt(dr, 0);

                ddlTrangThai.DataSource = tbStatus;
                ddlTrangThai.DataTextField = "TeacherStatusName";
                ddlTrangThai.DataValueField = "TeacherStatusID";
                ddlTrangThai.DataBind();

                //Load xếp loại giáo viên
                tv = new ThuVien();
                tbXepLoai = tv.SP_SelectDataTable("USP_TeacherType_GetAll", new string[] { }, new object[] { });
                dr = tbXepLoai.NewRow();
                dr["TeacherTypeID"] = 0;
                dr["TeacherTypeName"] = "-- Chọn --";
                tbXepLoai.Rows.InsertAt(dr, 0);

                ddlXepLoai.DataSource = tbXepLoai;
                ddlXepLoai.DataTextField = "TeacherTypeName";
                ddlXepLoai.DataValueField = "TeacherTypeID";
                ddlXepLoai.DataBind();

                tv = new ThuVien();
                dt = tv.SP_SelectDataTable("USP_Teacher_GetBySomeConditional", new string[] { "@flag", "@TeacherID" }, new object[] { 1, selectedPeopleID });

                if (dt.Rows.Count > 0)
                {
                    ddlTrangThai.SelectedIndex = ddlTrangThai.Items.IndexOf(ddlTrangThai.Items.FindByValue(dt.Rows[0]["TeacherStatusID"].ToString()));
                    ddlXepLoai.SelectedIndex = ddlXepLoai.Items.IndexOf(ddlXepLoai.Items.FindByValue(dt.Rows[0]["TeacherTypeID"].ToString()));
                    txtDanhGia.Text = dt.Rows[0]["Evaluate"].ToString();
                    if (dt.Rows[0]["MonthlySalary"] + "" != "")
                        lblLuong.Text = Convert.ToDecimal(dt.Rows[0]["MonthlySalary"]).ToString("#,###");
                }
            }

            //Hiển thị phần chi tiết
            lbHienChiTiet_Click(null, null);
        }
        // imgBtnAnhAvatar.ImageUrl = WebImgFolder + Session["Image"].ToString();

        //Ẩn đi những phần mà Login User không có thẩm quyền
        //Không phải giáo viên
        if (Session["PeopleCode"].ToString().IndexOf("GV") == -1)
        {
            hv1.Visible = false;
            hv2.Visible = false;
            hv3.Visible = false;
        }

        //là giáo viên. Không bao gồm Operator
        if (Session["PeopleCode"].ToString() == "GV")
        {
            rwFace.Visible = false;

            txtLastName.Enabled = false;

            Color clDisable = ColorTranslator.FromHtml("#CCCCCC");
            txtLastName.BackColor = clDisable;

            rwMatKhau.Visible = false;

            txtDateNgaySinh.Enabled = false;
            txtDateNgaySinh.BackColor = clDisable;

            rwNgheNghiep.Visible = false;

            txtHomePhone.Enabled = false;
            txtHomePhone.BackColor = clDisable;

            txtThuongTru.Enabled = false;
            txtThuongTru.BackColor = clDisable;
            //rwToaDoThuongTru.Visible = false;

            txtTamTru.Enabled = false;
            txtTamTru.BackColor = clDisable;
            //rwToaDoTamTru.Visible = false;

            txtFirstName.Enabled = false;
            txtFirstName.BackColor = clDisable;

            txtCellPhone.Enabled = false;
            txtCellPhone.BackColor = clDisable;

            rwXacNhanPass.Visible = false;

            txtYahoo.Enabled = false;
            txtYahoo.BackColor = clDisable;

            txtSkyper.Enabled = false;
            txtSkyper.BackColor = clDisable;

            rwTrangThai.Visible = false;
        }

        //Không phải hiệu trưởng
        if (Session["isHieuTruong"] + "" != "True")
        {
            gv1.Visible = false;
            gv2.Visible = false;
            gv3.Visible = false;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Page.Title = "Lich Day va Hoc";

         //   //Bind data cho combobox ddlTrungTam Start
         //   tv1 = new ThuVien();
         //   tbBranch = tv1.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" });
         //   DataRow drBranch = tbBranch.NewRow();
         //   drBranch["BranchID"] = 0;
         //   drBranch["BranchName"] = "-- Chọn --";
         //   tbBranch.Rows.InsertAt(drBranch, 0);
         //   ddlTrungTam.DataSource = tbBranch;
         //   ddlTrungTam.DataTextField = "BranchName";
         //   ddlTrungTam.DataValueField = "BranchID";
         //   ddlTrungTam.DataBind();

         //tb1 =  tv1.SP_SelectDataTable("USP_People_GetBySomeConditional", new string[] { "@flag", "@PeopleCode" }, new object[] { 4,"GV" });

         //ddlGiaoVien_.DataSource = tb1;
         //ddlGiaoVien_.DataTextField = "PeopleName";
         //ddlGiaoVien_.DataValueField = "TeacherID";
         //ddlGiaoVien_.DataBind();

            //Trang này cho ai vào cũng được, giảm tải thành viên đăng ký
            //Xet quyen login vao trang Start
            //if (Session["lstLoginMenu"] != null)
            //{
            //    List<LoginMenuAuthority_Model> lstLoginMenu = (List<LoginMenuAuthority_Model>)Session["lstLoginMenu"];
            //    string url = HttpContext.Current.Request.RawUrl;
            //    string[] ArrUrl = url.Split('?');
            //    string urlCheck = "?" + ArrUrl[1];
            //    for (int i = 0; i < lstLoginMenu.Count; i++)
            //    {
            //        if (lstLoginMenu[i].HREF == urlCheck && lstLoginMenu[i].Security == 0)
            //        {
            //            ////Session["URLRedirectAfterLogin"] = HttpContext.Current.Request.RawUrl;//Luu session cho trang muon vao
            //            Response.Redirect("?s=sigin");
            //            return;
            //        }
            //    }
            //}
            //else
            //{
            //    ////Session["URLRedirectAfterLogin"] = HttpContext.Current.Request.RawUrl;//Luu session cho trang muon vao
            //    Response.Redirect("?s=sigin");
            //    return;
            //}
            //Xet quyen login vao trang End
        }

        //Chỉ chạy 1 lần
        tv1 = new ThuVien();
        tb = tv1.SP_SelectDataTable("USP_ElseProcedure", new string[] { "@flag", "@Date" }, new object[] { "1", DateTime.Now });
        TuanHienTai = tb.Rows[0]["OrderWeekInMonth"].ToString();
        SoTuanTrongThang = tb.Rows[0]["numberWeekInMonth"].ToString();
    }