private void dgvBatcList_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dt.Rows.Count > 0) { if (dgvBatcList.CurrentRow.IsNewRow == false) { objBatch = objBatch_DL.Get(dgvBatcList.CurrentRow.Cells["BatchNo"].Value.ToString()); objBatchActivity = objBatchActivity_DL.Get(objBatch.BatchID, objMainAct.MainActID); if (objBatchActivity.BatchActID != 0) { } else { objBatchActivity = new BatchActivity(); objBatchActivity.Batch = objBatch; objBatchActivity.BatchActStatus = BatchActivity.Status.Initial; objBatchActivity.BlockNextActivity = true; objBatchActivity.SequenceNo = -1; objBatchActivity.Part = "N/A"; objBatchActivity.MainActivity = objMainAct; objBatchActivity.LastEdited = DateTime.Now; objBatchActivity.ActType = "Manufacturing"; long ID = objBatchActivity_DL.Add(objBatchActivity); if (ID > 0) { objBatchActivity.BatchActID = ID; } } Load_LabourDetails(); Load_Formula(objBatch.BatchID, Part); } } } catch (Exception) { MessageBox.Show(this, "Error occured while loading", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnApprove_Click(object sender, EventArgs e) { try { MainActivity_DL objMainActivity_DL = new MainActivity_DL(ConnectionStringClass.GetConnection()); DialogResult dr = MessageBox.Show(this, "Do you want to Approve Selected Batch?\n\nClick Yes to Approve", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.Yes) { objBatch.BatchApprovedBy = CurrentUser.UserEmp; objBatch.BatchStatus = Batch.Status.Approved; int x = objBatchDL.Update_Approve(objBatch); if (x > 0) { BatchActivity objWeigh = new BatchActivity(); MainActivity objMainAct = objMainActivity_DL.GetByName("Weighing"); objWeigh.Batch = objBatch; objWeigh.BatchActStatus = BatchActivity.Status.Initial; objWeigh.BlockNextActivity = false; objWeigh.SequenceNo = -1; objWeigh.Part = "N/A"; objWeigh.MainActivity = objMainAct; objWeigh.LastEdited = DateTime.Now; objWeigh.ActType = "Manufacturing"; objWeigh.ActMethod = "Normal"; objBatchActivity_DL.Add(objWeigh); Clear(); LoadBatches(Batch.Status.Initial); objBatch = new Batch(); } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }