示例#1
0
        private void cmbItemCode_EditValueChanged(object sender, EventArgs e)
        {
            if (cmbItemCode.EditValue == null)
            {
                return;
            }
            try
            {
                int rowhandle = cmbLookupView.LocateByValue("ITEMCODEID", cmbItemCode.EditValue);
                txtItemName.EditValue = cmbLookupView.GetRowCellValue(rowhandle, "ITEMNAME");
                cmbCategory.EditValue = cmbLookupView.GetRowCellValue(rowhandle, "CATEGORYID");

                DataTable dtMRPList = new ItemRepository().GetMRPList(cmbItemCode.EditValue);
                if (dtMRPList.Rows.Count > 1)
                {
                    frmMRPSelection obj = new frmMRPSelection(dtMRPList, cmbItemCode.Text, txtItemName.EditValue);
                    obj.ShowDialog();
                    if (obj._IsSave)
                    {
                        txtMRP.EditValue       = ((DataRowView)obj.drSelected)["MRP"];
                        txtSalePrice.EditValue = ((DataRowView)obj.drSelected)["SALEPRICE"];
                    }
                }
                else
                {
                    txtMRP.EditValue       = dtMRPList.Rows[0]["MRP"];
                    txtSalePrice.EditValue = dtMRPList.Rows[0]["SALEPRICE"];
                }
                object allowOpenItems = (cmbCategory.GetSelectedDataRow() as DataRowView)["ALLOWOPENITEMS"];
                if (allowOpenItems.Equals(true))
                {
                    dtpPackedDate.Enabled  = true;
                    txtBatchNumber.Enabled = true;
                }
                txtQuantity.EditValue = 1;
            }
            catch (Exception ex) {}
        }
        private void sluItemCode_EditValueChanged(object sender, EventArgs e)
        {
            if (sluItemCode.EditValue == null)
            {
                return;
            }
            int rowHandle = sluItemCodeView.LocateByValue("ITEMCODEID", sluItemCode.EditValue);

            txtItemCode.EditValue = sluItemCodeView.GetRowCellValue(rowHandle, "ITEMCODE");
            isOpenItem            = Convert.ToBoolean(sluItemCodeView.GetRowCellValue(rowHandle, "ISOPENITEM"));
            DataTable dtPrices = new ItemRepository().GetMRPList(sluItemCode.EditValue);

            if (dtPrices.Rows.Count > 1)
            {
                frmMRPSelection mRPSelection = new frmMRPSelection(dtPrices, txtItemCode.EditValue, sluItemCode.Text)
                {
                    StartPosition = FormStartPosition.CenterScreen
                };
                mRPSelection.ShowDialog();
                if (!mRPSelection._IsSave)
                {
                    ClearItemData();
                    return;
                }

                drSelectedPrice = (mRPSelection.drSelected as DataRowView)?.Row;
            }
            else if (dtPrices.Rows.Count == 1)
            {
                drSelectedPrice = dtPrices.Rows[0];
            }

            if (drSelectedPrice == null)
            {
                return;
            }

            txtMRP.EditValue       = drSelectedPrice["MRP"];
            txtSalePrice.EditValue = drSelectedPrice["SALEPRICE"];
            txtQuantity.EditValue  = 1;
            if (isOpenItem)
            {
                txtWeightInKgs.Enabled = true;
                txtQuantity.EditValue  = 1;
                txtQuantity.Enabled    = false;
            }
            else
            {
                txtWeightInKgs.EditValue = "0.00";
                txtWeightInKgs.Enabled   = false;
                txtQuantity.Enabled      = true;
            }
            if (!isItemScanned)
            {
                if (isOpenItem)
                {
                    txtWeightInKgs.Focus();
                }
                else
                {
                    txtQuantity.Focus();
                }
            }
        }