Exemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbActivity.SelectedValue == null)
                {
                    MessageBox.Show(this, "Please Fill All Fields", "Fill Records", MessageBoxButtons.OK);
                }
                else
                {
                    PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions();

                    obj.Activity = objMainActivity_DL.Get(Convert.ToInt64(cmbActivity.SelectedValue));
                    if (cmbMachine.SelectedValue != null)
                    {
                        obj.Machine     = objMachine_DL.Get(cmbMachine.SelectedValue.ToString());
                        obj.MachineCode = obj.Machine.MachineCode;
                    }
                    else
                    {
                        obj.MachineCode = "No Machine";
                    }

                    obj.ParticleSize = "N/A";
                    if (txtInstruction.Text != "")
                    {
                        obj.InstructionDesc = txtInstruction.Text;
                    }
                    else
                    {
                        obj.InstructionDesc = "No";
                    }
                    obj.PRPDBatch = objPRPDBatch_DL.Get(txtPRPDBatch.Text);

                    objPRPDBatchActivityInstructions_DL.Add(obj);

                    dtPRPDBatchInstructions = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(txtPRPDBatch.Text);

                    dgvActivityInstructions.AutoGenerateColumns = false;
                    dgvActivityInstructions.DataSource          = objSourceInstructions;
                    objSourceInstructions.DataSource            = dtPRPDBatchInstructions;
                    objSourceInstructions.ResetBindings(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Exemplo n.º 2
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();
                }
            }
        }
Exemplo n.º 3
0
        private void btnAddInstructions_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbMachine.SelectedValue != null && cmbActivityInstructions.SelectedValue != null)
                {
                    RPDBatchActivityInstructions obj = new RPDBatchActivityInstructions();
                    obj.Activity     = objMainActivityDL.Get(Convert.ToInt64(cmbActivityInstructions.SelectedValue));
                    obj.Description  = txtDescription.Text;
                    obj.ID           = InstructionID;
                    obj.Machine      = objMachineDL.Get(cmbMachine.SelectedValue.ToString());
                    obj.ParticleSize = txtParticleSize.Text;
                    obj.RPDBatch     = objRPDBatch;
                    obj.Type         = "";
                    long NewID = objRPDBatchActivityInstructionsDL.Add(obj);

                    if (NewID > 0)
                    {
                        dgvActivityInstructions.AutoGenerateColumns = false;
                        bindInstructions.DataSource        = objRPDBatchActivityInstructionsDL.GetDataView(objRPDBatch.RPDBatchID);
                        dgvActivityInstructions.DataSource = bindInstructions;
                        bindInstructions.ResetBindings(true);

                        ClearInstructionForm();
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error occured while saving Instruction", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            cmbMachine.ValueMember   = "MachineID";
            cmbMachine.DisplayMember = "MachineName";

            PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions();

            try
            {
                obj.Activity = objMainActivity_DL.Get(Convert.ToInt64(cmbActivityID.SelectedValue));
                if (txtInstruction.Text != "")
                {
                    obj.InstructionDesc = txtInstruction.Text;
                }
                else
                {
                    obj.InstructionDesc = "No";
                }
                obj.ParticleSize = "N/A";
                if (cmbMachine.SelectedValue != null)
                {
                    obj.MachineCode = cmbMachine.SelectedValue.ToString();
                    obj.Machine     = objMachine_DL.Get(cmbMachine.SelectedValue.ToString());
                    obj.MachineName = obj.Machine.MachineName;
                }
                else
                {
                    obj.MachineCode = "No Machine";
                    obj.MachineName = "No Machine";
                }

                objPRPDBatchActivityInstructionsCollec.Add(obj);

                dgvActivityInstructions.AutoGenerateColumns = false;
                dgvActivityInstructions.DataSource          = objSource;
                objSource.DataSource = objPRPDBatchActivityInstructionsCollec;
                objSource.ResetBindings(true);


                txtInstruction.Text         = "";
                cmbActivityID.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
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();
                }
            }
        }