protected void gvOrderAcceptanceChecklist_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { _currentOrderAcceptanceChecklist = new OrderAcceptanceChecklistDL(); _currentOrderAcceptanceChecklist.OrderAcceptanceCheckListID = Convert.ToInt32(gvOrderAcceptanceChecklist.DataKeys[e.RowIndex].Value); _currentOrderAcceptanceChecklist.ScreenMode = ScreenMode.Delete; TransactionResult transactionResult = _currentOrderAcceptanceChecklist.Commit(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(string.Concat("<script>alert(\'", transactionResult.Message.ToString(), ".\');")); stringBuilder.Append("</script>"); ScriptManager.RegisterStartupScript(base.Page, typeof(string), "MyScript", stringBuilder.ToString(), false); if (transactionResult.Status == TransactionStatus.Success) { GetOrderAcceptanceChecklistDetails(); } } catch (Exception exception1) { ErrorLog.LogErrorMessageToDB("ManageOrderAcceptanceCheckList.aspx", "", "gvOrderAcceptanceChecklist_RowDeleting", exception1.Message.ToString(), new ACEConnection()); throw; } }
protected void btnOrderAcceptanceCheckListAdd_Click(object sender, ImageClickEventArgs e) { try { string dtFormat = _dateFormat; DateTime dTime; OrderAcceptanceChecklistDL _currentOrderAcceptanceCheckList = new OrderAcceptanceChecklistDL(); bool bl = hfOrderAcceptanceCheckListID.Value.ToString() == "0"; _currentOrderAcceptanceCheckList.AddEditOption = !bl ? 1 : 0; _currentOrderAcceptanceCheckList.OrderAcceptanceCheckListID = Convert.ToInt32(hfOrderAcceptanceCheckListID.Value.ToString()); _currentOrderAcceptanceCheckList.ContactID = Convert.ToInt32(ddlContact.SelectedValue); dTime = DateTime.ParseExact(txtPODate.Text, dtFormat, null); _currentOrderAcceptanceCheckList.QuotationDate = dTime; _currentOrderAcceptanceCheckList.PartDescription = txtPartDescription.Text; _currentOrderAcceptanceCheckList.PONO = txtPONo.Text; dTime = DateTime.ParseExact(txtPODate.Text, dtFormat, null); _currentOrderAcceptanceCheckList.PODate = dTime; _currentOrderAcceptanceCheckList.POAmendRef = txtPOAmendRef.Text; _currentOrderAcceptanceCheckList.DrawingNo_Issue = txtDrawingNo_Issue.Text; _currentOrderAcceptanceCheckList.QuotationRef = txtQuotationRef.Text; if (rbFPO.Checked) { _currentOrderAcceptanceCheckList.NatureOfReview = rbFPO.Text; } if (rbRPO.Checked) { _currentOrderAcceptanceCheckList.NatureOfReview = rbRPO.Text; } if (rbAmend.Checked) { _currentOrderAcceptanceCheckList.NatureOfReview = rbAmend.Text; } if (rbCheck1.Checked) { _currentOrderAcceptanceCheckList.CheckForOption1 = true; } if (rbCheck2.Checked) { _currentOrderAcceptanceCheckList.CheckForOption2 = true; } if (rbCheck3.Checked) { _currentOrderAcceptanceCheckList.CheckForOption3 = true; } if (rbCheck4.Checked) { _currentOrderAcceptanceCheckList.CheckForOption4 = true; } _currentOrderAcceptanceCheckList.Comments = txtComments.Text; if (rbToBeResolved.Checked) { _currentOrderAcceptanceCheckList.ReviewStatus = rbToBeResolved.Text; } if (rbNotToBeResolved.Checked) { _currentOrderAcceptanceCheckList.ReviewStatus = rbNotToBeResolved.Text; } if (rbAccepted.Checked) { _currentOrderAcceptanceCheckList.ReviewStatus = rbAccepted.Text; } if (rbNotAccepted.Checked) { _currentOrderAcceptanceCheckList.ReviewStatus = rbNotAccepted.Text; } if (ddlReviewedBy.SelectedValue != "") { _currentOrderAcceptanceCheckList.ReviewedByID = Convert.ToInt32(ddlReviewedBy.SelectedValue); } if (txtReviewedDate.Text != null || txtReviewedDate.Text != "") { dTime = DateTime.ParseExact(txtReviewedDate.Text, dtFormat, null); _currentOrderAcceptanceCheckList.ReviewedDate = dTime; } if (ddlApprovedBy.SelectedValue != "") { _currentOrderAcceptanceCheckList.ApprovedByID = Convert.ToInt32(ddlApprovedBy.SelectedValue); _currentOrderAcceptanceCheckList.ApprovedDate = dTime; } _currentOrderAcceptanceCheckList.AuditDate = dTime; _currentOrderAcceptanceCheckList.AuditID = Convert.ToInt32(hfUserID.Value); _currentOrderAcceptanceCheckList.ScreenMode = ScreenMode.Add; TransactionResult transactionResult = _currentOrderAcceptanceCheckList.Commit(); bl = transactionResult.Status != TransactionStatus.Success; if (!bl) { hfOrderAcceptanceCheckListID.Value = _currentOrderAcceptanceCheckList.OrderAcceptanceCheckListID.ToString(); OrderAcceptanceParticularsListDL listDL; foreach (GridViewRow innerRow in gvOrderAcceptanceParticularsList.Rows) { listDL = new OrderAcceptanceParticularsListDL(); if (innerRow.Cells[3].Text.ToString() == "") { innerRow.Cells[3].Text = "0"; } bool b2 = innerRow.Cells[3].Text.ToString() == "0"; listDL.AddEditOption = !b2 ? 1 : 0; listDL.OrderAcceptanceParticularsListID = Convert.ToInt32(innerRow.Cells[3].Text.ToString()); listDL.OrderAcceptanceCheckListID = Convert.ToInt32(hfOrderAcceptanceCheckListID.Value.ToString()); listDL.ParticularsID = Convert.ToInt32(innerRow.Cells[1].Text.ToString()); RadioButton rbYes = (RadioButton)innerRow.Cells[4].FindControl("rbCheckYes"); RadioButton rbNo = (RadioButton)innerRow.Cells[4].FindControl("rbCheckNo"); TextBox txtRemarks = (TextBox)innerRow.Cells[5].FindControl("txtRemarks"); listDL.StatusYes = rbYes.Checked; listDL.StatusNo = rbNo.Checked; listDL.Remarks = txtRemarks.Text; listDL.ScreenMode = ScreenMode.Add; listDL.Commit(); } GetOrderAcceptanceCheckListDetails(Convert.ToInt32(hfOrderAcceptanceCheckListID.Value)); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(string.Concat("<script>alert(\'", transactionResult.Message.ToString(), ".\');")); stringBuilder.Append("</script>"); ScriptManager.RegisterStartupScript(base.Page, typeof(string), "MyScript", stringBuilder.ToString(), false); } else { //txtAvailablecount.Text = "0"; //lblOrderAcceptanceCheckListID.Text = "0"; } } catch (Exception exception1) { ErrorLog.LogErrorMessageToDB("ManageOrderAcceptanceCheckList.aspx", "", "btnOrderAcceptanceCheckListAdd_Click", exception1.Message.ToString(), new ACEConnection()); throw; } }
private void GetOrderAcceptanceCheckListDetails(int OrderAcceptanceCheckListID) { try { OrderAcceptanceChecklistDL _currentOrderAcceptanceCheckList = new OrderAcceptanceChecklistDL(); _currentOrderAcceptanceCheckList.GetOrderAcceptanceCheckListByOrderAcceptanceCheckListID(Convert.ToInt32(hfOrderAcceptanceCheckListID.Value.ToString())); ddlContact.SelectedValue = _currentOrderAcceptanceCheckList.ContactID.ToString(); txtPartDescription.Text = _currentOrderAcceptanceCheckList.PartDescription; txtPONo.Text = _currentOrderAcceptanceCheckList.PONO; txtPODate.Text = _currentOrderAcceptanceCheckList.PODate.ToString(); txtPOAmendRef.Text = _currentOrderAcceptanceCheckList.POAmendRef; txtDrawingNo_Issue.Text = _currentOrderAcceptanceCheckList.DrawingNo_Issue; txtQuotationRef.Text = _currentOrderAcceptanceCheckList.QuotationRef; if (_currentOrderAcceptanceCheckList.NatureOfReview.ToString() == "FIRST PURCHASE ORDER") { rbFPO.Checked = true; } if (_currentOrderAcceptanceCheckList.NatureOfReview.ToString() == "REGULAR PURCHASE ORDER") { rbRPO.Checked = true; } if (_currentOrderAcceptanceCheckList.NatureOfReview.ToString() == "AMENDMENTS") { rbAmend.Checked = true; } if (_currentOrderAcceptanceCheckList.CheckForOption1) { rbCheck1.Checked = true; } if (_currentOrderAcceptanceCheckList.CheckForOption2) { rbCheck2.Checked = true; } if (_currentOrderAcceptanceCheckList.CheckForOption3) { rbCheck3.Checked = true; } if (_currentOrderAcceptanceCheckList.CheckForOption4) { rbCheck4.Checked = true; } txtComments.Text = _currentOrderAcceptanceCheckList.Comments; if (_currentOrderAcceptanceCheckList.ReviewStatus == "TO BE RESOLVED") { rbToBeResolved.Checked = true; } if (_currentOrderAcceptanceCheckList.ReviewStatus == "NOT TO BE RESOLVED") { rbToBeResolved.Checked = true; } if (_currentOrderAcceptanceCheckList.ReviewStatus == "ACCEPTED") { rbToBeResolved.Checked = true; } if (_currentOrderAcceptanceCheckList.ReviewStatus == "NOT ACCEPTED") { rbToBeResolved.Checked = true; } txtReviewedDate.Text = _currentOrderAcceptanceCheckList.ReviewedDate.ToString(); ddlReviewedBy.SelectedValue = _currentOrderAcceptanceCheckList.ReviewedByID.ToString(); ddlApprovedBy.SelectedValue = _currentOrderAcceptanceCheckList.ApprovedByID.ToString(); OrderAcceptanceParticularsListDL rlDL = new OrderAcceptanceParticularsListDL(); gvOrderAcceptanceParticularsList.DataSource = rlDL.GetParticularsList().Tables[0]; gvOrderAcceptanceParticularsList.DataBind(); } catch (Exception ex) { ErrorLog.LogErrorMessageToDB("AddEditOrderAcceptanceCheckList.aspx", "", "GetOrderAcceptanceCheckListDetails(int OrderAcceptanceCheckListID)", ex.Message, new ACEConnection()); } }