Exemplo n.º 1
0
        //Dếm số bản ghi
        public int TongBanGhi(diem diem)
        {
            string strdiem = "select count(*) from diem where masv='" + diem.Masv + "' and mamh='" + diem.Mamh + "' and diemlan='" + diem.Diemlan + "'";
            int    tbg     = trinh.KiemTraMaTrung(strdiem);

            return(tbg);
        }
Exemplo n.º 2
0
        public bool delete(string madiem)
        {
            diem diem = db.diems.SingleOrDefault(x => x.madiem == madiem);

            if (diem != null)
            {
                db.diems.Remove(diem);
                db.SaveChanges();
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            diem mh = new diem();

            if (mh.checkmsv(txt_masv.Text) == true)
            {
                string url = "~/dsdiem2.aspx?user="******"Không có Mã sinh viên này";
                Label1.Visible = true;
            }
        }
Exemplo n.º 4
0
 public ActionResult UploadFileDiem(HttpPostedFileBase FileUpload)
 {
     if (FileUpload == null || FileUpload.ContentLength == 0)
     {
         Session["ErrorMess"] = "Please select a excel file";
         return(RedirectToAction("Score", "PDT"));
     }
     else
     {
         if (FileUpload.FileName.EndsWith("xls") || (FileUpload.FileName.EndsWith("xlsx")))
         {
             string location = Server.MapPath("~/Content/" + FileUpload.FileName);
             if (System.IO.File.Exists(location))
             {
                 System.IO.File.Delete(location);
             }
             FileUpload.SaveAs(location);
             //Read data from excel
             Excel.Application application = new Excel.Application();
             Excel.Workbook    workbook    = application.Workbooks.Open(location);
             Excel.Worksheet   worksheet   = workbook.ActiveSheet;
             Excel.Range       range       = worksheet.UsedRange;
             for (int row = 2; row <= range.Rows.Count; row++)
             {
                 diem diem = new diem();
                 diem.madiem   = ((Excel.Range)range.Cells[row, 1]).Text;
                 diem.diemQT   = double.Parse(((Excel.Range)range.Cells[row, 2]).Text);
                 diem.diemGK   = double.Parse(((Excel.Range)range.Cells[row, 3]).Text);
                 diem.diemCK   = double.Parse(((Excel.Range)range.Cells[row, 4]).Text);
                 diem.C_diemQT = double.Parse(((Excel.Range)range.Cells[row, 5]).Text);
                 diem.C_diemGK = double.Parse(((Excel.Range)range.Cells[row, 6]).Text);
                 diem.C_diemck = double.Parse(((Excel.Range)range.Cells[row, 7]).Text);
                 diem.solanthi = int.Parse(((Excel.Range)range.Cells[row, 8]).Text);
                 diem.tongdiem = double.Parse(((Excel.Range)range.Cells[row, 9]).Text);
                 db.diems.Add(diem);
                 db.SaveChanges();
             }
             var lst = db.diems.ToList();
             Session["ErrorMess"] = "Success!";
             return(RedirectToAction("Score", "PDT"));
         }
         else
         {
             Session["ErrorMess"] = "File type is incorrect!";
             return(RedirectToAction("Score", "PDT"));
         }
     }
 }
Exemplo n.º 5
0
        public bool edit(string id, double?diemqt, double?diemgk, double?diemck)
        {
            diem d = db.diems.SingleOrDefault(x => x.madiem == id);

            if (d != null)
            {
                d.diemQT   = diemqt;
                d.diemGK   = diemgk;
                d.diemCK   = diemck;
                d.tongdiem = ((d.diemQT * d.C_diemQT) / 100) + ((d.diemGK * d.C_diemGK) / 100) + ((d.diemCK * d.C_diemck) / 100);
                db.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 6
0
 //Sửa mon hoc
 public void suadiem(diem diem)
 {
     trinh.suadiem(diem);
 }
Exemplo n.º 7
0
 public void Insert(diem diem)
 {
     db.diems.Add(diem);
     db.SaveChanges();
 }
Exemplo n.º 8
0
 public DataTable timkiemtheomamh(diem diem)
 {
     return(trinh.timkiemtheomamh(diem));
 }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            diem          ds = new diem();
            string        st_msv = Request.QueryString.Get("user").ToString();
            Clsconnect    cls_con = new Clsconnect();
            SqlCommand    sqlcm, sqlcm1;
            SqlDataReader re;
            string        check;

            check = Request.QueryString.Get("type");
            try
            {
                if (check == null)
                {
                    lbl_tb.Text    = "";
                    lbl_tb.Visible = true;
                }
                else if (check.ToString() == "update")
                {
                    lbl_tb.Text    = "Cập nhật điểm thành công";
                    lbl_tb.Visible = true;
                }
                cls_con.connect_Data();
                string query1 = "Select tensv, tbl_sinhvien.Masv, tencn,tenlop from tbl_sinhvien inner join tbl_chuyennganh on chuyennganh = macn inner join tbl_addlop on tbl_addlop.MaSv = tbl_sinhvien.Masv  inner join tbl_lop on tbl_addlop.Malop=tbl_lop.malop  where tbl_sinhvien.Masv=" + st_msv;
                string tensv = "", masv1 = "", cn = "", tenlop = "";
                sqlcm1 = new SqlCommand(query1, cls_con.con);
                SqlDataReader re1 = sqlcm1.ExecuteReader();
                while (re1.Read())
                {
                    tensv  = re1.GetValue(0).ToString();
                    masv1  = re1.GetValue(1).ToString();
                    cn     = re1.GetValue(2).ToString();
                    tenlop = re1.GetValue(3).ToString();
                }
                re1.Close();
                lbl_tensv.Text = tensv;
                lbl_masv.Text  = masv1;
                lbl_cn.Text    = cn;
                lbl_lop.Text   = tenlop;

                string st_kq = "";
                string query = "SELECT tbl_addmonhoc.MaMH,TenMH,DiemC,DiemB,DiemA,TongKet,TinChi FROM dbo.tbl_diem INNER JOIN dbo.tbl_addmonhoc ON tbl_addmonhoc.MaDk = tbl_diem.MaDk INNER JOIN dbo.tbl_monhoc ON tbl_monhoc.MaMH = tbl_addmonhoc.MaMH WHERE dbo.tbl_diem.MaSv =" + st_msv;
                st_kq = "<table class='w3-table w3-striped w3-bordered w3-border w3-hoverable w3-white w3-card'>";
                st_kq = st_kq + "<tr class='w3-blue w3-center'><td><b>STT</b></td><td><b>Mã môn</b></td><td><b>Tên môn học</b></td><td><b>Tín chỉ</b></td><td><b>Điểm C</b></td><td><b>Điểm B</b></td><td><b>Điểm A</b></td><td><b>Tổng Kết(10)</b></td><td><b>Tổng Kết(CH)</b></td></tr>";
                sqlcm = new SqlCommand(query, cls_con.con);
                re    = sqlcm.ExecuteReader();

                byte i = 0;
                while (re.Read())
                {
                    i++;
                    string temp = re.GetValue(5).ToString();
                    string tkch = "";
                    double tkso = double.Parse(temp);
                    if (tkso < 4.0)
                    {
                        tkch = "F";
                    }
                    else
                    if (tkso <= 4.9)
                    {
                        tkch = "D";
                    }
                    else
                    if (tkso <= 5.4)
                    {
                        tkch = "D+";
                    }
                    else
                    if (tkso < 6.4)
                    {
                        tkch = "C";
                    }
                    else
                    if (tkso < 6.9)
                    {
                        tkch = "C+";
                    }
                    else
                    if (tkso < 7.9)
                    {
                        tkch = "B";
                    }
                    else
                    if (tkso < 8.4)
                    {
                        tkch = "B+";
                    }
                    else
                    {
                        tkch = "A";
                    }
                    st_kq = st_kq + "  <tr><td>" + i.ToString() + "</td><td>" + re.GetValue(0).ToString() + "</td ><td>" + re.GetValue(1).ToString() + "</td ><td>" + re.GetValue(6).ToString() + "</td ><td>" + re.GetValue(2).ToString() + "</td ><td>" + re.GetValue(3).ToString() + "</td ><td>" + re.GetValue(4).ToString() + "</td ><td>" + re.GetValue(5).ToString() + "</td ><td>" + tkch + "</td ></tr > ";
                }
                re.Close();
                st_kq      = st_kq + "</table>";
                dsach.Text = st_kq;
            }
            finally
            {
                cls_con.close_Data();
            }
            Label1.Text = ds.tongket(st_msv).ToString();
            Label2.Text = ds.tongket1(st_msv).ToString();
            Label3.Text = ds.tinchi(st_msv);
        }
Exemplo n.º 10
0
 public void xoadiem(diem diem)
 {
     trinh.xoadiem(diem);
 }
Exemplo n.º 11
0
 public int kiemtramatrung(diem diem)
 {
     return(trinh.kiemtramatrung(diem));
 }
Exemplo n.º 12
0
 //Thêm mon hoc
 public void themdiem(diem diem)
 {
     trinh.themdiem(diem);
 }
Exemplo n.º 13
0
        public int kiemtramatrung(diem diem)
        {
            string dembanghi = "Select count(*) from diem where masv='" + diem.Masv + "' and mamh='" + diem.Mamh + "' and diemlan='" + diem.Diemlan + "'";

            return(trinh.KiemTraMaTrung(dembanghi));
        }
Exemplo n.º 14
0
 //Dếm số bản ghi
 public int TongBanGhi(diem diem)
 {
     return(trinh.TongBanGhi(diem));
 }
Exemplo n.º 15
0
        public void xoadiem(diem diem)
        {
            string xoa = "delete from diem  where masv='" + diem.Masv + "' and mamh='" + diem.Mamh + "' and diemlan='" + diem.Diemlan + "'";

            trinh.ThucThi(xoa);
        }
Exemplo n.º 16
0
        //Sửa mon hoc
        public void suadiem(diem diem)
        {
            string sua = "update diem set  diemlan='" + diem.Diemlan + "', masv='" + diem.Masv + "',mamh='" + diem.Mamh + "',diemghp='" + diem.Diemghp + "',diembtc='" + diem.Diembtc + "',diemth='" + diem.Diemth + "',diemkthp='" + diem.Diemkthp + "',diemtb='" + diem.Diemtb + "' where masv='" + diem.Masv + "' and mamh='" + diem.Mamh + "' and diemlan='" + diem.Diemlan + "'";

            trinh.ThucThi(sua);
        }
Exemplo n.º 17
0
        //Thêm mon hoc
        public void themdiem(diem diem)
        {
            string strthem = "insert into diem values('" + diem.Masv + "','" + diem.Mamh + "','" + diem.Diemghp + "','" + diem.Diembtc + "','" + diem.Diemth + "','" + diem.Diemkthp + "','" + diem.Diemtb + "','" + diem.Diemghplan2 + "','" + diem.Diemlan + "')";

            trinh.ThucThi(strthem);
        }
Exemplo n.º 18
0
        public DataTable timkiemtheomamh(diem diem)
        {
            string strdiem = "select * from diem where mamh='" + diem.Mamh + "'";

            return(trinh.LoadDuLieu(strdiem));
        }