Exemplo n.º 1
0
        public PRPDBatchActivityInstructions.PRPDBatchActivityInstructionsCollec Get()
        {
            try
            {
                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_PRPDBatchActivityInstructions");

                PRPDBatchActivityInstructions.PRPDBatchActivityInstructionsCollec objCollec = new PRPDBatchActivityInstructions.PRPDBatchActivityInstructionsCollec();
                PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions();

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        obj.PRPDBatchActivityInstructionsID = Convert.ToInt64(dt.Rows[i]["PRPDBatchActivityInstructionsID"]);
                        obj.PRPDBatch       = objPRPDBatch_DL.Get(Convert.ToString(dt.Rows[i]["PRPDBatchID"]));
                        obj.Machine         = objMachine_DL.Get(Convert.ToString(dt.Rows[i]["MachineID"]));
                        obj.Activity        = objMainActivity_DL.Get(Convert.ToInt64(dt.Rows[i]["ActivityID"]));
                        obj.ActivityID      = Convert.ToInt64(dt.Rows[i]["ActivityID"]);
                        obj.MachineCode     = Convert.ToString(dt.Rows[i]["MachineID"]);
                        obj.ParticleSize    = Convert.ToString(dt.Rows[i]["ParticleSize"]);
                        obj.InstructionDesc = Convert.ToString(dt.Rows[i]["InstructionDesc"]);

                        objCollec.Add(obj);
                    }
                }

                return(objCollec);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 2
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);
            }
        }