Beispiel #1
0
        private void CompChk_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            string         erromsg = "";
            ComplianceBL   CBL     = new ComplianceBL(Application);
            MessageOptions options = new MessageOptions();

            foreach (SOHeader so in e.SelectedObjects)
            {
                if (CBL.SoComplianceCheck(so, out erromsg) == 0)
                {
                    options.Duration     = 20000;
                    options.Message      = string.Format("Sales Order for {0} has been Checked and is OKAY", so.CustomerNumber.CustomerName);
                    options.Type         = InformationType.Success;
                    options.Web.Position = InformationPosition.Right;
                    options.Win.Caption  = "Success";
                    options.Win.Type     = WinMessageType.Alert;
                    so.SOStatus          = SalesOrderStatus.Picking;
                    so.CustomerNumber.AddNote(so.CustomerNumber, String.Format("Sales Order: {0} Has been Move out of Compliance.", so.SalesOrderNumber));
                    so.Save();
                    ObjectSpace.CommitChanges();
                    View.Refresh();
                }
                else
                {
                    erromsg              = Environment.NewLine + erromsg;
                    options.Duration     = 20000;
                    options.Message      = string.Format("Sales Order for {0} has been Checked will be entered into compliance due to the following:{1}", so.CustomerNumber.CustomerName, erromsg);
                    options.Type         = InformationType.Warning;
                    options.Web.Position = InformationPosition.Right;
                    options.Win.Caption  = "Needs Compliance Attention";
                    options.Win.Type     = WinMessageType.Flyout;
                }
                Application.ShowViewStrategy.ShowMessage(options);
            }
        }
        private void SalesOrderPopup_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            SOHeader       so = (SOHeader)e.PopupWindowViewCurrentObject;
            string         erromsg;
            ComplianceBL   CBL     = new ComplianceBL(Application);
            MessageOptions options = new MessageOptions();

            if (CBL.SoComplianceCheck(so, out erromsg) == 0)
            {
                options.Duration     = 20000;
                options.Message      = string.Format("Sales Order for {0} has been entered", so.CustomerNumber.CustomerName);
                options.Type         = InformationType.Success;
                options.Web.Position = InformationPosition.Right;
                options.Win.Caption  = "Success";
                options.Win.Type     = WinMessageType.Alert;
                so.SOStatus          = SalesOrderStatus.Submitted;
                if (so.SalesOrderNumber == null || so.SalesOrderNumber?.Length < 2)
                {
                    so.SalesOrderNumber = so.AccountingSONumber;
                }

                so.Save();
            }
            else
            {
                options.Duration     = 20000;
                options.Message      = string.Format("Sales Order for {0} has been entered is in Compliance due to the following {1}", so.CustomerNumber.CustomerName, erromsg);
                options.Type         = InformationType.Warning;
                options.Web.Position = InformationPosition.Right;
                options.Win.Caption  = "Success Need Compliance";
                options.Win.Type     = WinMessageType.Alert;
                so.SOStatus          = SalesOrderStatus.ComplianceCheck;
                if (so.SalesOrderNumber == null || so.SalesOrderNumber?.Length < 2)
                {
                    so.SalesOrderNumber = so.AccountingSONumber;
                }

                so.Save();
            }
            Application.ShowViewStrategy.ShowMessage(options);
            string msg = string.Format("Sales order: {2} entered by {0} {1} ", SecuritySystem.CurrentUserName, System.Environment.NewLine, so.SalesOrderNumber);

            foreach (SODetails det in so.SODetails)
            {
                msg = msg + string.Format(det.ItemNumber.ItemNumber.ToString() + " {0:C2} @ {1} {2} ", det.QtyOrdered, det.UnitPrice, System.Environment.NewLine);
            }
            so.CustomerNumber.AddNote(so.CustomerNumber, msg);
            so.Session.CommitTransaction();


            View.Refresh();
        }