Пример #1
0
        void Remove_Student_Of_Classes()
        {
            int iStudentId = 0;

            int.TryParse("" + gridViewStudent.GetFocusedRowCellValue("Id"), out iStudentId);
            if (iStudentId > 0)
            {
                string       sFullName = "" + gridViewStudent.GetFocusedRowCellValue("FullName");
                DialogResult dr        = MessageBox.Show(string.Format("Bạn có chắc muốn đưa học viên: {0} ra khỏi lớp này?", sFullName),
                                                         "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dr == DialogResult.Yes)
                {
                    StudentClasses oStudent = new StudentClasses
                    {
                        Id = iStudentId
                    };
                    bool isResult = new StudentClassesBll(mAccount).DeleteElement(oStudent);
                    //MessageBox.Show("- iStudentId: "+ iStudentId);
                    foreach (StudentClasses o in mLisStudentClasses)
                    {
                        if (o.Id == oStudent.Id)
                        {
                            mLisStudentClasses.Remove(o);
                            break;
                        }
                    }
                    gridControlStudent.DataSource = mLisStudentClasses;
                    gridControlStudent.RefreshDataSource();
                    gridControlStudent.Update();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Hàm binding dữ liệu sinh viên được chọn lên tabpageHistory
        /// Author          Date        Comment
        /// hungld       05/02/2013     Tạo mới
        /// </summary>

        private void xtraTabControlStudent_Click_1(object sender, EventArgs e)
        {
            //if (tabHocVienTiemNang.SelectedTabPageIndex == 1)
            //{
            //    int.TryParse("" + gridViewStudent.GetFocusedRowCellValue("Id"), out _IdStudent);
            //    //IdStudent = Convert.ToInt32(gridViewStudent.GetFocusedRowCellValue("Id"));
            //    if (IdStudent > 0)
            //    {
            //        loadLastHistorySupportComment();
            //        displaySupportComment();
            //        //if (txtUserName.Text == eCenterSystem.UserName)
            //        //{
            //        //    btnSua.Enabled = true;
            //        //}
            //    }
            //}
            /*else*/
            if (tabHocVienTiemNang.SelectedTabPageIndex == 2)
            {
                //txtName.Text = "" + gridViewStudent.GetFocusedRowCellValue("FullName");
                txt_Email.Text  = "" + gridViewStudent.GetFocusedRowCellValue("Email");
                txt_Mobile.Text = "" + gridViewStudent.GetFocusedRowCellValue("Mobile");
                //if (gridViewStudent.GetFocusedRowCellValue("Email") != null)
                //{
                //    txt_Email.Text = new Common().DecryptInfo("" + gridViewStudent.GetFocusedRowCellValue("Email"));
                //}
                //else
                //{
                //    txt_Email.Text = "";
                //}
                //if (gridViewStudent.GetFocusedRowCellValue("Mobile") != null)
                //{
                //    txt_Mobile.Text = new Common().DecryptInfo("" + gridViewStudent.GetFocusedRowCellValue("Mobile"));
                //}
                //else
                //{
                //    txt_Mobile.Text = "";
                //}
                //LoadHocPhi();
                List <StudentClasses> lstStudentClasses = new StudentClassesBll(mAccount).CheckElementById(mStudentLists.Id);
                gridControlHP.DataSource = lstStudentClasses;

                uluClasses.Properties.DisplayMember = "ClassName";
                uluClasses.Properties.ValueMember   = "ClassId";
                uluClasses.Properties.DataSource    = lstStudentClasses;
            }
        }
Пример #3
0
        private void uluClasses_EditValueChanged(object sender, EventArgs e)
        {
            List <StudentClasses> lstStudentClasses = new StudentClassesBll(mAccount).CheckElementById(mStudentLists.Id);

            foreach (StudentClasses item in lstStudentClasses)
            {
                if (uluClasses.Text == item.ClassName)
                {
                    List <StudentClasses> lst = new List <StudentClasses>();
                    lst.Add(item);
                    gridControlHP.DataSource = lst;

                    //gridControlHP.RefreshDataSource();
                    //gridControlHP.Update();


                    break;
                }
            }
        }
        private void btnHoanTatChonHv_Click(object sender, EventArgs e)
        {
            //try
            //{
            //    this.Cursor = Cursors.WaitCursor;
            //    mClasses = new ClassesBll(mAccount).getElementById(mClasses.Id);
            //    List<StudentClasses> lstStudentClasses = new List<StudentClasses>();
            //    foreach (StudentLists item in lstselected)
            //    {
            //        StudentClasses obj = new StudentClasses
            //        {
            //            ClassId = mClasses.Id,
            //            StudentId = item.Id,
            //            DateStart = DateTime.Parse(mClasses.DateStart.ToString()),
            //            TotalPrice = (int)mClasses.TotalPrice,
            //            FullName = item.FullName

            //        };
            //        lstStudentClasses.Add(obj);
            //    }
            //    StudentClassesBll mStudentClassesBll = new StudentClassesBll(mAccount);
            //    int i = 0;
            //    foreach (StudentClasses item in lstStudentClasses)
            //    {

            //        if(mStudentClassesBll.InsertElement(item) == false)
            //        {
            //            MessageBox.Show("Thêm học viên" + item.FullName + "Thất bại!");
            //            i++;
            //        }
            //    }
            //    if(i == 0)
            //    {
            //        MessageBox.Show("Tất cả học viên đã thêm thành công!");
            //    }
            //    else
            //    {
            //        MessageBox.Show("Các học viên còn lại đã thêm thành công!");
            //    }
            //    this.Close();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
            //finally
            //{
            //    this.Cursor = Cursors.Default;
            //}
            mClasses = new ClassesBll(mAccount).getElementById(mClasses.Id);
            List <StudentClasses> lstStudentClasses = new List <StudentClasses>();

            //MessageBox.Show(mClasses.FromDate.ToString());
            foreach (StudentLists item in lstselected)
            {
                StudentClasses obj = new StudentClasses();

                obj.ClassId   = mClasses.Id;
                obj.StudentId = item.Id;
                obj.DateStart = DateTime.Parse(mClasses.FromDate.ToString());
                if (mClasses.TotalPrice != null)
                {
                    obj.TotalPrice = (int)mClasses.TotalPrice;
                }
                else
                {
                    obj.TotalPrice = 0;
                }
                obj.FullName = item.FullName;


                lstStudentClasses.Add(obj);
            }
            StudentClassesBll mStudentClassesBll = new StudentClassesBll(mAccount);
            int i = 0;

            foreach (StudentClasses item in lstStudentClasses)
            {
                if (mStudentClassesBll.InsertElement(item) == false)
                {
                    MessageBox.Show("Thêm học viên" + item.FullName + "Thất bại!");
                    i++;
                }
            }
            if (i == 0)
            {
                MessageBox.Show("Tất cả học viên đã thêm thành công!");
            }
            else
            {
                MessageBox.Show("Các học viên còn lại đã thêm thành công!");
            }
            this.Close();
        }