Exemple #1
0
        private void InitializeScreen()
        {
            this.cboCurrency.Format += Common.ComboBox_Format;

            dmcSalesUnitPrice.AddRangeControl(
                txtMasterNo,
                txtPartNo,
                txtCustomerName,
                dtStartEffDate,
                numPrice,
                cboCurrency,
                txtRemark
                );

            txtMasterNo.KeyPress     += CtrlUtil.SetNextControl;
            txtPartNo.KeyPress       += CtrlUtil.SetNextControl;
            txtCustomerName.KeyPress += CtrlUtil.SetNextControl;
            dtStartEffDate.KeyPress  += CtrlUtil.SetNextControl;
            numPrice.KeyPress        += CtrlUtil.SetNextControl;
            cboCurrency.KeyPress     += CtrlUtil.SetNextControl;
            txtRemark.KeyPress       += CtrlUtil.SetNextControl;

            LookupData();

            if (m_screenMode == eMode.EDIT)
            {
                SalesUnitPriceUIDM model = m_SalesUnitPriceController.LoadSalesUnitPriceWithItemInfo(m_MasterNo.ToNZString(),
                                                                                                     m_dtmStartEffDate.ToNZDateTime(),
                                                                                                     m_Currency.ToNZString());
                dmcSalesUnitPrice.LoadData(model);
            }
        }
Exemple #2
0
        private SalesUnitPriceUIDM MapDTOToModel(SalesUnitPriceDTO Price, ItemDTO Item, DealingDTO Customer)
        {
            SalesUnitPriceUIDM model = new SalesUnitPriceUIDM();

            model.CRT_BY               = Price.CRT_BY;
            model.CRT_DATE             = Price.CRT_DATE;
            model.CRT_MACHINE          = Price.CRT_MACHINE;
            model.UPD_BY               = Price.UPD_BY;
            model.UPD_DATE             = Price.UPD_DATE;
            model.UPD_MACHINE          = Price.UPD_MACHINE;
            model.ITEM_CD              = Price.ITEM_CD;
            model.START_EFFECTIVE_DATE = Price.START_EFFECTIVE_DATE;
            model.PRICE    = Price.PRICE;
            model.CURRENCY = Price.CURRENCY;
            model.REMARK   = Price.REMARK;
            model.OLD_DATA = Price.OLD_DATA;

            if (Item != null && !Item.ITEM_DESC.IsNull)
            {
                model.SHORT_NAME = Item.SHORT_NAME;
            }
            if (Customer != null && !Customer.LOC_DESC.IsNull)
            {
                model.CUSTOMER_NAME = Customer.LOC_DESC;
            }

            return(model);
        }
Exemple #3
0
        public void SaveUpdate(SalesUnitPriceUIDM data)
        {
            SalesUnitPriceDTO dto = MapModelToDTO(data);

            SalesUnitPriceBIZ biz = new SalesUnitPriceBIZ();

            biz.SaveUpdate(dto);
        }
Exemple #4
0
        public override void OnSaveAndNew()
        {
            SalesUnitPriceUIDM model = dmcSalesUnitPrice.SaveData(new SalesUnitPriceUIDM());

            try
            {
                ValidateRequireField();

                // Confirm to save.
                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new EVOFramework.Message(Messages.eConfirm.CFM9001.ToString()));
                if (dr == MessageDialogResult.Cancel || dr == MessageDialogResult.No)
                {
                    return;
                }

                //if (dr == MessageDialogResult.No)
                //{
                //    DialogResult = m_dummyDialogResult;
                //    return;
                //}

                if (eMode.ADD == m_screenMode)
                {
                    m_SalesUnitPriceController.SaveNew(model);
                }
                else
                {
                    m_SalesUnitPriceController.SaveUpdate(model);
                }

                m_dummyDialogResult = DialogResult.OK;

                ClearControls();

                m_MasterNo        = string.Empty;
                m_dtmStartEffDate = DateTime.MinValue;
                m_Currency        = string.Empty;

                InitializeScreenMode();

                //CtrlUtil.FocusControl(txtPartNo);
                MessageDialog.ShowInformation(this, null, new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription);
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (ValidateException err)
            {
                MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message);
                err.ErrorResults[0].FocusOnControl();
            }
        }
Exemple #5
0
        private SalesUnitPriceDTO MapModelToDTO(SalesUnitPriceUIDM data)
        {
            SalesUnitPriceDTO dto = new SalesUnitPriceDTO();

            dto.CRT_BY               = CommonLib.Common.CurrentUserInfomation.UserCD;
            dto.CRT_MACHINE          = CommonLib.Common.CurrentUserInfomation.Machine;
            dto.UPD_BY               = CommonLib.Common.CurrentUserInfomation.UserCD;
            dto.UPD_MACHINE          = CommonLib.Common.CurrentUserInfomation.Machine;
            dto.ITEM_CD              = data.ITEM_CD;
            dto.START_EFFECTIVE_DATE = data.START_EFFECTIVE_DATE;
            dto.PRICE    = data.PRICE;
            dto.CURRENCY = data.CURRENCY;
            dto.REMARK   = data.REMARK;
            dto.OLD_DATA = new NZInt(null, 0);
            return(dto);
        }
Exemple #6
0
        public override void OnSaveAndClose()
        {
            SalesUnitPriceUIDM model = dmcSalesUnitPrice.SaveData(new SalesUnitPriceUIDM());

            try
            {
                ValidateRequireField();

                // Confirm to save.
                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new EVOFramework.Message(Messages.eConfirm.CFM9001.ToString()));
                if (dr == MessageDialogResult.Cancel || dr == MessageDialogResult.No)
                {
                    return;
                }

                //if (dr == MessageDialogResult.No)
                //{
                //    DialogResult = m_dummyDialogResult;
                //    return;
                //}

                if (eMode.ADD == m_screenMode)
                {
                    m_SalesUnitPriceController.SaveNew(model);
                }
                else
                {
                    m_SalesUnitPriceController.SaveUpdate(model);
                }

                MessageDialog.ShowInformation(this, null, new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription);

                m_dummyDialogResult = DialogResult.OK;
                DialogResult        = m_dummyDialogResult;
                this.Close();
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (ValidateException err)
            {
                MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message);
                err.ErrorResults[0].FocusOnControl();
            }
        }