Beispiel #1
0
        public override void OnSaveAndClose()
        {
            fpView.StopCellEditing();
            if (m_bRowHasModified)
            { // ถ้า Row กำลังแก้ไขอยู่
                if (!ValidateRowSpread(shtView.ActiveRowIndex, false))
                {
                    return;
                }
            }
            // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
            // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
            CtrlUtil.SpreadSheetRowEndEdit(shtView, shtView.ActiveRowIndex);
            RemoveRowUnused(shtView);
            ////if (txtItemCode.SelectedItemData != null)
            ////    numWorkResultQty_KeyPress(numWorkResultQty, new KeyPressEventArgs((char)Keys.Return));

            if (txtNumberOfBox.Int <= 0)
            {
                txtNumberOfBox.Int = 1;
            }

            try
            {
                ValidateBeforeSave();

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString()));
                if (dr == MessageDialogResult.Cancel)
                {
                    return;
                }
                if (dr == MessageDialogResult.Yes)
                {
                    SaveData();
                }

                m_dialogResult = DialogResult.OK;
                this.Close();
            }
            catch (ValidateException err)
            {
                for (int i = 0; i < err.ErrorResults.Count; i++)
                {
                    MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message);
                    err.ErrorResults[i].FocusOnControl();
                }
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Beispiel #2
0
        public override void OnSaveAndNew()
        {
            fpView.StopCellEditing();
            if (m_bRowHasModified)
            { // ถ้า Row กำลังแก้ไขอยู่
                if (!ValidateRowSpread(shtView.ActiveRowIndex, false))
                {
                    return;
                }
            }
            // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
            // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
            CtrlUtil.SpreadSheetRowEndEdit(shtView, shtView.ActiveRowIndex);
            RemoveRowUnused(shtView);

            if (txtNumberOfBox.Int <= 0)
            {
                txtNumberOfBox.Int = 1;
            }

            try
            {
                ValidateBeforeSave();

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString()));
                if (dr == MessageDialogResult.Cancel)
                {
                    return;
                }
                if (dr == MessageDialogResult.Yes)
                {
                    SaveData();
                    SetScreenMode(eScreenMode.ADD);

                    CtrlUtil.FocusControl(txtMasterNo);
                    m_dialogResult = DialogResult.OK;
                }
            }
            catch (ValidateException err)
            {
                for (int i = 0; i < err.ErrorResults.Count; i++)
                {
                    MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message);
                    err.ErrorResults[i].FocusOnControl();
                }
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Beispiel #3
0
        private void tsbOk_Click(object sender, EventArgs e)
        {
            fpView.StopCellEditing();
            if (m_bRowHasModified)
            { // ถ้า Row กำลังแก้ไขอยู่
                if (!ValidateRowSpread(shtView.ActiveRowIndex, false))
                {
                    return;
                }
            }
            // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
            // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
            CtrlUtil.SpreadSheetRowEndEdit(shtView, shtView.ActiveRowIndex);
            RemoveRowUnused(shtView);

            try
            {
                if (txtRemainQty.Decimal < txtQty.Decimal)
                {
                    MessageDialog.ShowInformation(this, "Information", new Message(TKPMessages.eValidate.VLM0214.ToString()).MessageDescription);
                    return;
                }

                PackingEntryUIDM model = dmc.SaveData(new PackingEntryUIDM());
                model.DATA_VIEW = (DataTable)shtView.DataSource;
                model.DATA_VIEW.AcceptChanges();


                UpdateRecord(model.DATA_VIEW);

                if (!ValidateBeforeSave(model))
                {
                    return;
                }

                DialogResult = DialogResult.OK;
                //this.Close();
            }
            catch (ValidateException err)
            {
                MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message);
                err.ErrorResults[0].FocusOnControl();
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (Exception err)
            {
                MessageDialog.ShowBusiness(this, null, err.Message);
            }
        }
Beispiel #4
0
        private bool SaveDataEditMode()
        {
            RemoveRowUnused();
            // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
            // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
            //int row = shtIssueList.Rows.Count;
            for (int i = 0; i < shtIssueList.Rows.Count; i++)
            {
                CtrlUtil.SpreadSheetRowEndEdit(shtIssueList, shtIssueList.ActiveRowIndex);
            }

            IssueByOrderUIDM newModel = dmcIssue.SaveData(new IssueByOrderUIDM());

            newModel.DATA_VIEW = m_uidm.DATA_VIEW;


            //== Save Process
            IssueByEntryController ctl = new IssueByEntryController();

            ctl.SaveDataEditMode(newModel);
            return(true);
        }
Beispiel #5
0
        public override void OnSaveAndClose()
        {
            try
            {
                fpIssueList.StopCellEditing();
                // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
                // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
                CtrlUtil.SpreadSheetRowEndEdit(shtIssueList, shtIssueList.ActiveRowIndex);
                RemoveRowUnused();

                // Validate Data before Save
                IssueEntryValidator valIssue = new IssueEntryValidator();

                ErrorItem errorItem;

                errorItem = valIssue.CheckIssueDate(new NZDateTime(dtIssueDate, dtIssueDate.Value));
                if (null != errorItem)
                {
                    ValidateException.ThrowErrorItem(errorItem);
                }

                errorItem = valIssue.CheckEmptySubType(new NZString(cboSubType, cboSubType.SelectedValue));
                if (null != errorItem)
                {
                    ValidateException.ThrowErrorItem(errorItem);
                }

                //errorItem = valIssue.CheckEmptyItemCode(new NZString(txtItemCode, txtItemCode.Text));
                //if (null != errorItem) ValidateException.ThrowErrorItem(errorItem);

                errorItem = valIssue.CheckEmptyLocFrom(new NZString(cboFromLoc, cboFromLoc.SelectedValue));
                if (null != errorItem)
                {
                    ValidateException.ThrowErrorItem(errorItem);
                }

                errorItem = valIssue.CheckEmptyLocTo(new NZString(cboToLoc, cboToLoc.SelectedValue));
                if (null != errorItem)
                {
                    ValidateException.ThrowErrorItem(errorItem);
                }

                errorItem = valIssue.CheckFromToLocation(new NZString(cboFromLoc, cboFromLoc.SelectedValue), new NZString(cboToLoc, cboToLoc.SelectedValue));
                if (null != errorItem)
                {
                    ValidateException.ThrowErrorItem(errorItem);
                }

                for (int i = 0; i < shtIssueList.Rows.Count; i++)
                {
                    if (!ValidateRowSpread(i, true))
                    {
                        return;
                    }
                }

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new EVOFramework.Message(Messages.eConfirm.CFM9001.ToString()).MessageDescription);
                switch (dr)
                {
                case MessageDialogResult.Cancel:
                    return;

                case MessageDialogResult.No:
                    // this.Close();
                    return;

                case MessageDialogResult.Yes:
                    break;
                }
                if (m_Mode == eSaveMode.ADD)
                //|| (m_Mode == eSaveMode.UPDATE))
                {
                    if (SaveData())
                    {
                        MessageDialog.ShowInformation(this, "Information", new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription);
                        Close();
                    }
                }
                else
                {
                    if (SaveDataEditMode())
                    {
                        MessageDialog.ShowInformation(this, "Information", new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription);
                        Close();
                    }
                }
            }
            catch (ValidateException err)
            {
                for (int i = 0; i < err.ErrorResults.Count; i++)
                {
                    MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message);
                    err.ErrorResults[i].FocusOnControl();
                }
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Beispiel #6
0
        public override void OnSaveAndClose()
        {
            fpView.StopCellEditing();
            if (m_bRowHasModified)
            { // ถ้า Row กำลังแก้ไขอยู่
                if (!ValidateRowSpread(shtView.ActiveRowIndex, false))
                {
                    return;
                }
            }
            // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
            // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
            CtrlUtil.SpreadSheetRowEndEdit(shtView, shtView.ActiveRowIndex);
            RemoveRowUnused(shtView);

            try
            {
                UnPackingEntryUIDM model = dmc.SaveData(new UnPackingEntryUIDM());
                model.DATA_VIEW = (DataTable)shtView.DataSource;

                //UpdateRecord(model.DATA_VIEW);

                ValidateBeforeSave(model);

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString()));

                if (dr == MessageDialogResult.Yes)
                {
                    for (int i = 0; i < shtView.RowCount; i++)
                    {
                        Boolean Flag = Convert.ToBoolean(shtView.Cells[i, (int)eColView.CHECKBOX].Value);
                        if (Flag == false)
                        {
                            model.DATA_VIEW.Rows.RemoveAt(i);
                            i = i - 1;
                        }
                    }

                    model.DATA_VIEW.AcceptChanges();
                    if (m_screenMode == eScreenMode.ADD)
                    {
                        m_controller.SaveNewUnPacking(model);
                    }
                    //else
                    //    m_controller.SaveUpdatePacking(model);

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

                    ClearAllExceptDefaultValue();

                    SetScreenMode(eScreenMode.ADD);
                    m_dialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (ValidateException err)
            {
                MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message);
                err.ErrorResults[0].FocusOnControl();
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (Exception err)
            {
                MessageDialog.ShowBusiness(this, null, err.Message);
            }
        }
Beispiel #7
0
        public override void OnSaveAndNew()
        {
            try
            {
                label7.Focus();

                this.fpCustomerOrder.StopCellEditing();
                //if (m_bRowHasModified)
                //{ // ถ้า Row กำลังแก้ไขอยู่
                //    if (!ValidateRowSpread(shtCustomerOrder.ActiveRowIndex, false))
                //    {
                //        return;
                //    }
                //}


                // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
                // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
                CtrlUtil.SpreadSheetRowEndEdit(shtCustomerOrder, shtCustomerOrder.ActiveRowIndex);

                RemoveRowUnused(shtCustomerOrder);

                if (!ValidateMandatory())
                {
                    return;
                }

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new Message(SystemMaintenance.Messages.eConfirm.CFM9001.ToString()).MessageDescription);
                switch (dr)
                {
                case MessageDialogResult.Cancel:
                    return;

                case MessageDialogResult.No:
                    //Close();
                    return;

                case MessageDialogResult.Yes:
                    break;
                }
                if (SaveData())
                {
                    MessageDialog.ShowInformation(this, "Information", new Message(SystemMaintenance.Messages.eInformation.INF9003.ToString()).MessageDescription);
                    ClearAllControlExceptDefault();
                    m_Mode = Common.eScreenMode.ADD;
                    lblTransactionNo.Text = "";

                    SysConfigBIZ sysBiz        = new SysConfigBIZ();
                    SysConfigDTO argScreenInfo = new SysConfigDTO();
                    argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN100.SYS_GROUP_ID;
                    argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN100.SYS_KEY.DEFAULT_DATE.ToString();
                    dtInvoiceDate.Value        = sysBiz.GetDefaultDateForScreen(argScreenInfo);

                    CtrlUtil.EnabledControl(true, txtRemark, dtInvoiceDate, cboCustomerCode);
                    dtInvoiceDate.Focus();
                    dtInvoiceDate.Select();
                }
            }
            catch (ValidateException err)
            {
                for (int i = 0; i < err.ErrorResults.Count; i++)
                {
                    MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message);
                    err.ErrorResults[i].FocusOnControl();
                }
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Beispiel #8
0
        public override void OnSaveAndClose()
        {
            try
            {
                label7.Focus();
                this.fpCustomerOrder.StopCellEditing();
                //if (m_bRowHasModified)
                //{ // ถ้า Row กำลังแก้ไขอยู่
                //    if (!ValidateRowSpread(shtCustomerOrder.ActiveRowIndex, false))
                //    {
                //        return;
                //    }
                //}

                //this.fpCustomerOrderDetail.StopCellEditing();
                //if (m_bRowHasModified)
                //{ // ถ้า Row กำลังแก้ไขอยู่
                //    if (!ValidateRowSpread(shtCustomerOrderDetail.ActiveRowIndex, false))
                //    {
                //        return;
                //    }
                //}

                // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
                // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
                CtrlUtil.SpreadSheetRowEndEdit(shtCustomerOrder, shtCustomerOrder.ActiveRowIndex);
                //CtrlUtil.SpreadSheetRowEndEdit(shtCustomerOrderDetail, shtCustomerOrderDetail.ActiveRowIndex);

                RemoveRowUnused(shtCustomerOrder);
                //RemoveRowUnused(shtCustomerOrderDetail);

                if (!ValidateMandatory())
                {
                    return;
                }

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new Message(SystemMaintenance.Messages.eConfirm.CFM9001.ToString()).MessageDescription);
                switch (dr)
                {
                case MessageDialogResult.Cancel:
                    return;

                case MessageDialogResult.No:
                    //Close();
                    return;

                case MessageDialogResult.Yes:
                    break;
                }
                if (SaveData())
                {
                    MessageDialog.ShowInformation(this, "Information", new Message(SystemMaintenance.Messages.eInformation.INF9003.ToString()).MessageDescription);
                    Close();
                }
            }
            catch (ValidateException err)
            {
                for (int i = 0; i < err.ErrorResults.Count; i++)
                {
                    MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message);
                    err.ErrorResults[i].FocusOnControl();
                }
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Beispiel #9
0
        public override void OnSaveAndClose()
        {
            fpView.StopCellEditing();
            if (m_bRowHasModified)
            { // ถ้า Row กำลังแก้ไขอยู่
                if (!ValidateRowSpread(shtView.ActiveRowIndex, false))
                {
                    return;
                }
            }
            // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
            // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
            CtrlUtil.SpreadSheetRowEndEdit(shtView, shtView.ActiveRowIndex);

            RemoveRowUnused(shtView);

            try
            {
                ItemValidator itemValidator = new ItemValidator();
                int           row           = shtView.Rows.Count;
                for (int i = 0; i < row; i++)
                {
                    NZString          ItemCD = new NZString(null, shtView.Cells[i, (int)eColView.ITEM_CD].Value);
                    BusinessException err    = itemValidator.CheckItemNotExist(ItemCD);
                    if (err != null)
                    {
                        ValidateException.ThrowErrorItem(err.Error);
                    }
                }

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString()));
                if (dr == MessageDialogResult.Cancel)
                {
                    return;
                }

                if (dr == MessageDialogResult.Yes)
                {
                    //== Prepare data.
                    ReceivingEntryUIDM newModel = dmcReceive.SaveData(new ReceivingEntryUIDM());
                    newModel.DATA_VIEW = m_model.DATA_VIEW;


                    //== Save Process
                    m_controller.Save(newModel, m_screenMode);

                    // Post-process.
                    m_dialogResult = DialogResult.OK;

                    MessageDialog.ShowInformation(this, null, Message.LoadMessage(Messages.eInformation.INF9003.ToString()).MessageDescription);
                }

                //== Exit form.
                this.Close();
            }
            catch (ValidateException err)
            {
                MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message);
                err.ErrorResults[0].FocusOnControl();
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (Exception err)
            {
                // ถ้าเป็น error ที่มาจากการหา FIFO Process
                if (err.Message.IndexOf('|') != -1)
                {
                    string[] msgs = err.Message.Split('|');
                    MessageDialog.ShowBusiness(this, Message.LoadMessage(msgs[0], new[] { msgs[1] }));
                }
                else
                {
                    MessageDialog.ShowBusiness(this, null, err.Message);
                }
                Console.WriteLine(err.StackTrace);
            }
        }