private void btnMainain_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CMachineMaintenance objMachineMaintenance = new CMachineMaintenance();

                //Start 
                if (btnMainain.Content == FindResource("CMachineMaintenanceView_xaml_btnMainain"))
                {
                    if (MessageBox.ShowBox("MessageID256", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                        return;

                    if (objMachineMaintenance.ManageMaintenance(installationNo, 0, Security.SecurityHelper.CurrentUser.SecurityUserID) > 0)
                    {
                        MessageBox.ShowBox("MessageID339", BMC_Icon.Information, BMC_Button.OK);

                        PopulateSession();
                        if (txtOpenSession.Tag != null)
                        {
                            PopulateEvents((int)txtOpenSession.Tag);
                        }
                        return;
                    }

                    //LogManager.WriteLog("Executing Path : " + BMCRegistryHelper.GetRegKeyValue(string.Empty,"InstallationPath").ToString().Trim()  + Common.ConfigurationManagement.ConfigManager.Read(
                    //                "HandpayCommandLinePrompt") + " DisableMachine " + installationNo, LogManager.enumLogLevel.Info);



                    //System.Diagnostics.Process.Start(BMCRegistryHelper.GetRegKeyValue(string.Empty, "InstallationPath").ToString().Trim().ToString().Trim() + Common.ConfigurationManagement.ConfigManager.Read(
                    //            "HandpayCommandLinePrompt"), " DisableMachine " + installationNo);

                    LogManager.WriteLog("Executing Path : " + Path.Combine(Extensions.GetStartupDirectory(), Common.ConfigurationManagement.ConfigManager.Read(
                "HandpayCommandLinePrompt")) + " DisableMachine " + installationNo, LogManager.enumLogLevel.Info);

                    System.Diagnostics.Process.Start(Path.Combine(Extensions.GetStartupDirectory(), Common.ConfigurationManagement.ConfigManager.Read(
                                "HandpayCommandLinePrompt")), " DisableMachine " + installationNo);


                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {
                        
                        AuditModuleName = ModuleName.MachineMaintenance,
                        Audit_Screen_Name = "Machine Maintenance View",
                        Audit_Desc = "Start Maintenance - Installation No: " + installationNo.ToString(),
                        AuditOperationType = OperationType.MODIFY,
                    });

                    MessageBox.ShowBox("MessageID309", BMC_Icon.Information, BMC_Button.OK);
                }
                else//Close 
                {
                    int iMachineEventStatus = objMachineMaintenance.CheckMachineMaintenance(installationNo);
                    if (iMachineEventStatus < 0)
                    {
                        if (MessageBox.ShowBox("MessageID304", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                        {
                            return;
                        }
                        CAuthorize objAuthorize = new CAuthorize("CashdeskOperator.Authorize.cs.OverrideEvents");
                        objAuthorize.User = Security.SecurityHelper.CurrentUser;
                        if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.OverrideEvents"))
                        {
                            objAuthorize.ShowDialog();
                            if (!objAuthorize.IsAuthorized)
                                return;
                        }
                        else
                        {
                            objAuthorize.IsAuthorized = true;
                        }
                    }

                    if (MessageBox.ShowBox("MessageID257", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                        return;

                    var objReasonCategory = new CReasonCategory();
                    objReasonCategory.ShowDialog();

                    if (objReasonCategory.MaintenanceReasonCategory != null && objReasonCategory.MaintenanceReasonCategory.Length > 0)
                    {
                        objMachineMaintenance.CloseMaintenance(installationNo, Security.SecurityHelper.CurrentUser.SecurityUserID,
                            objReasonCategory.MaintenanceReasonCategory);



                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            
                            AuditModuleName = ModuleName.MachineMaintenance,
                            Audit_Screen_Name = "Machine Maintenance View",
                            Audit_Desc = "Close Maintenance - Installation No: " + installationNo.ToString(),
                            AuditOperationType = OperationType.MODIFY,
                        });

                        MessageBox.ShowBox("MessageID310", BMC_Icon.Information, BMC_Button.OK);
                    }
                    else
                        return;
                }
                PopulateSession();
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
Пример #2
0
        private void btnMainain_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CMachineMaintenance objMachineMaintenance = new CMachineMaintenance();

                //Start
                if (btnMainain.Content == FindResource("CMachineMaintenanceView_xaml_btnMainain"))
                {
                    if (MessageBox.ShowBox("MessageID256", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }

                    if (objMachineMaintenance.ManageMaintenance(installationNo, 0, Security.SecurityHelper.CurrentUser.SecurityUserID) > 0)
                    {
                        MessageBox.ShowBox("MessageID339", BMC_Icon.Information, BMC_Button.OK);

                        PopulateSession();
                        if (txtOpenSession.Tag != null)
                        {
                            PopulateEvents((int)txtOpenSession.Tag);
                        }
                        return;
                    }

                    //LogManager.WriteLog("Executing Path : " + BMCRegistryHelper.GetRegKeyValue(string.Empty,"InstallationPath").ToString().Trim()  + Common.ConfigurationManagement.ConfigManager.Read(
                    //                "HandpayCommandLinePrompt") + " DisableMachine " + installationNo, LogManager.enumLogLevel.Info);



                    //System.Diagnostics.Process.Start(BMCRegistryHelper.GetRegKeyValue(string.Empty, "InstallationPath").ToString().Trim().ToString().Trim() + Common.ConfigurationManagement.ConfigManager.Read(
                    //            "HandpayCommandLinePrompt"), " DisableMachine " + installationNo);

                    LogManager.WriteLog("Executing Path : " + Path.Combine(Extensions.GetStartupDirectory(), Common.ConfigurationManagement.ConfigManager.Read(
                                                                               "HandpayCommandLinePrompt")) + " DisableMachine " + installationNo, LogManager.enumLogLevel.Info);

                    System.Diagnostics.Process.Start(Path.Combine(Extensions.GetStartupDirectory(), Common.ConfigurationManagement.ConfigManager.Read(
                                                                      "HandpayCommandLinePrompt")), " DisableMachine " + installationNo);


                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {
                        AuditModuleName    = ModuleName.MachineMaintenance,
                        Audit_Screen_Name  = "Machine Maintenance View",
                        Audit_Desc         = "Start Maintenance - Installation No: " + installationNo.ToString(),
                        AuditOperationType = OperationType.MODIFY,
                    });

                    MessageBox.ShowBox("MessageID309", BMC_Icon.Information, BMC_Button.OK);
                }
                else//Close
                {
                    int iMachineEventStatus = objMachineMaintenance.CheckMachineMaintenance(installationNo);
                    if (iMachineEventStatus < 0)
                    {
                        if (MessageBox.ShowBox("MessageID304", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                        {
                            return;
                        }
                        CAuthorize objAuthorize = new CAuthorize("CashdeskOperator.Authorize.cs.OverrideEvents");
                        objAuthorize.User = Security.SecurityHelper.CurrentUser;
                        if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.OverrideEvents"))
                        {
                            objAuthorize.ShowDialog();
                            if (!objAuthorize.IsAuthorized)
                            {
                                return;
                            }
                        }
                        else
                        {
                            objAuthorize.IsAuthorized = true;
                        }
                    }

                    if (MessageBox.ShowBox("MessageID257", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }

                    var objReasonCategory = new CReasonCategory();
                    objReasonCategory.ShowDialog();

                    if (objReasonCategory.MaintenanceReasonCategory != null && objReasonCategory.MaintenanceReasonCategory.Length > 0)
                    {
                        objMachineMaintenance.CloseMaintenance(installationNo, Security.SecurityHelper.CurrentUser.SecurityUserID,
                                                               objReasonCategory.MaintenanceReasonCategory);



                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            AuditModuleName    = ModuleName.MachineMaintenance,
                            Audit_Screen_Name  = "Machine Maintenance View",
                            Audit_Desc         = "Close Maintenance - Installation No: " + installationNo.ToString(),
                            AuditOperationType = OperationType.MODIFY,
                        });

                        MessageBox.ShowBox("MessageID310", BMC_Icon.Information, BMC_Button.OK);
                    }
                    else
                    {
                        return;
                    }
                }
                PopulateSession();
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }