public static CaseService CreateCaseService() { var expenseRepo = new ExpenseRepo(); var repo = new CaseRepo(expenseRepo); return(new CaseService(repo, expenseRepo)); }
public int CloseCase(CaseRepo c1) { string sqlString = "UPDATE [dbo].[Case] SET TotalPrice = @totalPrice, EndDate = @endDate WHERE ID = @id"; command.Parameters.Clear(); command.Parameters.Add(new SqlParameter("@totalPrice", c1.TotalPrice)); command.Parameters.Add(new SqlParameter("@endDate", c1.EndDate)); command.Parameters.Add(new SqlParameter("@id", c1.Id)); return(ExecuteSql(sqlString)); }
public int NewCase(CaseRepo c1) { string sqlString = "INSERT INTO [dbo].[Case] (CaseName, StartDate, NegotiatedPrice, Service_ID, " + "RespEmp_ID, Client_ID) VALUES " + "(@CaseName, @StartDate, @NegotiatedPrice, @Service_ID, @RespEmp_ID, @Client_ID)"; command.Parameters.Clear(); command.Parameters.Add(new SqlParameter("@CaseName", c1.Name)); command.Parameters.Add(new SqlParameter("@StartDate", c1.StartDate)); command.Parameters.Add(new SqlParameter("@NegotiatedPrice", c1.NegPrice)); command.Parameters.Add(new SqlParameter("@Service_ID", c1.Service)); command.Parameters.Add(new SqlParameter("@RespEmp_ID", c1.RespEmployee)); command.Parameters.Add(new SqlParameter("@Client_ID", c1.Client)); return(ExecuteSql(sqlString)); }
public int UpdateCase(CaseRepo c1) { string sqlString = "UPDATE [dbo].[Case] SET NegotiatedPrice = @negPrice, RespEmp_ID = " + "(SELECT ID FROM Employee WHERE FirstName = @fName AND LastName = @lName)" + "WHERE ID = @id"; command.Parameters.Clear(); string[] names = c1.RespEmployee.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); command.Parameters.Add(new SqlParameter("@negPrice", c1.NegPrice)); command.Parameters.Add(new SqlParameter("@fName", names[0])); command.Parameters.Add(new SqlParameter("@lName", names[1])); command.Parameters.Add(new SqlParameter("@id", c1.Id)); return(ExecuteSql(sqlString)); }
public CaseController() { _cr = new CaseRepo(); _pp = new PriceRepo(); _pr = new PersonRepo(); }