예제 #1
0
        private void txtMachineStop_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    BatchMachineDetails obj = new BatchMachineDetails();

                    obj.BatchAct   = objBatchActivity;
                    obj.StartTime  = txtMachineStart.Text;
                    obj.StopTime   = txtMachineStop.Text;
                    obj.TheMachine = objMachine_DL.Get(cmbMachine.SelectedValue.ToString());

                    objBatchMachineDetails_DL.Add(obj);

                    Load_BatchMachineDetails();

                    txtMachineStart.Text = "";
                    txtMachineStop.Text  = "";
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Error occured while loading Machine Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtMachineStart.Text = "";
                    txtMachineStop.Text  = "";
                    cmbMachine.Select();
                }
            }
        }
예제 #2
0
        private void dgvMachineDetails_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                DialogResult theResult = MessageBox.Show(this, "Do you want to delete the selected Record", "Confirmation", MessageBoxButtons.YesNo);

                if (theResult == System.Windows.Forms.DialogResult.Yes)
                {
                    BatchMachineDetails obj = new BatchMachineDetails();

                    objBatchMachineDetails_DL.Delete(Convert.ToInt32(dgvMachineDetails.CurrentRow.Cells["MachineRecID"].Value));

                    Load_BatchMachineDetails();
                }
            }
        }
예제 #3
0
        private void txtMachineStop_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    if (objBatchActivity.BatchActStatus == BatchActivity.Status.Finished)
                    {
                        MessageBox.Show(this, "Activity is already Finished", "Wrong Attempt", MessageBoxButtons.OK);

                        txtMachineStart.Text = "";
                        txtMachineStop.Text  = "";
                    }
                    else
                    {
                        if (!DataValidation.IsTimeShift(txtMachineStart.Text, txtMachineStop.Text))
                        {
                            MessageBox.Show(this, "please enter valid time period", "MRP System", MessageBoxButtons.OK);
                        }
                        else
                        {
                            BatchMachineDetails obj = new BatchMachineDetails();

                            obj.BatchAct   = objBatchActivity;
                            obj.StartTime  = txtMachineStart.Text;
                            obj.StopTime   = txtMachineStop.Text;
                            obj.TheMachine = objMachine_DL.Get(cmbMachine.SelectedValue.ToString());

                            objBatchMachineDetails_DL.Add(obj);

                            Load_BatchMachineDetails();

                            txtMachineStart.Text = "";
                            txtMachineStop.Text  = "";
                        }
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Error occured while loading Machine Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtMachineStart.Text = "";
                    txtMachineStop.Text  = "";
                    cmbMachine.Select();
                }
            }
        }
예제 #4
0
        public long Add(BatchMachineDetails objBatchMachineDetails)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@BatchActID", objBatchMachineDetails.BatchAct.BatchActID),
                    new SqlParameter("@MachineID", objBatchMachineDetails.TheMachine.MachineCode),
                    new SqlParameter("@MachineStart", objBatchMachineDetails.StartTime),
                    new SqlParameter("@MachineStop", objBatchMachineDetails.StopTime)
                };

                return(Execute.RunSP_Int(Connection, "SPADD_BatchMachineDetails", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
예제 #5
0
        private void dgvMachineDetails_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                DialogResult theResult = MessageBox.Show(this, "Do you want to delete the selected Record", "Confirmation", MessageBoxButtons.YesNo);

                if (objPRPDBatchActivity.State == PRPDBatchActivity.ActStatus.Finished)
                {
                    MessageBox.Show(this, "This Activity Is Finished.", "Wrong Attempt", MessageBoxButtons.OK);
                }
                else
                {
                    if (theResult == System.Windows.Forms.DialogResult.Yes)
                    {
                        BatchMachineDetails obj = new BatchMachineDetails();

                        objPRPDActivityDetailsMachine_DL.Delete(Convert.ToInt32(dgvMachineDetails.CurrentRow.Cells["MachineRecID"].Value));

                        Load_Machine_List();
                    }
                }
            }
        }