private void LoadIssueList() { try { DBlayer dba = new DBlayer(); DataSet dsIssues = new DataSet(); string ImpactedFuncs = ""; string ImpactedVenues = ""; foreach (object itemChecked in clbImpactedFuncs.CheckedItems) { DataRowView castedItem = itemChecked as DataRowView; ImpactedFuncs += castedItem["ID"].ToString() + ","; } if (ImpactedFuncs != "") { ImpactedFuncs = ImpactedFuncs.Substring(0, ImpactedFuncs.Length - 1); } foreach (object itemChecked in clbImpactedVenues.CheckedItems) { DataRowView castedItem = itemChecked as DataRowView; ImpactedVenues += castedItem["ID"].ToString() + ","; } if (ImpactedVenues != "") { ImpactedVenues = ImpactedVenues.Substring(0, ImpactedVenues.Length - 1); } try { dsIssues = dba.GetIssues(UserID, UserType, chIssue.Checked, chLog.Checked, chLow.Checked, chMedium.Checked, chHigh.Checked, chNew.Checked, chInprogress.Checked, chClosed.Checked, chDashboard.Checked, chReportable.Checked, chMyList.Checked, ImpactedFuncs, ImpactedVenues, Convert.ToInt32(cbLead.SelectedValue)); } catch { dsIssues = dba.GetIssues(UserID, UserType, chIssue.Checked, chLog.Checked, chLow.Checked, chMedium.Checked, chHigh.Checked, chNew.Checked, chInprogress.Checked, chClosed.Checked, chDashboard.Checked, chReportable.Checked, chMyList.Checked, "", "", -1); } DataView dvIssues = dsIssues.Tables[0].DefaultView; gvIssues.DataSource = dvIssues; } catch { } }
private void MainWindow_Load(object sender, EventArgs e) { //lbUsername.Text = Environment.UserName; DBlayer dba = new DBlayer(); try { DataSet dsFunc = dba.GetTable("GIMfunc", 0); DataView dvFunc = new DataView(dsFunc.Tables[0], "", "FuncCode", DataViewRowState.CurrentRows); clbImpactedFuncs.DataSource = dvFunc; clbImpactedFuncs.DisplayMember = "FuncCode"; clbImpactedFuncs.ValueMember = "ID"; DataSet dsLead = dba.GetTable("GIMfunc", 0); DataRow rLead = dsLead.Tables[0].NewRow(); rLead["ID"] = 0; rLead["FuncCode"] = ""; dsLead.Tables[0].Rows.Add(rLead); DataView dvLead = new DataView(dsLead.Tables[0], "", "FuncCode", DataViewRowState.CurrentRows); cbLead.DataSource = dvLead; cbLead.DisplayMember = "FuncCode"; cbLead.ValueMember = "ID"; DataSet dsVenues = dba.GetTable("GIMvenue", 0); DataView dvVenues = new DataView(dsVenues.Tables[0], "", "VenueCode", DataViewRowState.CurrentRows); clbImpactedVenues.DataSource = dvVenues; clbImpactedVenues.DisplayMember = "VenueCode"; clbImpactedVenues.ValueMember = "ID"; } catch { } LoadIssueList(); Timer timer = new Timer(); timer.Interval = (120 * 1000); // 120 secs timer.Tick += new EventHandler(timer_Tick); timer.Start(); }
private void btOpenIssue_Click(object sender, EventArgs e) { DBlayer dba = new DBlayer(); try { DataSet dsIssue = dba.GetTable("GIMissue", Convert.ToInt32(tbIssueID.Text)); if (Convert.ToInt32(dsIssue.Tables[0].Rows[0]["Type"]) == 1) { EditIssue frm = new GIM.EditIssue(Convert.ToInt32(tbIssueID.Text), UserID); frm.Show(); } else if (Convert.ToInt32(dsIssue.Tables[0].Rows[0]["Type"]) == 2) { AddLog fal = new AddLog(Convert.ToInt32(tbIssueID.Text), UserID); fal.ShowDialog(); } } catch { } }
private void tbEnter_Click(object sender, EventArgs e) { DBlayer dba = new DBlayer(); if (dba.IsServerConnected() == false) { MessageBox.Show("Please check your connection!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (dba.CheckPassword(Convert.ToInt32(cbUsers.SelectedValue), tbPass.Text)) { DataSet userDetails = dba.GetUsers(Convert.ToInt32(cbUsers.SelectedValue)); MainWindow frm = new MainWindow(Convert.ToInt32(cbUsers.SelectedValue), Convert.ToInt32(userDetails.Tables[0].Rows[0]["UserType"])); this.Visible = false; frm.ShowDialog(); } else { MessageBox.Show("The inputed information is not correct!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void EditIssue_Load(object sender, EventArgs e) { DBlayer dba = new DBlayer(); try { DataSet dsSeverity = dba.GetTable("GIMSeverity", 0); DataView dvSeverity = new DataView(dsSeverity.Tables[0], "", "ID", DataViewRowState.CurrentRows); cbSeverity.DataSource = dvSeverity; cbSeverity.DisplayMember = "SeverityName"; cbSeverity.ValueMember = "ID"; DataSet dsStatus = dba.GetTable("GIMStatus", 0); DataView dvStatus = new DataView(dsStatus.Tables[0], "", "ID", DataViewRowState.CurrentRows); cbStatus.DataSource = dvStatus; cbStatus.DisplayMember = "StatusName"; cbStatus.ValueMember = "ID"; DataSet dsLead = dba.GetTable("GIMfunc", 0); DataView dvLead = new DataView(dsLead.Tables[0], "", "FuncCode", DataViewRowState.CurrentRows); cbLeadFunc.DataSource = dvLead; cbLeadFunc.DisplayMember = "FuncCode"; cbLeadFunc.ValueMember = "ID"; DataSet dsLocation = dba.GetTable("GIMvenue", 0); DataRow rCT = dsLocation.Tables[0].NewRow(); rCT["ID"] = 0; rCT["VenueCode"] = ""; dsLocation.Tables[0].Rows.Add(rCT); DataView dvLocation = new DataView(dsLocation.Tables[0], "", "VenueCode", DataViewRowState.CurrentRows); cbLocation.DataSource = dvLocation; cbLocation.DisplayMember = "VenueCode"; cbLocation.ValueMember = "ID"; } catch { } LoadEditIssue(); }
private void LoadEditIssue() { try { DBlayer dba = new DBlayer(); DataSet dsIssue = dba.GetTable("GIMissue", IssueID); tbTitle.Text = dsIssue.Tables[0].Rows[0]["Title"].ToString(); tbDesc.Text = dsIssue.Tables[0].Rows[0]["Description"].ToString(); cbLocation.SelectedValue = dsIssue.Tables[0].Rows[0]["Location"]; cbStatus.SelectedValue = dsIssue.Tables[0].Rows[0]["IssueStatus"]; cbSeverity.SelectedValue = dsIssue.Tables[0].Rows[0]["IssueSeverity"]; tbLocationDesc.Text = dsIssue.Tables[0].Rows[0]["LocationDesc"].ToString(); cbLeadFunc.SelectedValue = dsIssue.Tables[0].Rows[0]["LeadFunction"]; lblDoc.Text = dsIssue.Tables[0].Rows[0]["Attachment"].ToString(); DataSet dsUsers = dba.GetTable("GIMusers", Convert.ToInt32(dsIssue.Tables[0].Rows[0]["RaisedBy"])); lblRaisedBy.Text = "Raised by: " + dsUsers.Tables[0].Rows[0]["Ucode"].ToString() + " (" + dsIssue.Tables[0].Rows[0]["Creator"].ToString() + ")"; DateTime dtOcc = Convert.ToDateTime(dsIssue.Tables[0].Rows[0]["DateOccurence"].ToString()); tbDoccur.Text = dtOcc.Date.ToShortDateString(); tbHour.Text = dtOcc.Hour.ToString(); tbMin.Text = dtOcc.Minute.ToString(); DateTime dtUpd = Convert.ToDateTime(dsIssue.Tables[0].Rows[0]["DateUpdated"].ToString()); tbDupdate.Text = dtUpd.Date.ToShortDateString(); tbHour2.Text = dtUpd.Hour.ToString(); tbMin2.Text = dtUpd.Minute.ToString(); if (Convert.ToInt32(dsIssue.Tables[0].Rows[0]["IssueStatus"]) == 4) { if (dsIssue.Tables[0].Rows[0]["DateActualEnd"].ToString() != "") { DateTime dtActEnd = Convert.ToDateTime(dsIssue.Tables[0].Rows[0]["DateActualEnd"].ToString()); tbDactual.Text = dtActEnd.Date.ToShortDateString(); tbHour3.Text = dtActEnd.Hour.ToString(); tbMin3.Text = dtActEnd.Minute.ToString(); } } if (UserID != 1) { if (Convert.ToInt32(dsIssue.Tables[0].Rows[0]["RaisedBy"]) != UserID) { btEdit.Enabled = false; btCloseIssue.Visible = false; } } if (Convert.ToInt32(dsIssue.Tables[0].Rows[0]["Dashboard"]) == 1) { chDashboard.Checked = true; } else { chDashboard.Checked = false; } if (Convert.ToInt32(dsIssue.Tables[0].Rows[0]["Reportable"]) == 1) { chReportable.Checked = true; } else { chReportable.Checked = false; } DataSet impFuncs = dba.GetIssueImpcFuncs(IssueID); string impactedFuncs = ""; for (int i = 0; i < impFuncs.Tables[0].Rows.Count; i++) { impactedFuncs += impFuncs.Tables[0].Rows[i]["FuncCode"].ToString() + ", "; } if (impactedFuncs != "") { impactedFuncs = impactedFuncs.Substring(0, impactedFuncs.Length - 2); } tbImpactedFuncs.Text = impactedFuncs; DataSet impVenues = dba.GetIssueImpcVenues(IssueID); string impactedVenues = ""; for (int i = 0; i < impVenues.Tables[0].Rows.Count; i++) { impactedVenues += impVenues.Tables[0].Rows[i]["VenueCode"].ToString() + ", "; } if (impactedVenues != "") { impactedVenues = impactedVenues.Substring(0, impactedVenues.Length - 2); } tbImpactedVenues.Text = impactedVenues; DataSet dsUpdates = dba.GetUpdates(IssueID); DataView dvUpdates = dsUpdates.Tables[0].DefaultView; gvUpdates.DataSource = dvUpdates; } catch { } }