public TicketsTask GetTicketsDataForID(TicketsTask TicketsObject, string Mode) { DataTable TicketsTable = new DataTable(); TicketsTask ReturnTicketsObject = new TicketsTask(); try { string SqlQuery = "Select tk.* from Tickets tk where tk.ID =" + TicketsObject.ID.ToString(); TicketsTable = objAdaptor.FetchData(SqlQuery); if (TicketsTable != null && TicketsTable.Rows.Count == 1) { ReturnTicketsObject.ID = int.Parse(TicketsTable.Rows[0]["ID"].ToString()); ReturnTicketsObject.CustID = int.Parse(TicketsTable.Rows[0]["CustID"].ToString()); ReturnTicketsObject.TicketNumber = TicketsTable.Rows[0]["TicketNumber"].ToString(); ReturnTicketsObject.Date = TicketsTable.Rows[0]["Date"].ToString(); ReturnTicketsObject.Status = TicketsTable.Rows[0]["Status"].ToString(); ReturnTicketsObject.Details = TicketsTable.Rows[0]["Details"].ToString(); } } catch { } finally { } return(ReturnTicketsObject); }
private void UpdateTickets() { try { bool update = false; TicketsTask TicketsObject = new TicketsTask(); TicketsObject.ID = Convert.ToInt32(Request.QueryString["TicketID"].ToString()); TicketsObject.Date = TDateEdit.Text; //TicketsObject.Date = TDateTextbox.Text; TicketsObject.Details = TicketDetailsTextbox.Text; TicketsObject.Status = TicketStatusTextbox.Text; TicketsObject.TicketNumber = TicketNumberTextbox.Text; update = CustomerServiceBL.CustomerDetails.Ins.UpdateTicketsData(TicketsObject, "Update", ""); if (update) { successDiv.Style.Value = "display: block"; errorDiv1.Style.Value = "display: none"; successDiv.InnerText = "Tickets has been successfully updated"; } else { successDiv.Style.Value = "display: none"; errorDiv1.Style.Value = "display: block"; errorDiv1.InnerText = "Tickets has NOT been updated"; } } catch (Exception ex) { throw ex; } finally { } }
public bool UpdateTicketsData(TicketsTask TicketsObject, string Mode, string CustID) { bool Update; try { string SqlQuery; if (Mode == "Update") { SqlQuery = "Update Tickets Set Date='" + TicketsObject.Date + "', TicketNumber='" + TicketsObject.TicketNumber + "', Status='" + TicketsObject.Status + "', Details='" + TicketsObject.Details + "' Where ID = " + TicketsObject.ID; } else { SqlQuery = "Insert into Tickets Values(" + CustID + ",'" + TicketsObject.Date + "','" + TicketsObject.TicketNumber + "','" + TicketsObject.Details + "','" + TicketsObject.Status + "')"; } Update = objAdaptor.ExecuteNonQuery(SqlQuery); } catch { Update = false; } finally { } return(Update); }
private void InsertTickets() { try { bool update = false; TicketsTask TicketsObject = new TicketsTask(); TicketsObject.Date = TDateEdit.EditFormatString; //TicketsObject.Date = TDateTextbox.Text; TicketsObject.Details = TicketDetailsTextbox.Text; TicketsObject.Status = TicketStatusTextbox.Text; TicketsObject.TicketNumber = TicketNumberTextbox.Text; update = CustomerServiceBL.CustomerDetails.Ins.UpdateTicketsData(TicketsObject, "Insert", CustomerComboBox.SelectedItem.Value.ToString()); if (update) { successDiv.Style.Value = "display: block"; errorDiv1.Style.Value = "display: none"; successDiv.InnerText = "New Tickets has been successfully created"; } else { successDiv.Style.Value = "display: none"; errorDiv1.Style.Value = "display: block"; errorDiv1.InnerText = "Tickets has NOT been created"; } } catch (Exception ex) { throw ex; } finally { } }
public void Process_MoskowAlgorithm() { // Arrange var ticketsTask = new TicketsTask { Algorithm = "Moskow" }; var expectedMessage = "You have 55252 lucky tickets"; var mockLuckyTicketResolverFactory = new Mock <ILuckyTicketResolverFactory>(); mockLuckyTicketResolverFactory .Setup(f => f.Create(ticketsTask.Algorithm)) .Returns(new MoskowLuckyTicketResolver()); var actualMessage = string.Empty; mockLogger.Setup(l => l.LogInformation(It.IsAny <string>())) .Callback <string>(message => actualMessage = message); var luckyTicketProcessor = new LuckyTicketProcessor(mockLogger.Object, mockLuckyTicketResolverFactory.Object); // Act luckyTicketProcessor.Process(ticketsTask); // Assert Assert.Equal(expectedMessage, actualMessage); }
public DataTable GetAllTicketsData() { DataTable NotesDataTable = new DataTable(); TicketsTask ReturnObject = new TicketsTask(); try { string SqlQuery = "Select * from Customer, Tickets"; NotesDataTable = objAdaptor.FetchData(SqlQuery); } catch (Exception ex) { } finally { } return(NotesDataTable); }
public void Process(TicketsTask inputData) { string algorithm = inputData.Algorithm; ITicketsProvider ticketsProvider = new TicketsGenerator( startIndex: 0, endIndex: 999999 ); IEnumerable <Ticket> tickets = ticketsProvider.GetTickets(); ILuckyTicketResolver luckyTicketResolver = luckyTicketResolverFactory.Create(algorithm); var counter = new LuckyTicketsCounter(luckyTicketResolver); var luckyTicketsNumber = counter.Count(tickets); logger.LogInformation($"You have {luckyTicketsNumber} lucky tickets"); }
public void GetTicketsTask_Positive() { // Arrange var args = new string[] { "File.txt" }; var expectedTicketsTask = new TicketsTask { Algorithm = "Piter" }; // Act var actualTicketsTask = InputDataParser.GetTicketsTask(args); // Assert Assert.Equal(expectedTicketsTask.Algorithm, actualTicketsTask.Algorithm); }
private void FillTicketDetails(int ID) { try { TicketsTask TicketsObject = new TicketsTask(); TicketsTask ReturnTickets = new TicketsTask(); TicketsObject.ID = ID; ReturnTickets = CustomerServiceBL.CustomerDetails.Ins.GetTicketsDataForID(TicketsObject, ""); if (ReturnTickets != null) { TDateEdit.Date = DateTime.Parse(ReturnTickets.Date.ToString()); //TDateTextbox.Text = ReturnTickets.Date.ToString(); TicketStatusTextbox.Text = ReturnTickets.Status.ToString(); TicketNumberTextbox.Text = ReturnTickets.TicketNumber.ToString(); TicketDetailsTextbox.Text = ReturnTickets.Details.ToString(); } } catch (Exception ex) { throw ex; } finally { } }
public bool UpdateTicketsData(TicketsTask TicketsObject, string Mode, string CustId) { return(CustomerTrackingDL.CustomerDetails.Ins.UpdateTicketsData(TicketsObject, Mode, CustId)); }
public TicketsTask GetTicketsDataForID(TicketsTask TicketsObject, string Mode) { return(CustomerTrackingDL.CustomerDetails.Ins.GetTicketsDataForID(TicketsObject, Mode)); }