Пример #1
0
        void stockInConfirmView_ConfirmStockInEvent(object sender, StockInConfirmEventArgs e)
        {
            try
            {
                ObjectCriteria objectCriteria = new ObjectCriteria();
                objectCriteria.AddSearchInCriteria("StockInId", e.ConfirmStockInList);
                objectCriteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
                IList stockInList = StockInLogic.FindAll(objectCriteria);

                if (stockInList != null && stockInList.Count > 0)
                {
                    foreach (StockIn stockIn in stockInList)
                    {
                        if (stockIn.ConfirmFlg == 1)
                        {
                            stockIn.ConfirmFlg = 0;
                            StockInLogic.Update(stockIn);
                        }
                    }
                }
                else
                {
                    throw new BusinessException("Khong co gi de luu");
                }
            }
            catch (Exception exception)
            {
                e.EventResult = " Error !";
                e.HasErrors = true;
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection selectedRows = dgvStockIn.SelectedRows;
            if (!(selectedRows.Count > 0))
            {
                return;
            }

            StockInConfirmEventArgs eventArgs = new StockInConfirmEventArgs();

            IList list = new ArrayList();
            foreach (DataGridViewRow row in selectedRows)
            {
                list.Add(dgvStockIn[0, row.Index].Value.ToString());
            }

            eventArgs.DenyStockInList = list;
            EventUtility.fireEvent(DenyStockInEvent, this, eventArgs);
            if (!eventArgs.HasErrors)
            {
                MessageBox.Show("Lưu thành công!");
                // reload db
                confirm_stock_in_detailTableAdapter.Fill(masterDB.confirm_stock_in_detail, "");
                confirmstockindetailBindingSource.ResetBindings(false);
                dgvStockInDetail.Refresh();
                dgvStockInDetail.Invalidate();
                confirm_stock_inTableAdapter.Fill(masterDB.confirm_stock_in, 1, DateUtility.ZeroTime(dtpFrom.Value), DateUtility.MaxTime(dtpTo.Value));
                confirmstockinBindingSource.ResetBindings(false);
                dgvStockIn.Refresh();
                dgvStockIn.Invalidate();
            }
            else
            {
                MessageBox.Show("Lưu thất bại!");
            }
            ClearForm();
        }
Пример #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgvStockIn.CurrentCell == null)
            {
                return;
            }
            string stockInId = dgvStockIn[0, dgvStockIn.CurrentCell.OwningRow.Index].Value.ToString();
            StockInConfirmEventArgs eventArgs = new StockInConfirmEventArgs();
            eventArgs.StockInId = stockInId;
            EventUtility.fireEvent(LoadStockInEvent,this,eventArgs);

            MainStockInEditExtraForm editExtraForm =
                GlobalUtility.GetFormObject<MainStockInEditExtraForm>(FormConstants.MAIN_STOCK_IN_EDIT_EXTRA_FORM);

            editExtraForm.StockIn = eventArgs.StockIn;
            editExtraForm.Closed += new EventHandler(editExtraForm_Closed);
            editExtraForm.ShowDialog();
        }
Пример #4
0
 void stockInConfirmView_LoadStockInEvent(object sender, StockInConfirmEventArgs e)
 {
     StockIn stockIn = StockInLogic.FindById(e.StockInId);
     if (stockIn != null)
     {
         foreach (StockInDetail inDetail in stockIn.StockInDetails)
         {
             inDetail.OldQuantity = inDetail.Quantity;
         }
         e.StockIn = stockIn;
     }
 }