Пример #1
0
        private void dgvActivityInstructions_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                try
                {
                    long ID = Convert.ToInt64(dgvActivityInstructions.Rows[e.RowIndex].Cells["ID"].Value);

                    RPDBatchActivityInstructions obj = objRPDBatchActivityInstructionsDL.Get(ID);
                    if (obj != null)
                    {
                        cmbActivityInstructions.SelectedValue = obj.Activity.MainActID;
                        if (cmbMachine.Items.Count > 0)
                        {
                            cmbMachine.SelectedValue     = obj.Machine.MachineCode;
                            txtDescription.Text          = obj.Description;
                            txtParticleSize.Text         = obj.ParticleSize;
                            InstructionID                = obj.ID;
                            btnDeleteInstruction.Enabled = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, "Error occured while loading", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Пример #2
0
        public RPDBatchActivityInstructions Get(long ID)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@RPDBatchActivityInstructionsID", ID)
                };


                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_RPDBatchActivityInstructions_By_ID", paramList);

                RPDBatchActivityInstructions obj = new RPDBatchActivityInstructions();

                if (dt.Rows.Count > 0)
                {
                    obj.ID           = Convert.ToInt64(dt.Rows[0]["RPDBatchActivityInstructionsID"]);
                    obj.RPDBatch     = objRPDBatch_DL.Get(Convert.ToString(dt.Rows[0]["BatchNo"]));
                    obj.Activity     = objMainActivity_DL.Get(Convert.ToInt64(dt.Rows[0]["ActivityID"]));
                    obj.Machine      = objMachine_DL.Get(Convert.ToString(dt.Rows[0]["MachineID"]));
                    obj.ParticleSize = Convert.ToString(dt.Rows[0]["ParticleSize"]);
                    obj.Description  = Convert.ToString(dt.Rows[0]["InstructionDesc"]);
                }

                return(obj);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Пример #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);
            }
        }
Пример #4
0
        public long Add(RPDBatchActivityInstructions obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@RPDBatchActivityInstructionsID", obj.ID),
                    new SqlParameter("@BatchNo", obj.RPDBatch.RPDBatchID),
                    new SqlParameter("@ActivityID", obj.Activity.MainActID),
                    new SqlParameter("@MachineID", obj.Machine.MachineCode),
                    new SqlParameter("@ParticleSize", obj.ParticleSize),
                    new SqlParameter("@InstructionDesc", obj.Description),
                    new SqlParameter("@outParam", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.Output
                    }
                };

                return(Execute.RunSP_Output(Connection, "SPADD_RPDBatchActivityInstructions_Update", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }