//add PurchaseOrder with PODetail public static int AddRequest(Request R) { int a = -1; Console.WriteLine("Adding purchase order " + R.RequestCode); a = rDAO.AddRequest(R); return(a); }
//add Request with requestDetail public string AddRequest(string userName, string departmentCode, List <RequestDTO> stationaries) { string requestCode = "RQ" + DateTime.Now.ToString("yyMMddHHmmssfff"); Request request = new Request() { RequestCode = requestCode, DepartmentCode = departmentCode, DateCreated = DateTime.Now, Status = "pending", UserName = userName }; foreach (var stationary in stationaries) { request.RequestDetails.Add(new RequestDetail() { ItemCode = stationary.ItemCode, Quantity = stationary.Quantity, RemainingQuant = stationary.Quantity, Notes = "" }); } rDAO.AddRequest(request); return(requestCode); }