Ejemplo n.º 1
0
        void salePointListController_CompletedDeleteSalePointEvent(object sender, SalePointListEventArgs e)
        {
            // detach currency manager
            //CurrencyManager currencyManager1 = bdsSalePointList.CurrencyManager;
            //bdsSalePointList.SuspendBinding();
            // set visible = false
            // update list
            IList<Department> departments = SalePointListController.DepartmentList;
            int i = departments.Count - 1;
            while (i >= 0)
            {
                if (departments[i].DelFlg == 1)
                {
                    departments.RemoveAt(i);
                }

                i -= 1;
            }
            //bdsSalePointList.ResumeBinding();
            ModelToForm();
            bdsSalePointList.ResetBindings(true);

            dgvDepartments.Invalidate();
            MessageBox.Show("Departments have been deleted !");
        }
Ejemplo n.º 2
0
 void salePointListController_CompletedLoadDepartmentsEvent(object sender, SalePointListEventArgs e)
 {
     bdsSalePointList.DataSource = e.DepartmentList;
 }
Ejemplo n.º 3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Bạn có chắc bạn muốn xoá cửa hàng này ?", "Xác nhận",
                                                  MessageBoxButtons.YesNo);
            if(result == DialogResult.No)
            {
                return;
            }
            DataGridViewSelectedRowCollection selectedList = dgvDepartments.SelectedRows;
            if (selectedList.Count <= 0)
            {
                return;
            }

            // delete department
            foreach (DataGridViewRow o in selectedList)
            {
                int delIndex = o.Index;
                ((Department) bdsSalePointList[delIndex]).DelFlg = 1;
            }
            SalePointListEventArgs salePointListEventArgs = new SalePointListEventArgs();
            SalePointListController.DepartmentList = bdsSalePointList.DataSource as IList<Department>;
            EventUtility.fireAsyncEvent(DeleteSalePointEvent,this,salePointListEventArgs,new AsyncCallback(EndEvent));
        }
Ejemplo n.º 4
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection selectedList = dgvDepartments.SelectedRows;
            if(selectedList.Count <= 0)
            {
                return;
            }
            DataGridViewRow selectedRow = selectedList[0];
            SalePointListEventArgs salePointListEventArgs = new SalePointListEventArgs();
            int selectedIndex = selectedRow.Index;
            salePointListEventArgs.SelectedDepartment = bdsSalePointList[selectedRow.Index] as Department;
            this.Enabled = false;

            EventUtility.fireEvent(EditSalePointEvent,this,salePointListEventArgs);

            if(salePointListEventArgs.EditedDepartment!=null)
            {
                bdsSalePointList[selectedIndex] = salePointListEventArgs.EditedDepartment;
                bdsSalePointList.EndEdit();
                dgvDepartments.Refresh();
                dgvDepartments.Invalidate();
            }
            this.Enabled = true;
        }
Ejemplo n.º 5
0
 void salePointListView_LoadDepartmentsEvent(object sender, SalePointListEventArgs e)
 {
     ObjectCriteria criteria = new ObjectCriteria();
     criteria.AddEqCriteria("DelFlg",(long)0);
     IList list = DepartmentLogic.FindAll(criteria);
     SalePointListEventArgs eventArgs = new SalePointListEventArgs();
     eventArgs.DepartmentList = ObjectConverter.ConvertGenericList<Department>(list);
     EventUtility.fireEvent(CompletedLoadDepartmentsEvent,this,eventArgs);
 }
Ejemplo n.º 6
0
 void salePointListView_HelpEvent(object sender, SalePointListEventArgs e)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
        void salePointListView_EditSalePointEvent(object sender, SalePointListEventArgs e)
        {
            SalePointForm form = GlobalUtility.GetFormObject<SalePointForm>(FormConstants.SALEPOINT_FORM);

            //e.SelectedDepartment = this.LoadDepartment(e.SelectedDepartment);
            form.SalePointController.DepartmentModel = e.SelectedDepartment;
            e.SelectedDepartment = null;
            form.Status = ViewStatus.EDIT;

            form.ModelToForm();

            form.ShowDialog((Form) sender);
            //GlobalUtility.ShowForm(form);
            //e.EditedDepartment = selectedDepartment;
        }
Ejemplo n.º 8
0
 void salePointListView_DeleteSalePointEvent(object sender, SalePointListEventArgs e)
 {
     foreach (Department department in DepartmentList)
     {
         if(department.DelFlg == 1)
         {
             DepartmentLogic.Update(department);
         }
     }
     EventUtility.fireEvent(CompletedDeleteSalePointEvent,this,new SalePointListEventArgs());
 }
Ejemplo n.º 9
0
        void salePointListView_AddSalePointEvent(object sender, SalePointListEventArgs e)
        {
            SalePointForm form = GlobalUtility.GetOnlyChildFormObject<SalePointForm>(GlobalCache.Instance().MainForm,
                                                   FormConstants.SALEPOINT_FORM);
            //SalePointForm form = GlobalUtility.GetFormObject<SalePointForm>(FormConstants.SALEPOINT_FORM);
            Department department = new Department();

            form.SalePointController.DepartmentModel = department;
            form.Status = ViewStatus.ADD;

            //form.ShowDialog((Form) sender);
            //form.ModelToForm();
            GlobalUtility.ShowForm(form);
            //form.ShowDialog();
        }