Exemplo n.º 1
0
        public int UpdatePeriod(InventoryPeriodDTO dto)
        {
            // check exist before add new
            InventoryPeriodValidator val = new InventoryPeriodValidator();

            val.ValidateBeforeSaveUpdate(dto);
            InventoryPeriodDAO        dao = new InventoryPeriodDAO(CommonLib.Common.CurrentDatabase);
            List <InventoryPeriodDTO> dtoInvPeriodList = dao.LoadAll(null, true);

            return(dao.UpdateWithPK(null, dto, dtoInvPeriodList[0].YEAR_MONTH));
        }
Exemplo n.º 2
0
        private bool CheckMandatory()
        {
            try
            {
                InventoryPeriodValidator val = new InventoryPeriodValidator();

                #region Mandatory check

                ErrorItem errorItem = null;
                errorItem = val.CheckEmptyYearMonth(new NZString(null, dtInventoryMonth.Value.HasValue ? dtInventoryMonth.Value.Value.ToString("yyyyMM") : null));
                if (null != errorItem)
                {
                    ValidateException.ThrowErrorItem(errorItem);
                }

                errorItem = val.CheckEmptyPeriodBeginDate(new NZDateTime(null, dtPeriodFrom.Value));
                if (null != errorItem)
                {
                    ValidateException.ThrowErrorItem(errorItem);
                }

                errorItem = val.CheckEmptyPeriodEndDate(new NZDateTime(null, dtPeriodTo.Value));
                if (null != errorItem)
                {
                    ValidateException.ThrowErrorItem(errorItem);
                }

                errorItem = val.CheckPeriodBeginToEndDate(new NZDateTime(null, dtPeriodFrom.Value),
                                                          new NZDateTime(null, dtPeriodTo.Value));
                if (null != errorItem)
                {
                    ValidateException.ThrowErrorItem(errorItem);
                }

                #endregion

                return(true);
            }
            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();
            }
            return(false);
        }
Exemplo n.º 3
0
        private void RollingStart(eMonthlyCloseProcess ProcessType)
        {
            try
            {
                NZString YearMonth           = Convert.ToDateTime(dtInventoryMonth.DateValue).ToString("yyyyMM").ToNZString();
                InventoryPeriodValidator val = new InventoryPeriodValidator();
                //val.CheckBeforeRunProcess(ProcessType);
                ErrorItem err = val.CheckBeforeRunClosingProcess(ProcessType, YearMonth);

                if (err != null)
                {
                    MessageDialogResult cf = MessageDialog.ShowConfirmation(this, EVOFramework.Message.LoadMessage(TKPMessages.eValidate.VLM0076.ToString()).MessageDescription, MessageDialogButtons.YesNo);
                    if (cf != MessageDialogResult.Yes)
                    {
                        return;
                    }
                }

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new EVOFramework.Message(TKPMessages.eConfirm.CFM0005.ToString()).MessageDescription, MessageDialogButtons.YesNo);
                if (dr == MessageDialogResult.Yes)
                {
                    if (RunProcess(ProcessType))
                    {
                        MessageDialog.ShowBusiness(this, EVOFramework.Message.LoadMessage(SystemMaintenance.Messages.eInformation.INF9003.ToString()));
                    }

                    InventoryPeriodBIZ biz = new InventoryPeriodBIZ();
                    InventoryPeriodDTO dto = biz.LoadCurrentPeriod();

                    DateTime currentYearMonth = new DateTime(
                        Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)),
                        Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)), 1);

                    dtInventoryMonth.DateValue = currentYearMonth;
                }
            }
            catch (ValidateException ex)
            {
                MessageDialog.ShowBusiness(this, ex.ErrorResults[0].Message);
            }
            catch (BusinessException ex)
            {
                MessageDialog.ShowBusiness(this, ex.Error.Message);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Exemplo n.º 4
0
 private void CheckCurrentInvPeriod()
 {
     try
     {
         InventoryPeriodValidator val = new InventoryPeriodValidator();
         ErrorItem err = val.CheckInventoryCurrentPeriod();
         if (err != null)
         {
             MessageDialog.ShowInformation(this, "Out of period", err.Message.MessageDescription);
         }
     }
     catch (Exception)
     {
     }
 }