protected override void add()
 {
     saveOrderQty();
     InventoryStockLevel.add((Guid)_inputDDLGrades.SelectedValue, (Guid)_inputDDLProducts.SelectedValue, (Guid)_inputDDLProductWidths.SelectedValue,
                             (Guid)_inputDDLLengthUnits.SelectedValue, (Guid)_inputDDLColors.SelectedValue, Convert.ToInt32(Tools.zeroNonNumericString(_inputTxtQty.TextValue)),
                             Convert.ToInt32(Tools.zeroNonNumericString(_inputTxtOrderLotQty.TextValue)), _inputTxtPONotes.TextValue, _inputTxtNotes.TextValue);
 }
 protected override System.Data.DataView loadGridviewDataSource()
 {
     if (Mode == FormMode.New)
     {
         return(InventoryStockLevel.getAll(null, null, null, null, null, null, false).DefaultView);
     }
     else
     {
         return(InventoryStockLevel.getAll(_inputDDLGrades.SelectedValue, _inputDDLProducts.SelectedValue, _inputDDLProductWidths.SelectedValue,
                                           _inputDDLLengthUnits.SelectedValue, _inputDDLColors.SelectedValue, _inputDDLVendors.SelectedValue, false).DefaultView);
     }
 }
        protected override void populateInputFields()
        {
            InventoryStockLevel obj = new InventoryStockLevel(selectedRowID());

            _inputDDLVendors.SelectedValue       = obj.VendorID;
            _inputDDLProducts.SelectedValue      = obj.ProductID;
            _inputDDLGrades.SelectedValue        = obj.GradeID;
            _inputDDLProductWidths.SelectedValue = obj.ProductWidthID;
            _inputDDLLengthUnits.SelectedValue   = obj.LengthUnitID;
            _inputDDLColors.SelectedValue        = obj.ColorID;
            _inputTxtOrderLotQty.TextValue       = obj.OrderLotQty.ToString();
            _inputTxtQty.TextValue     = obj.Qty.ToString();
            _inputTxtPONotes.TextValue = obj.PONotes;
            _inputTxtNotes.TextValue   = obj.Notes;
        }
        protected override Boolean isInputFieldsValid()
        {
            if (_inputDDLProducts.SelectedValue == null)
            {
                return(_inputDDLProducts.SelectedValueError("Please select product"));
            }
            else if (_inputDDLGrades.SelectedValue == null)
            {
                return(_inputDDLGrades.SelectedValueError("Please select grade"));
            }
            else if (_inputDDLProductWidths.SelectedValue == null)
            {
                return(_inputDDLProductWidths.SelectedValueError("Please select width"));
            }
            else if (_inputDDLLengthUnits.SelectedValue == null)
            {
                return(_inputDDLLengthUnits.SelectedValueError("Please select unit"));
            }
            else if (_inputDDLColors.SelectedValue == null)
            {
                return(_inputDDLColors.SelectedValueError("Please select color"));
            }
            else if ((Mode != FormMode.Update && InventoryStockLevel.isCombinationExist(null, (Guid)_inputDDLGrades.SelectedValue, (Guid)_inputDDLProducts.SelectedValue, (Guid)_inputDDLProductWidths.SelectedValue,
                                                                                        (Guid)_inputDDLLengthUnits.SelectedValue, (Guid)_inputDDLColors.SelectedValue)) ||
                     (Mode == FormMode.Update && InventoryStockLevel.isCombinationExist(selectedRowID(), (Guid)_inputDDLGrades.SelectedValue, (Guid)_inputDDLProducts.SelectedValue, (Guid)_inputDDLProductWidths.SelectedValue,
                                                                                        (Guid)_inputDDLLengthUnits.SelectedValue, (Guid)_inputDDLColors.SelectedValue)))
            {
                return(_inputDDLProducts.SelectedValueError("Combination is already in the list"));
            }
            else if (!Tools.isNumeric(_inputTxtOrderLotQty.TextValue))
            {
                return(_inputTxtQty.TextError("Invalid qty. Harus lebih dari 0."));
            }
            else if (!string.IsNullOrEmpty(_inputTxtQty.TextValue) && !Tools.isNumeric(_inputTxtQty.TextValue))
            {
                return(_inputTxtQty.TextError("Invalid qty"));
            }

            return(true);
        }
 protected override void executeAction1()
 {
     InventoryStockLevel.delete(selectedRowID());
     base.executeAction1();
 }