Exemple #1
0
        public bool themHocSinhVaoDanhSachLop(string maHS, string ten, string gioiTinh, DateTime ngaySinh, string diaChi, string lop)
        {
            try
            {
                HocSinh hocSinh = new HocSinh();

                hocSinh.MaHS     = maHS;
                hocSinh.HoVaTen  = ten;
                hocSinh.GioiTinh = gioiTinh;
                hocSinh.NgaySinh = ngaySinh;
                hocSinh.DiaChi   = diaChi;

                quanLyTruongHoc.HocSinhs.InsertOnSubmit(hocSinh);
                quanLyTruongHoc.HocSinhs.Context.SubmitChanges();

                Hoc hoc = new Hoc();

                hoc.MaHS = maHS;
                hoc.Lop  = lop;

                quanLyTruongHoc.Hocs.InsertOnSubmit(hoc);
                quanLyTruongHoc.Hocs.Context.SubmitChanges();

                canExecute = true;
            }
            catch
            {
                canExecute = false;
            }

            return(canExecute);
        }
Exemple #2
0
        public Hoc GetData(string id1, string id2)
        {
            string         sql  = string.Format("select * from Hoc where MaHS='{0}' and MaMH='{1}'", id1, id2);
            DataTable      dt   = sqlHelper.Query(sql);
            List <DataRow> list = dt.AsEnumerable().ToList();

            if (list.Count > 0)
            {
                Hoc H = new Hoc();
                H.MaMH        = list[0].ItemArray[0].ToString();
                H.MaHS        = list[0].ItemArray[1].ToString();
                H.DiemTongKet = list[0].ItemArray[2].ToString();
                return(H);
            }
            return(null);
        }
Exemple #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="content"></param>
        /// <param name="mode">one-to-many / one-to-one</param>
        /// <param name="callback"></param>
        private void SendText(string content, SendMode mode, LinccerContentCallback callback)
        {
            // create a plain message
            Hoc hoc = new Hoc();
            hoc.DataList.Add(
                new HocData { Content = content, Type = "text/plain" }
            );

            // share it 1:1, in the Hoccer mobile App, you need to perform a drag in
            // gesture to receive the message  (one-to-many is throw/catch)
            var stringMode = SendModeString.ConvertSendModeToString(mode);
            this._linccer.Share(stringMode, hoc, callback);
        }
Exemple #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="mode">one-to-many / one-to-one</param>
        /// <param name="callback"></param>
        private void SendData(byte[] data, SendMode mode, LinccerContentCallback callback)
        {
            // inialize filecache for temporary up- and downloading large files
            var cache = new FileCache();
            cache.Config = this._config;

            cache.Store(data, TIMEOUT, (uri) =>
            {
                Hoc hoc = new Hoc();
                hoc.DataList.Add(
                    new HocData { Uri = uri }
                );

                var stringMode = SendModeString.ConvertSendModeToString(mode);
                // share it 1:1, in the Hoccer mobile App, you need to perform a drag in
                // gesture to receive the message  (one-to-many is throw/catch)
                this._linccer.Share(stringMode, hoc, callback);
            });
        }
Exemple #5
0
        public frmThaoTacHoc(string id1, string id2)
        {
            _id1 = id1;
            _id2 = id2;
            InitializeComponent();
            hc = new HocController();
            //Xử lý mã Môn
            DataTable      mm   = sqlHelper.Query("SELECT MaMon FROM MonHoc");
            List <DataRow> list = mm.AsEnumerable().ToList();

            for (int i = 0; i < list.Count; i++)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = list[i].ItemArray[0].ToString();
                item.Value = list[i].ItemArray[0].ToString();
                cbMaMon.Items.Add(item);
            }
            //Xử lý mã HocSinh
            DataTable      mhs   = sqlHelper.Query("SELECT MaHS FROM HocSinh");
            List <DataRow> list1 = mhs.AsEnumerable().ToList();

            for (int i = 0; i < list1.Count; i++)
            {
                ComboboxItem item1 = new ComboboxItem();
                item1.Text  = list1[i].ItemArray[0].ToString();
                item1.Value = list1[i].ItemArray[0].ToString();
                cbMaHS.Items.Add(item1);
            }
            if (id1 == null || id2 == null)
            {
                cbMaMon.Enabled   = true;
                cbMaHS.Enabled    = true;
                groupBox1.Visible = false;
                picAvtat.Visible  = false;
                return;
            }
            Hoc h = new Hoc();

            h = hc.GetData(id1, id2);

            txtDiemTK.Text = h.DiemTongKet;
            for (int i = 0; i < list.Count; i++)
            {
                if (h.MaMH == list[i].ItemArray[0].ToString())
                {
                    cbMaMon.SelectedIndex = i;
                    h.MaMH = cbMaMon.Text;
                    break;
                }
            }
            for (int i = 0; i < list1.Count; i++)
            {
                if (h.MaHS == list1[i].ItemArray[0].ToString())
                {
                    cbMaHS.SelectedIndex = i;
                    h.MaHS = cbMaHS.Text;
                    break;
                }
            }

            //string s = string.Format("SELECT * FROM HocSinh where MaHS={0}", id1);
            //DataTable dtIF = sqlHelper.Query(s);
            HocSinh hsif = new HocSinh();

            Controller.HocSinhController hscf = new Controller.HocSinhController();
            hsif = hscf.GetData(h.MaHS);
            string NS = DateTime.Parse(hsif.NgaySinh).Date.ToString() + DateTime.Parse(hsif.NgaySinh).Month.ToString() + DateTime.Parse(hsif.NgaySinh).Year.ToString();

            lblTen.Text  = "Họ Tên: " + hsif.HoTen;
            lblTuoi.Text = "Ngày Sinh: " + NS;
            try
            {
                if (hsif.GioiTinh == "False")
                {
                    lblGioiTinh.Text = "Giới Tính: Nam";
                    picAvtat.Image   = Image.FromFile(Application.StartupPath + "\\Resources\\user1600.png");
                }
                else if (hsif.GioiTinh == "True")
                {
                    lblGioiTinh.Text = "Giới Tính: Nữ";
                    picAvtat.Image   = Image.FromFile(Application.StartupPath + "\\Resources\\nanny-icon.png");
                }
            }
            catch { }
        }