Esempio n. 1
0
        private void btnApprove_Click(object sender, EventArgs e)
        {
            MWDataManager.clsDataAccess _dbManFixFigures = new MWDataManager.clsDataAccess();
            _RequestList.ConnectionString       = TUserInfo.Connection;
            _dbManFixFigures.SqlStatement       = " Exec sp_FixTons ";
            _dbManFixFigures.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
            _dbManFixFigures.queryReturnType    = MWDataManager.ReturnType.DataTable;
            _dbManFixFigures.ExecuteInstruction();



            _RequestList.ResultsDataTable.AcceptChanges();
            gcRequestList.DataSource = _RequestList.ResultsDataTable;

            gvRequests.RefreshData();
            frmDeclineApproveChnageOfPLan frmDeclineApproveChnageOfPLan = new frmDeclineApproveChnageOfPLan();
            int DSRow = gvRequests.FocusedRowHandle;

            frmDeclineApproveChnageOfPLan.Approve(Convert.ToInt32(_RequestList.ResultsDataTable.Rows[DSRow]["ApproveRequestID"].ToString()), _RequestList.ResultsDataTable.Rows[DSRow]["ChangeType"].ToString(), _RequestList.ResultsDataTable.Rows[DSRow]["WPName"].ToString());
            if (frmDeclineApproveChnageOfPLan.canceledAction == true)
            {
                gcRequestList.Refresh();
                gvRequests.RefreshData();
                // gvRequests1.DeleteRow(gvRequests1.FocusedRowHandle);
                //gvRequests.DeleteRow(DSRow);
                //focusControle1.Controls.Clear();
                //  gcAppDecList.Refresh();
                //gridControl1.Refresh();
                btnApprove.Enabled = true;
            }
            else
            {
                gcRequestList.Refresh();
                gvRequests.RefreshData();
                gvRequests.DeleteRow(gvRequests.FocusedRowHandle);
                focusControle.Controls.Clear();
                btnApprove.Enabled = false;
            }
        }
Esempio n. 2
0
        //private void gvRequests1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        //{
        //    int DSRow = gvRequests1.GetDataSourceRowIndex(e.RowHandle);
        //    if (DSRow >= 0)
        //    {
        //        ReplanningTypes ReplanningTypes = new ReplanningTypes();
        //        replanningType theType = ReplanningTypes.getReplanningType(Convert.ToInt32(_RequestList1.ResultsDataTable.Rows[DSRow]["ChangeID"].ToString()));
        //        switch (theType)
        //        {
        //            case replanningType.rpStopWp:
        //                ucRequeststatus ucr=new ucRequeststatus() ;
        //                ucr.Controls.Find ("btnApprove",true)[0].Enabled =true ;
        //               // btnApprove.Enabled = true;
        //                ucStopWorkplace ucStopWorkplace = new ucStopWorkplace();
        //                focusControle.Controls.Clear();
        //                ucStopWorkplace.Parent = focusControle;
        //                ucStopWorkplace.Dock = DockStyle.Fill;
        //                ucStopWorkplace.LoadDetails(Convert.ToInt32(_RequestList.ResultsDataTable.Rows[DSRow]["ChangeRequestID"].ToString()));
        //                break;
        //            case replanningType.rpCrewChnages:
        //                ucRequeststatus ucr2=new ucRequeststatus() ;
        //                ucr2.Controls.Find ("btnApprove",true)[0].Enabled =true ;
        //              //  btnApprove.Enabled = true;
        //                ucCrewMinerChange ucCrewMinerChange = new ucCrewMinerChange();

        //                focusControle.Controls.Clear();
        //                ucCrewMinerChange.Parent = focusControle;
        //                ucCrewMinerChange.Dock = DockStyle.Fill;
        //                ucCrewMinerChange.LoadDetails(Convert.ToInt32(_RequestList.ResultsDataTable.Rows[DSRow]["ChangeRequestID"].ToString()));
        //                break;
        //            case replanningType.rpNewWP:
        //                ucRequeststatus ucr3=new ucRequeststatus() ;
        //                ucr3.Controls.Find ("btnApprove",true)[0].Enabled =true ;
        //              //  btnApprove.Enabled = true;
        //                ucAddWorkplace ucAddWorkplace = new ucAddWorkplace();
        //                focusControle.Controls.Clear();
        //                ucAddWorkplace.Parent = focusControle;
        //                ucAddWorkplace.Dock = DockStyle.Fill;
        //                ucAddWorkplace.LoadDetails(Convert.ToInt32(_RequestList.ResultsDataTable.Rows[DSRow]["ChangeRequestID"].ToString()));
        //                break;

        //            case replanningType.rpCallCahnges:
        //                ucRequeststatus ucr4=new ucRequeststatus() ;
        //                ucr4.Controls.Find ("btnApprove",true)[0].Enabled =true ;
        //               // btnApprove.Enabled = true;
        //                ucPlanningValueChanges ucPlanningValueChanges = new ucPlanningValueChanges();
        //                focusControle.Controls.Clear();
        //                ucPlanningValueChanges.Parent = focusControle;
        //                ucPlanningValueChanges.Dock = DockStyle.Fill;
        //                ucPlanningValueChanges.LoadDetails(Convert.ToInt32(_RequestList.ResultsDataTable.Rows[DSRow]["ChangeRequestID"].ToString()));
        //                break;
        //        }


        //    }
        //    else
        //    {
        //        focusControle.Controls.Clear();
        //        gcRequestsList.Visible = false;
        //        focusControle.Visible = false;
        //        labelControl2.Visible = false;
        //        Visible = false;
        //    }

        //}

        public void loadapprove()
        {
            _RequestList1.ResultsDataTable.AcceptChanges();
            gcRequestList.DataSource = _RequestList1.ResultsDataTable;

            gvRequests.RefreshData();

            frmDeclineApproveChnageOfPLan frmDeclineApproveChnageOfPLan1 = new frmDeclineApproveChnageOfPLan {
                theSystemDBTag = this.theSystemDBTag, UserCurrentInfo = this.UserCurrentInfo
            };
            //int DSRow = gvRequests1.GetDataSourceRowIndex(e.RowHandle);
            // gvRequests1.FocusedRowHandle = 0;

            // for (int i = -1; i < gvRequests1.RowCount; i++)
            //  {
            int currentrow = 0;
            //int index=  _RequestList1.ResultsDataTable.Rows.IndexOf(_RequestList1.ResultsDataTable.Rows.Find("ApproveRequestID"));
            //gvRequests1.FocusedRowHandle = gvRequests1.GetRowHandle(index);
            //  currentrow = gvRequests1.GetDataSourceRowIndex(gvRequests1.FocusedRowHandle);
            // int cellvalue = Convert.ToInt32(gvRequests1.GetRowCellValue(i, "ApproveRequestID"));
            //  gvRequests1.FocusedRowHandle = i;
            // gvRequests1.RefreshData();
            //  gvRequests1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.None;
            // bool valid = true;
            // gvRequests.FocusedRowHandle = 0;
            int DSRow = gvRequests.GetDataSourceRowIndex(gvRequests.FocusedRowHandle);

            if (DSRow < 0)
            {
                MessageBox.Show("Please select a record", "", MessageBoxButtons.OK);
            }
            else
            {
                frmDeclineApproveChnageOfPLan1.Approve(Convert.ToInt32(_RequestList1.ResultsDataTable.Rows[DSRow]["ApproveRequestID"].ToString()), _RequestList1.ResultsDataTable.Rows[DSRow]["ChangeType"].ToString(), _RequestList1.ResultsDataTable.Rows[DSRow]["WPName"].ToString());
                if (frmDeclineApproveChnageOfPLan1.canceledAction == true)
                {
                    gcRequestList.Refresh();
                    gvRequests.RefreshData();
                    // gvRequests1.DeleteRow(gvRequests1.FocusedRowHandle);
                    //gvRequests.DeleteRow(DSRow);
                    //focusControle1.Controls.Clear();
                    //  gcAppDecList.Refresh();
                    gridControl1.Refresh();
                    loadRequestedData();
                }
                else
                {
                    gcRequestList.Refresh();
                    gvRequests.RefreshData();
                    // gvRequests1.DeleteRow(gvRequests1.FocusedRowHandle);
                    gvRequests.DeleteRow(DSRow);
                    focusControle1.Controls.Clear();
                    //  gcAppDecList.Refresh();
                    gridControl1.Refresh();
                    loadRequestedData();
                }
                //<<<<<<< .mine
                //=======
                //  frmDeclineApproveChnageOfPLan1.Approve(Convert.ToInt32(_RequestList1.ResultsDataTable.Rows[gvRequests.FocusedRowHandle]["ApproveRequestID"].ToString()));

                //>>>>>>> .r1489
                //gcRequestList.Refresh();

                //gvRequests.RefreshData();
                //// gvRequests1.DeleteRow(gvRequests1.FocusedRowHandle);
                //gvRequests.DeleteRow(DSRow);

                //focusControle1.Controls.Clear();
                ////  }
                foreach (Control control in focusControle1.Controls)
                {
                    control.Dispose();
                }
            }
            //  gcAppDecList.Refresh();
            //  btnApprove.Enabled = false;
            //gridControl1.Refresh();
            //gridView4.RefreshData();
            //gridView6.RefreshData();
            // loadRequestedData();
        }