Exemple #1
0
        /// <summary>
        /// btnSave_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Friday, Feb 17 2006</date>
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            // Code Inserted Automatically

            #region Code Inserted Automatically

            this.Cursor = Cursors.WaitCursor;

            #endregion Code Inserted Automatically


            const string METHOD_NAME = THIS + ".btnSave_Click()";
            try
            {
                //Validating data
                if (dgrdData.RowCount == 0)
                {
                    PCSMessageBox.Show(ErrorCode.MESSAGE_PO_APPROVE_NO_DATA_IN_GRID, MessageBoxIcon.Warning);
                    dgrdData.Focus();
                    // Code Inserted Automatically
                    #region Code Inserted Automatically
                    this.Cursor = Cursors.Default;
                    #endregion Code Inserted Automatically

                    return;
                }
                int intChecked = 0;
                for (int j = 0; j < dgrdData.RowCount; j++)
                {
                    if (dgrdData[j, SELECT].ToString() != false.ToString())
                    {
                        intChecked++;
                    }
                }
                if (intChecked == 0)
                {
                    PCSMessageBox.Show(ErrorCode.MESSAGE_AVOID_SO_SELECT_ATLEAST_ONE, MessageBoxIcon.Warning);
                    dgrdData.Row = 0;
                    dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[SELECT]);
                    dgrdData.Focus();
                    // Code Inserted Automatically
                    #region Code Inserted Automatically
                    this.Cursor = Cursors.Default;
                    #endregion Code Inserted Automatically

                    return;
                }
                if (intChecked == dgrdData.RowCount)
                {
                    PCSMessageBox.Show(ErrorCode.MESSAGE_AVOID_SO_CANNOT_SELECT_ALL, MessageBoxIcon.Warning);
                    //MessageBox.Show("You cannot select all!");
                    dgrdData.Row = 0;
                    dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[SELECT]);
                    dgrdData.Focus();
                    // Code Inserted Automatically
                    #region Code Inserted Automatically
                    this.Cursor = Cursors.Default;
                    #endregion Code Inserted Automatically

                    return;
                }
                string strDeliveryScheduleID = " (";
                for (int i = 0; i < dgrdData.RowCount; i++)
                {
                    if (dgrdData[i, SELECT].ToString() == true.ToString())
                    {
                        strDeliveryScheduleID = strDeliveryScheduleID + dgrdData[i, SO_DeliveryScheduleTable.DELIVERYSCHEDULEID_FLD].ToString() + ",";
                    }
                }
                strDeliveryScheduleID = strDeliveryScheduleID + "0)";
                AvoidDupleSODeliveryBO boAvoidDupleSODelivery = new AvoidDupleSODeliveryBO();
                boAvoidDupleSODelivery.DeleteDupleSODelivery(strDeliveryScheduleID);
                //Re-load data to grid
                btnSearch_Click(null, null);
            }
            catch (PCSException ex)
            {
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            // Code Inserted Automatically

            #region Code Inserted Automatically

            this.Cursor = Cursors.Default;

            #endregion Code Inserted Automatically
        }
Exemple #2
0
        /// <summary>
        /// btnSearch_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Friday, Feb 17 2006</date>
        private void btnSearch_Click(object sender, System.EventArgs e)
        {
            // Code Inserted Automatically

            #region Code Inserted Automatically

            this.Cursor = Cursors.WaitCursor;

            #endregion Code Inserted Automatically


            const string METHOD_NAME = THIS + ".btnSearch_Click()";
            try
            {
                if (ValidateDataToSearch())
                {
                    DateTime dtmDateToSearch = new DateTime(int.Parse(cboYear.SelectedItem.ToString()), int.Parse(cboMonth.SelectedItem.ToString()), 1);
                    AvoidDupleSODeliveryBO boAvoidDupleSODelivery = new AvoidDupleSODeliveryBO();
                    dtbData = boAvoidDupleSODelivery.SearchDupleSO(dtmDateToSearch, int.Parse(txtCustomer.Tag.ToString()));
                    dtbData.Columns.Add(SELECT, typeof(bool));
                    dgrdData.DataSource = dtbData;
                    for (int i = 0; i < dgrdData.RowCount; i++)
                    {
                        dgrdData[i, SELECT] = false;
                        dgrdData[i, PRO_WorkOrderDetailTable.LINE_FLD] = i + 1;
                    }
                    //Restore layout
                    FormControlComponents.RestoreGridLayout(dgrdData, dtbGridLayOut);
                    ConfigGrid(true);
                }
            }
            catch (PCSException ex)
            {
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }


            // Code Inserted Automatically

            #region Code Inserted Automatically

            this.Cursor = Cursors.Default;

            #endregion Code Inserted Automatically
        }