public Ticket[] GetTickets(IDatabaseProvider db) { if (db == null) { throw new ArgumentNullException(nameof(db)); } if (ID == InvalidID) { string message = Resources.String_CurrentObjectDoesNotExistInTheDatabase; throw new InvalidOperationException(message); } TicketsTableAdapter tableAdapter = db.DB.TicketsTableAdapter; PeygirDatabaseDataSet.TicketsDataTable rows = tableAdapter.GetDataByProjectID(ID); // Create list. List <Ticket> tickets = new List <Ticket>(); foreach (var row in rows) { // Add. Ticket ticket = new Ticket(row); tickets.Add(ticket); } return(tickets.ToArray()); }
protected override void DeletePrivate(Database db) { TicketsTableAdapter tableAdapter = db.TicketsTableAdapter; tableAdapter.DeleteByID(ID); ID = InvalidID; }
static Database() { currentnDatabasePath = null; isOpen = false; projectsTableAdapter = null; milestonesTableAdapter = null; ticketReportersTableAdapter = null; ticketAssigneesTableAdapter = null; ticketsTableAdapter = null; attachmentsWithoutContentsTableAdapter = null; attachmentsTableAdapter = null; ticketsHistoryTableAdapter = null; }
public static Ticket GetTicket(IDatabaseProvider db, int id) { if (db == null) { throw new ArgumentNullException(nameof(db)); } TicketsTableAdapter tableAdapter = db.DB.TicketsTableAdapter; PeygirDatabaseDataSet.TicketsDataTable rows = tableAdapter.GetDataByID(id); if (rows.Count == 1) { // Found. Ticket ticket = new Ticket(rows[0]); return(ticket); } // Not found. return(null); }
protected override void UpdatePrivate(Database db) { modifyTimestamp = DateTime.UtcNow; TicketsTableAdapter tableAdapter = db.TicketsTableAdapter; tableAdapter.UpdateByID( milestoneID, ticketNumber, summary, reportedBy, (int)type, (int)severity, (int)state, assignedTo, (int)priority, description, modifyTimestamp, ID); }
public Ticket(IDatabaseProvider db, int projectID, int milestoneID) { if (db == null) { throw new ArgumentNullException(nameof(db)); } if (projectID == InvalidID) { string message = Resources.String_InvalidProjectID; throw new ArgumentException(message, nameof(projectID)); } if (milestoneID == InvalidID) { string message = Resources.String_InvalidMilestoneID; throw new ArgumentException(message, nameof(milestoneID)); } this.milestoneID = milestoneID; ticketNumber = 0; summary = string.Empty; reportedBy = string.Empty; type = (TicketType)(-1); severity = (TicketSeverity)(-1); state = (TicketState)(-1); assignedTo = string.Empty; priority = (TicketPriority)(-1); description = string.Empty; // Find max ticket number. TicketsTableAdapter tableAdapter = db.DB.TicketsTableAdapter; int?maxTicketNumber = tableAdapter.GetMaxTicketNumber(projectID); if (maxTicketNumber.HasValue) { ticketNumber = maxTicketNumber.Value + 1; } else { ticketNumber = 1; } }
public static Ticket[] GetTickets(IDatabaseProvider db, int milestoneID) { if (db == null) { throw new ArgumentNullException(nameof(db)); } TicketsTableAdapter tableAdapter = db.DB.TicketsTableAdapter; PeygirDatabaseDataSet.TicketsDataTable rows = tableAdapter.GetDataByMilestoneID(milestoneID); // Create list. List <Ticket> tickets = new List <Ticket>(); foreach (var row in rows) { // Add. Ticket ticket = new Ticket(row); tickets.Add(ticket); } return(tickets.ToArray()); }
protected void Page_Load(object sender, EventArgs e) { string Id = Request.QueryString["Id"]; Session.Add("TicketId", Id); TicketsTableAdapter Adapter = new TicketsTableAdapter(); Tracker.TicketsDataTable tickets = Adapter.GetTicketForShow(new Guid(Id)); if (tickets.Count == 0) return; Tracker.TicketsRow ticket = tickets[0]; string[] col1 = { "Number", "Priority", "Status", "Product;Project", "Department;Dept", "Group", "Team" }; string[] col2 = { "Created By;Creator","QA Due Date;QADueDate", "QA Completed Date;QACompletedDate", "User Test Due Date;UserTestDueDate", "User Test Complete Date;UserTestCompleteDate", "Planned Implementation Date;PlannedImplementationDate", "Implementation Date;ImplementationDate" }; string[] col3 = { "Received On;ReceivedOn", "Actual Hours;Project", "Actual Cost;ActualCost", "Canceled On;CanceledOn", "Canceled By;Canceler" }; string[] col4 = { "Summary", "Description", "CancelComment" }; string[][] cols = { col1, col2, col3 }; // create controls from above array.. foreach (string[] col in cols) { TableCell tc = new TableCell(); TableRow1.Cells.Add(tc); foreach (string cell in col) { string[] cells = cell.Split(';'); object value = ticket[cells.Length == 1 ? cells[0] : cells[1]]; if (value.GetType() == typeof(DateTime)) value = ((DateTime)value).ToShortDateString(); tc.Text += "<div class='showfield'><div>" + cells[0] + ": </div><label>" + value + "</label></div>"; } } foreach (string cell in col4) { if (!DBNull.Value.Equals(ticket[cell])) ((TextBox)View1.FindControl(cell)).Text = (string)ticket[cell]; } }
protected override void AddPrivate(Database db) { createTimestamp = modifyTimestamp = DateTime.UtcNow; TicketsTableAdapter tableAdapter = db.TicketsTableAdapter; tableAdapter.Insert( milestoneID, ticketNumber, summary, reportedBy, (int)type, (int)severity, (int)state, assignedTo, (int)priority, description, createTimestamp, modifyTimestamp); // Find ID. ID = tableAdapter.Connection.GetInsertedIdentity(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { // create controls from above array... foreach (StructControl ctrl in m_controls) { ObjectDataSource ods = new ObjectDataSource(ctrl.DataSource, ctrl.SelectMethod); ods.DataObjectTypeName = "System.Guid"; DropDownList dd = new DropDownList(); dd.DataTextField = ctrl.TextField; dd.DataValueField = ctrl.ValueField; dd.ID = ctrl.Title.Replace(' ', '_'); dd.DataSource = ods; dd.DataBind(); dd.SelectedIndexChanged += new EventHandler(dd_SelectedIndexChanged); dd.PreRender += new EventHandler(dd_PreRender); dd.AutoPostBack = true; Panel1.Controls.Add(new LiteralControl(string.Format("<div class='field'><label class='{0}'>{1}</label><br/>", ctrl.Required, ctrl.Title))); Panel1.Controls.Add(dd); Panel1.Controls.Add(new LiteralControl("</div>")); } if (!IsPostBack) { SetText("Created_By", User.Identity.Name, false); string Id = Request.QueryString["Id"]; if (Id == null) { SetText("Status", "Pending", false); SetText("Group", "S&P", true); DropDownList ddd = Panel1.FindControl("Product") as DropDownList; ddd.Items.Insert(0, ""); SetText("Product", "", true); } else { TicketsTableAdapter ta = new TicketsTableAdapter(); Tracker.TicketsDataTable dt = ta.GetTicket(new Guid(Id)); SetValue("Dept", dt[0].DeptId); SetValue("Group", dt[0].GroupId); SetValue("Team", dt[0].TeamId); SetValue("Product", dt[0].ProjectId); SetValue("Status", dt[0].StatusId); SetValue("Priority", dt[0].PriorityId); SetValue("Created_By", dt[0].CreatedBy); SetValue("Requested_By", dt[0].RequestedBy); try { SetValue("Business_Unit_Rep", dt[0].BusinessUnitRep); } catch { } Summary.Text = dt[0].Summary; Description.Text = dt[0].Description; Actual_Hours.Text = dt[0].ActualHours.ToString(); Actual_Cost.Text = dt[0].ActualCost.ToString(); TicketId.Text = dt[0].Id.ToString(); Create.Text = "Assign"; CreateAndAssign.Text = "Update"; CreateAndAssign.OnClientClick = "Update_Click"; NeedsQA.Checked = dt[0].QARequired; try { ReceivedDate.Text = dt[0].ReceivedOn.ToShortDateString(); } catch { ReceivedDate.Text = ""; } try { DueToQADate.Text = dt[0].QAStartDate.ToShortDateString(); } catch {DueToQADate.Text = "";} try { QACompleteDate.Text = dt[0].QACompletedDate.ToShortDateString(); } catch { QACompleteDate.Text = ""; } try { ImplementationDate.Text = dt[0].PlannedImplementationDate.ToShortDateString(); } catch { ImplementationDate.Text = ""; } try { UserCompleteDate.Text = dt[0].UserTestCompleteDate.ToShortDateString(); } catch { UserCompleteDate.Text = ""; } try { UserTestDueDate.Text = dt[0].UserTestDueDate.ToShortDateString(); } catch { UserTestDueDate.Text = ""; } } QAPanel.Visible = (((DropDownList)Panel1.FindControl("Status")).SelectedItem.Text == "Pending") || (((DropDownList)Panel1.FindControl("Status")).SelectedItem.Text == "In Progress"); InProgressPanel.Visible = (((DropDownList)Panel1.FindControl("Status")).SelectedItem.Text == "In Progress"); } }
public static void Open(string databasePath) { if (databasePath == null) { throw new ArgumentNullException("databasePath"); } // Close. if (isOpen) { Close(); } PeygirDatabaseDataSet.ChangeDatabasePath(databasePath); projectsTableAdapter = new ProjectsTableAdapter(); milestonesTableAdapter = new MilestonesTableAdapter(); ticketReportersTableAdapter = new TicketReportersTableAdapter(); ticketAssigneesTableAdapter = new TicketAssigneesTableAdapter(); ticketsTableAdapter = new TicketsTableAdapter(); attachmentsWithoutContentsTableAdapter = new AttachmentsWithoutContentsTableAdapter(); attachmentsTableAdapter = new AttachmentsTableAdapter(); ticketsHistoryTableAdapter = new TicketsHistoryTableAdapter(); projectsTableAdapter.Connection.Open(); milestonesTableAdapter.Connection.Open(); ticketReportersTableAdapter.Connection.Open(); ticketAssigneesTableAdapter.Connection.Open(); ticketsTableAdapter.Connection.Open(); attachmentsWithoutContentsTableAdapter.Connection.Open(); attachmentsTableAdapter.Connection.Open(); ticketsHistoryTableAdapter.Connection.Open(); currentnDatabasePath = databasePath; isOpen = true; return; }
public static void Close() { if (!isOpen) { return; } projectsTableAdapter.Connection.Close(); milestonesTableAdapter.Connection.Close(); ticketReportersTableAdapter.Connection.Close(); ticketAssigneesTableAdapter.Connection.Close(); ticketsTableAdapter.Connection.Close(); attachmentsWithoutContentsTableAdapter.Connection.Close(); attachmentsTableAdapter.Connection.Close(); ticketsHistoryTableAdapter.Connection.Close(); projectsTableAdapter = null; milestonesTableAdapter = null; ticketReportersTableAdapter = null; ticketAssigneesTableAdapter = null; ticketsTableAdapter = null; attachmentsWithoutContentsTableAdapter = null; attachmentsTableAdapter = null; ticketsHistoryTableAdapter = null; currentnDatabasePath = null; isOpen = false; return; }
public Ticket[] GetTickets() { if (ID == InvalidID) { string message = Resources.String_CurrentObjectDoesNotExistInTheDatabase; throw new InvalidOperationException(message); } TicketsTableAdapter tableAdapter = new TicketsTableAdapter(); PeygirDatabaseDataSet.TicketsDataTable rows = tableAdapter.GetDataByProjectID(ID); // Create list. List<Ticket> tickets = new List<Ticket>(); foreach (var row in rows) { // Add. Ticket ticket = new Ticket(row); tickets.Add(ticket); } return tickets.ToArray(); }