private void btnCancelPickList_Click(object sender, EventArgs e)
        {
            DataRow dr = gridApprovedOrdersView.GetFocusedDataRow();

            if (dr != null)
            {
                if (DialogResult.Yes == XtraMessageBox.Show(String.Format("Are you sure you want to cancel the Request: {0}?", dr["RefNo"]), "Confirm Cancelation!", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    int       ordID = Convert.ToInt32(dr["ID"]);
                    BLL.Order ord   = new BLL.Order();
                    ord.LoadByPrimaryKey(ordID);
                    ord.OrderStatusID = OrderStatus.Constant.CANCELED;
                    ord.Save();
                    if (BLL.Settings.IsCenter)
                    {
                        XtraMessageBox.Show("Issue Order List canceled", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        XtraMessageBox.Show("Pick List canceled", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    BindApprovedOrders();
                    gridPickListDetail.DataSource = null;
                }
            }
        }
Exemplo n.º 2
0
 private void btnReturnToEdit_Click(object sender, EventArgs e)
 {
     if (XtraMessageBox.Show("Are you sure you would like to return this Order to the SDO?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
     {
         ApprovalOrder.ChangeStatus(OrderStatus.Constant.DRAFT_WISHLIST, CurrentContext.UserId);
         ApprovalOrder.ApprovedBy = CurrentContext.UserId;
         //ApprovalOrder.Remark = NewMainWindow.LoggedInUserName;
         //gridOrderDetailForApproval.DataSource = null;
         ApprovalOrder.Save();
         this.LogActivity("Return-To-Edit", ApprovalOrder.ID);
         XtraMessageBox.Show("The requisition you selected has been sent back to the SDO", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
         BindOutstandingOrders();
     }
 }
        private void SavePickListItems(object sender, EventArgs e)
        {
            BLL.Order ord = new BLL.Order();
            BLL.Institution rus = new Institution();
            ord.LoadByPrimaryKey(_orderID);

            // if the pick list has already been printed ... go ahead and pass it to the next level
            if (ord.OrderStatusID == OrderStatus.Constant.PICK_LIST_GENERATED)
            {
                ord.OrderStatusID = OrderStatus.Constant.PICK_LIST_CONFIRMED;
                ord.Save();
                BindApprovedOrders();
                gridPickListDetail.DataSource = null;
                XtraMessageBox.Show("The Pick List has been Confirmed", "Confirmation", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                return;
            }

            if (_dvPickListMakeup != null)
            {

                MyGeneration.dOOdads.TransactionMgr mgr = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
                try
                {
                    mgr.BeginTransaction();
                    // First of all .. print the pick list

                    rus.LoadByPrimaryKey(ord.RequestedBy);

                    var pl = HCMIS.Desktop.Reports.WorkflowReportFactory.CreatePicklistReport(ord, rus,
                                                                                              _dvPickListMakeup);
                    pl.PrintDialog();
                    var pls = new PickList();

                    pls.SavePickList(_orderID, _dvPickListMakeup, CurrentContext.UserId);

                    // Refresh the current window
                    BindApprovedOrders();
                    // clear the working grid
                    gridPickListDetail.DataSource = null;
                    mgr.CommitTransaction();
                    XtraMessageBox.Show("Your pick list has been saved! please continue to the next step or prepare another Picklist here.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception exp)
                {
                    mgr.RollbackTransaction();
                    BLL.User user = new User();
                    //user.LoadByPrimaryKey(NewMainWindow.UserId);
                    user = CurrentContext.LoggedInUser;
                    if (user.UserType == UserType.Constants.ADMIN || user.UserType == UserType.Constants.SUPER_ADMINISTRATOR)
                    {
                        XtraMessageBox.Show(exp.Message);
                    }
                    else
                    {
                        XtraMessageBox.Show("System couldn't save the Pick List, Please contact administrator for additional help", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    ErrorHandler.Handle(exp);
                }
            }
        }
        private void SavePickListItems(object sender, EventArgs e)
        {
            BLL.Order       ord = new BLL.Order();
            BLL.Institution rus = new Institution();
            ord.LoadByPrimaryKey(_orderID);


            // if the pick list has already been printed ... go ahead and pass it to the next level
            if (ord.OrderStatusID == OrderStatus.Constant.PICK_LIST_GENERATED)
            {
                ord.OrderStatusID = OrderStatus.Constant.PICK_LIST_CONFIRMED;
                ord.Save();
                BindApprovedOrders();
                gridPickListDetail.DataSource = null;
                XtraMessageBox.Show("The Pick List has been Confirmed", "Confirmation", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                return;
            }

            if (_dvPickListMakeup != null)
            {
                MyGeneration.dOOdads.TransactionMgr mgr = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
                try
                {
                    mgr.BeginTransaction();
                    // First of all .. print the pick list

                    rus.LoadByPrimaryKey(ord.RequestedBy);

                    var pl = HCMIS.Desktop.Reports.WorkflowReportFactory.CreatePicklistReport(ord, rus,
                                                                                              _dvPickListMakeup);
                    pl.PrintDialog();
                    var pls = new PickList();

                    pls.SavePickList(_orderID, _dvPickListMakeup, CurrentContext.UserId);

                    // Refresh the current window
                    BindApprovedOrders();
                    // clear the working grid
                    gridPickListDetail.DataSource = null;
                    mgr.CommitTransaction();
                    XtraMessageBox.Show("Your pick list has been saved! please continue to the next step or prepare another Picklist here.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception exp)
                {
                    mgr.RollbackTransaction();
                    BLL.User user = new User();
                    //user.LoadByPrimaryKey(NewMainWindow.UserId);
                    user = CurrentContext.LoggedInUser;
                    if (user.UserType == UserType.Constants.ADMIN || user.UserType == UserType.Constants.SUPER_ADMINISTRATOR)
                    {
                        XtraMessageBox.Show(exp.Message);
                    }
                    else
                    {
                        XtraMessageBox.Show("System couldn't save the Pick List, Please contact administrator for additional help", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    ErrorHandler.Handle(exp);
                }
            }
        }
        private void btnCancelPickList_Click(object sender, EventArgs e)
        {
            DataRow dr = gridApprovedOrdersView.GetFocusedDataRow();
            if (dr != null)
            {
                if (DialogResult.Yes == XtraMessageBox.Show(String.Format("Are you sure you want to cancel the Request: {0}?", dr["RefNo"]), "Confirm Cancelation!", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    int ordID = Convert.ToInt32(dr["ID"]);
                    BLL.Order ord = new BLL.Order();
                    ord.LoadByPrimaryKey(ordID);
                    ord.OrderStatusID = OrderStatus.Constant.CANCELED;
                    ord.Save();
                    if (BLL.Settings.IsCenter)
                    {
                        XtraMessageBox.Show("Issue Order List canceled", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }else
                    {
                        XtraMessageBox.Show("Pick List canceled", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    BindApprovedOrders();
                    gridPickListDetail.DataSource = null;
                }
            }
        }