private void AddSMRNServListRow(smrnservicedlist tempServ) { List <smrndetail> SMRNDetail = SMRNServicedListDB.getSMRNDetailForServiceList(tempServ, 2); grdSMRNServList.Rows.Clear(); grdSMRNServList.Columns["Check"].Visible = true; int i = 0; foreach (smrndetail smrnd in SMRNDetail) { if (!AddSMRNDetailRow()) { MessageBox.Show("Error found in Adding rows to SMRNGrdiDetail."); } else { grdSMRNServList.Rows[i].Cells["Item"].Value = smrnd.StockItemID + "-" + smrnd.StockItemName; grdSMRNServList.Rows[i].Cells["SerialNo"].Value = smrnd.SerialNo; grdSMRNServList.Rows[i].Cells["ItemDetails"].Value = smrnd.ItemDetails; grdSMRNServList.Rows[i].Cells["WarrantyStatus"].Value = showStatus(smrnd.WarrantyStatus); grdSMRNServList.Rows[i].Cells["ProductServiceStatus"].Value = smrnd.ProductServiceStatus; grdSMRNServList.Rows[i].Cells["gSMRNHeaderNo"].Value = smrnd.InspectionStatus; // for SMRNHeaderNo grdSMRNServList.Rows[i].Cells["gSMRNHeaderDate"].Value = smrnd.TemporaryDate; // for SMRN HEader date grdSMRNServList.Rows[i].Cells["gTemporaryNo"].Value = smrnd.TemporaryNo; grdSMRNServList.Rows[i].Cells["gTemporarydate"].Value = smrnd.TemporaryDate; grdSMRNServList.Rows[i].Cells["JobId"].Value = smrnd.JobIDNo; } i++; } }
private void btnFinalize_Click(object sender, EventArgs e) { try { SMRNServicedListDB ServListDB = new SMRNServicedListDB(); DialogResult dialog = MessageBox.Show("Are you sure to Finalize the document ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { if (ServListDB.FinalizeSMRNServicedList(prevservlist)) { MessageBox.Show("SMRNService List Finalized"); closeAllPanels(); listOption = 1; ListFilteredSMRNServiceList(listOption); setButtonVisibility("btnEditPanel"); //activites are same for cance, forward,approce and reverse } else { MessageBox.Show("Failed to Finalize"); } } } catch (Exception) { } }
private void ListFilteredSMRNServiceList(int opt) { try { grdList.Rows.Clear(); SMRNServicedListDB ServListDB = new SMRNServicedListDB(); List <smrnservicedlist> ServList = ServListDB.getFilteredServicedList(userString, opt, userCommentStatusString); if (opt == 1) { lblActionHeader.Text = "List of Action Pending Documents"; } else if (opt == 2) { lblActionHeader.Text = "List of In-Process Documents"; } else if (opt == 3 || opt == 6) { lblActionHeader.Text = "List of Approved Documents"; } foreach (smrnservicedlist list in ServList) { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["gDocumentID"].Value = list.DocumentID; grdList.Rows[grdList.RowCount - 1].Cells["ListNo"].Value = list.ListNo; grdList.Rows[grdList.RowCount - 1].Cells["ListDate"].Value = list.ListDate; grdList.Rows[grdList.RowCount - 1].Cells["gTrackingNo"].Value = list.TrackingNo; grdList.Rows[grdList.RowCount - 1].Cells["gTrackingdate"].Value = list.TrackingDate; grdList.Rows[grdList.RowCount - 1].Cells["gCustomerPONo"].Value = list.CustomerPONo; grdList.Rows[grdList.RowCount - 1].Cells["gCustomerPODate"].Value = list.CustomerPODate; grdList.Rows[grdList.RowCount - 1].Cells["Customer"].Value = list.CustomerID; //grdList.Rows[grdList.RowCount - 1].Cells["JobIDNo"].Value = list.JobIDNo; //grdList.Rows[grdList.RowCount - 1].Cells["gStatus"].Value = list.Status; //grdList.Rows[grdList.RowCount - 1].Cells["DocumentStatus"].Value = list.DocumentStatus; //grdList.Rows[grdList.RowCount - 1].Cells["gCreateTime"].Value = list.CreateTime; //grdList.Rows[grdList.RowCount - 1].Cells["gCreateUser"].Value = list.CreateUser; } } catch (Exception ex) { MessageBox.Show("Error in SMRNService Listing"); } setButtonVisibility("init"); pnlList.Visible = true; //try //{ // //grdList.Columns["gCreateUser"].Visible = true; // // grdList.Columns["Forwarder"].Visible = true; // // grdList.Columns["Approver"].Visible = true; //} //catch (Exception ex) //{ //} }
private void btnDelete_Click(object sender, EventArgs e) { bool status = true; try { DialogResult dialog = MessageBox.Show("Are you sure to delete the document ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { SMRNServicedListDB ServListDB = new SMRNServicedListDB(); smrnservicedlist smrnserv; List <smrnservicedlist> SMRNServList = new List <smrnservicedlist>(); for (int i = 0; i < grdSMRNServList.Rows.Count; i++) { smrnserv = new smrnservicedlist(); smrnserv.SMRNHeaderNo = Convert.ToInt32(grdSMRNServList.Rows[i].Cells["gSMRNHeaderNo"].Value.ToString().Trim()); smrnserv.SMRNHeaderDate = Convert.ToDateTime(grdSMRNServList.Rows[i].Cells["gSMRNHeaderDate"].Value.ToString().Trim()); smrnserv.JobIDNo = Convert.ToInt32(grdSMRNServList.Rows[i].Cells["JobId"].Value.ToString().Trim()); smrnserv.ListNo = Convert.ToInt32(grdSMRNServList.Rows[i].Cells["gTemporaryNo"].Value.ToString().Trim()); /// For storing TemporaryNo of SMRNDetail smrnserv.ListDate = Convert.ToDateTime(grdSMRNServList.Rows[i].Cells["gTemporaryDate"].Value.ToString().Trim()); ////for storing temporaryDate of SMRNdetail SMRNServList.Add(smrnserv); } if (ServListDB.updateSMRNServicedList(prevservlist, SMRNServList, 2)) { MessageBox.Show("SMRNService List Deleted"); closeAllPanels(); listOption = 1; ListFilteredSMRNServiceList(listOption); //pnlBottomActions.Visible = true; } else { MessageBox.Show("Failed to Delete"); status = false; } } else { return; } } catch (Exception ex) { } if (!status) { MessageBox.Show("Failed to Delete"); status = false; } if (status) { setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save } }
private void ListFilteredProdTestTempList(int opt) { try { grdList.Rows.Clear(); SMRNServicedListDB ServListDB = new SMRNServicedListDB(); List <producttesttemplateheader> PTempList = ProductTestTemplateDB.getFilteredProdTemp(opt); if (opt == 1) { lblActionHeader.Text = "List of Action Pending Documents"; } else if (opt == 2) { lblActionHeader.Text = "List of Approved Documents"; } else if (opt == 3 || opt == 6) { lblActionHeader.Text = "List of Approved Documents"; } foreach (producttesttemplateheader ptemp in PTempList) { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["gDocumentID"].Value = ptemp.DocumentID; grdList.Rows[grdList.RowCount - 1].Cells["TemplateNo"].Value = ptemp.TemplateNo; grdList.Rows[grdList.RowCount - 1].Cells["TemplateDate"].Value = ptemp.TemplateDate; grdList.Rows[grdList.RowCount - 1].Cells["StockItemID"].Value = ptemp.StockItemID; grdList.Rows[grdList.RowCount - 1].Cells["StockItemName"].Value = ptemp.StockItemName; grdList.Rows[grdList.RowCount - 1].Cells["ModelNo"].Value = ptemp.ModelNo; grdList.Rows[grdList.RowCount - 1].Cells["ModelName"].Value = ptemp.ModelName; grdList.Rows[grdList.RowCount - 1].Cells["Status"].Value = ptemp.Status; grdList.Rows[grdList.RowCount - 1].Cells["gCreateTime"].Value = ptemp.CreateTime; grdList.Rows[grdList.RowCount - 1].Cells["gCreateUser"].Value = ptemp.CreateUser; grdList.Rows[grdList.RowCount - 1].Cells["Creator"].Value = ptemp.CreatorName; } } catch (Exception ex) { MessageBox.Show("Error in Product Test Template Listing"); } setButtonVisibility("init"); pnlList.Visible = true; try { grdList.Columns["gCreateUser"].Visible = true; grdList.Columns["Creator"].Visible = true; } catch (Exception ex) { } }
private Boolean AddSMRNServListRowForFinalize(smrnservicedlist prevservlist) { Boolean status = true; try { List <smrndetail> SMRNDetail = SMRNServicedListDB.getSMRNDetailForServiceList(prevservlist, 1); grdSMRNServList.Rows.Clear(); int i = 0; foreach (smrndetail smrnd in SMRNDetail) { if (!AddSMRNDetailRow()) { status = false; MessageBox.Show("Error found in Adding rows to SMRNGrdiDetail."); } else { grdSMRNServList.Rows[i].Cells["Item"].Value = smrnd.StockItemID + "-" + smrnd.StockItemName; grdSMRNServList.Rows[i].Cells["SerialNo"].Value = smrnd.SerialNo; grdSMRNServList.Rows[i].Cells["ItemDetails"].Value = smrnd.ItemDetails; grdSMRNServList.Rows[i].Cells["WarrantyStatus"].Value = showStatus(smrnd.WarrantyStatus); grdSMRNServList.Rows[i].Cells["ProductServiceStatus"].Value = smrnd.ProductServiceStatus; grdSMRNServList.Rows[i].Cells["gSMRNHeaderNo"].Value = smrnd.InspectionStatus; // for SMRNHeaderNo grdSMRNServList.Rows[i].Cells["gSMRNHeaderDate"].Value = smrnd.TemporaryDate; // for SMRN HEader date grdSMRNServList.Rows[i].Cells["gTemporaryNo"].Value = smrnd.TemporaryNo; grdSMRNServList.Rows[i].Cells["gTemporarydate"].Value = smrnd.TemporaryDate; grdSMRNServList.Rows[i].Cells["JobId"].Value = smrnd.JobIDNo; } i++; } } catch (Exception ex) { status = false; } return(status); }
private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } string columnName = grdList.Columns[e.ColumnIndex].Name; if (columnName.Equals("Finalize") || columnName.Equals("View") || columnName.Equals("Print")) { if (columnName.Equals("Finalize")) { grdSMRNServList.Columns["Check"].Visible = false; grdSMRNServList.ReadOnly = true; btnSelectSMRNHeaderNo.Enabled = false; } clearData(); setButtonVisibility(columnName); docID = grdList.Rows[e.RowIndex].Cells[0].Value.ToString(); QIHeaderDB qidb = new QIHeaderDB(); int rowID = e.RowIndex; btnSave.Text = "Update"; DataGridViewRow row = grdList.Rows[rowID]; prevservlist = new smrnservicedlist(); prevservlist.DocumentID = grdList.Rows[e.RowIndex].Cells["gDocumentID"].Value.ToString(); prevservlist.ListNo = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["ListNo"].Value.ToString()); prevservlist.ListDate = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["ListDate"].Value.ToString()); prevservlist.TrackingNo = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["gTrackingNo"].Value.ToString()); prevservlist.TrackingDate = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["gtrackingDate"].Value.ToString()); prevservlist.CustomerPONo = grdList.Rows[e.RowIndex].Cells["gCustomerPONo"].Value.ToString(); prevservlist.CustomerPODate = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["gCustomerPODate"].Value.ToString()); prevservlist.CustomerID = grdList.Rows[e.RowIndex].Cells["Customer"].Value.ToString(); if (columnName.Equals("Print")) { pnlAddEdit.Visible = false; pnlList.Visible = true; grdList.Visible = true; btnNew.Visible = true; btnExit.Visible = true; PrintSMRNServicedList printServ = new PrintSMRNServicedList(); List <smrndetail> SMRNDetail = SMRNServicedListDB.getSMRNDetailForServiceList(prevservlist, 1); printServ.PrintServicedList(SMRNDetail, prevservlist); btnNew.Visible = true; btnExit.Visible = true; return; } txtListNo.Text = prevservlist.ListNo.ToString(); txtTrackingNo.Text = prevservlist.TrackingNo.ToString(); txtCustomer.Text = prevservlist.CustomerID; txtCustPONo.Text = prevservlist.CustomerPONo; dtCustPODate.Value = prevservlist.CustomerPODate; dtListDate.Value = prevservlist.ListDate; if (!AddSMRNServListRowForFinalize(prevservlist)) { MessageBox.Show("failed to add rows in grdSMRNServList"); } btnSave.Text = "Update"; pnlList.Visible = false; pnlAddEdit.Visible = true; btnSave.Text = "Update"; pnlList.Visible = false; pnlAddEdit.Visible = true; } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
private void btnSave_Click(object sender, EventArgs e) { Boolean status = true; try { List <smrnservicedlist> SMRNServList; SMRNServicedListDB ServListDB = new SMRNServicedListDB(); smrnservicedlist ServList = new smrnservicedlist(); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btnSave.Text; try { ServList.DocumentID = docID; smrnservicedlist smrnserv; SMRNServList = new List <smrnservicedlist>(); for (int i = 0; i < grdSMRNServList.Rows.Count; i++) { try { DataGridViewCheckBoxCell cell = grdSMRNServList.Rows[i].Cells["check"] as DataGridViewCheckBoxCell; if (cell.Value != null) { if (Convert.ToBoolean(cell.Value) == true) { smrnserv = new smrnservicedlist(); smrnserv.SMRNHeaderNo = Convert.ToInt32(grdSMRNServList.Rows[i].Cells["gSMRNHeaderNo"].Value.ToString().Trim()); smrnserv.SMRNHeaderDate = Convert.ToDateTime(grdSMRNServList.Rows[i].Cells["gSMRNHeaderDate"].Value.ToString().Trim()); smrnserv.JobIDNo = Convert.ToInt32(grdSMRNServList.Rows[i].Cells["JobId"].Value.ToString().Trim()); smrnserv.ListNo = Convert.ToInt32(grdSMRNServList.Rows[i].Cells["gTemporaryNo"].Value.ToString().Trim()); /// For storing TemporaryNo of SMRNDetail smrnserv.ListDate = Convert.ToDateTime(grdSMRNServList.Rows[i].Cells["gTemporaryDate"].Value.ToString().Trim()); ////for storing temporaryDate of SMRNdetail SMRNServList.Add(smrnserv); } } } catch (Exception ex) { MessageBox.Show("createAndUpdateSMRNDetails() : Error creating SMRN Details"); status = false; return; } } ServList.Status = 1; } catch (Exception ex) { MessageBox.Show("Validation failed"); return; } if (btnText.Equals("Save")) { ServList.ListNo = DocumentNumberDB.getNewNumber(docID, 1); ServList.DocumentStatus = 1; ServList.ListDate = UpdateTable.getSQLDateTime(); } else { ServList.ListNo = Convert.ToInt32(txtListNo.Text); ServList.DocumentStatus = prevservlist.DocumentStatus; ServList.ListDate = prevservlist.ListDate; } if (btnText.Equals("Save")) { if (ServListDB.updateSMRNServicedList(ServList, SMRNServList, 1)) { MessageBox.Show("SMRNService List Details Added"); closeAllPanels(); listOption = 1; ListFilteredSMRNServiceList(listOption); } else { status = false; } if (!status) { MessageBox.Show("Failed to Insert SMRNServiceList"); status = false; } } else { MessageBox.Show("SMRNServiceList Validation failed"); status = false; } } catch (Exception ex) { MessageBox.Show("SMRNServiceList Validation failed"); status = false; } if (status) { setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save } }