public string Get(int id) { // 1 - database stuff if (id == 1) { QuotationDal quotation = new QuotationDal(); quotation.Read(1); Output output = new Output(); Input input = new Input() { HargaKainA = 15, Tinggi = 120, Lebar = 55, Set = 3 }; output.Input = input; int i = quotation.Insert(output); List <string> image = new List <string>() { "https://i.postimg.cc/G27TFN7F/F1-1.jpg", "https://i.postimg.cc/zBc3bhvp/F1-2.jpg", "https://i.postimg.cc/P53D0HL8/F3-1.jpg" }; quotation.Update(i, image); } return(":)"); }
public int StoreCalculation(Output output) { QuotationDal dal = new QuotationDal(); int id = dal.Insert(output); return(id); }
public List <Truck> GetTruck(string Token) { var list = new List <Truck>(); this.IsCorrect = false; this.Message = "Camiones obtenidos exitosamente"; try { var token = this.GetToken(Token); this.Message = token.Message; this.IsCorrect = token.IsCorrect; if (this.IsCorrect) { list = new QuotationDal().GetTruck(); this.IsCorrect = true; } } catch (Exception ex) { this.Message = ex.Message; } return(list); }
public void SendQ(string Token, UserData Data) { var cot = new QuotationDal(); this.IsCorrect = false; this.Message = string.Empty; try { var token = this.GetToken(Token); this.Message = token.Message; this.IsCorrect = token.IsCorrect; if (this.IsCorrect) { var idQ = cot.GetLastQ(token); var head = cot.GetHeaderQ(idQ); head.Email = Data.Email; head.Name = Data.Name; head.Phone = Data.Phone; head.CellPhone = Data.CellPhone; var body = cot.GetBodyQ(idQ); var mails = cot.GetPlantMail(head.IdPlant); var excelFile = this.GetExcel(idQ, head, body); this.SendMailQ(head, mails, excelFile); cot.UpdateLastQ(idQ, Data); this.Message = "Su cotización fue enviada a su correo electrónico"; this.IsCorrect = true; } } catch (Exception ex) { this.IsCorrect = false; this.Message = ex.Message; } }
public int SaveQ(string Token, int IdTruck, int IdDayOfWeek, List <RequestProducts> Products) { this.IsCorrect = false; this.Message = "Cotización guardada exitosamente"; try { var token = this.GetToken(Token); this.Message = token.Message; this.IsCorrect = token.IsCorrect; if (this.IsCorrect) { var quotation = new QuotationDal(); int idQ = quotation.SaveQ(token, IdTruck, IdDayOfWeek); foreach (var product in Products) { quotation.SaveDetailQ(token, idQ, product); } this.IsCorrect = true; return(idQ); } else { return(0); } } catch (Exception ex) { this.Message = ex.Message; return(0); } }
public List <Product> GetProducts(string Token) { var products = new List <Product>(); var dal = new QuotationDal(); this.IsCorrect = false; this.Message = "Productos obtenidos exitosamente"; try { var token = this.GetToken(Token); this.Message = token.Message; this.IsCorrect = token.IsCorrect; if (this.IsCorrect) { products = dal.GetProducts(token); foreach (var product in products) { if (product.HasPromotion) { product.Products = dal.GetProductsPromotion(product.Id); } } this.IsCorrect = true; } } catch (Exception ex) { this.Message = ex.Message; } return(products); }
public void Put(int id, [FromBody] QuotationImage quotationImage) { QuotationDal quotation = new QuotationDal(); quotation.Update(id, quotationImage.Image); }