public static IPPurchaseModel Convert(ip_quotes iPQuotesDB, bool isPurchase) { if (iPQuotesDB == null) { } return(new IPPurchaseModel() { quote_id = iPQuotesDB.quote_id, client_id = iPQuotesDB.client_id, invoice_group_id = iPQuotesDB.invoice_group_id, notes = iPQuotesDB.notes, quote_date_created = iPQuotesDB.quote_date_created, quote_date_expires = iPQuotesDB.quote_date_expires, quote_date_modified = iPQuotesDB.quote_date_modified, quote_discount_amount = iPQuotesDB.quote_discount_amount, quote_discount_percent = iPQuotesDB.quote_discount_percent, quote_number = iPQuotesDB.quote_number, quote_password = iPQuotesDB.quote_password, quote_status_id = iPQuotesDB.quote_status_id, quote_url_key = iPQuotesDB.quote_url_key, taxType = iPQuotesDB.taxType.HasValue ? iPQuotesDB.taxType.Value : 0, user_id = iPQuotesDB.user_id }); }
public static ip_quotes Map(IPInvoicesModel iPQuotesModel, ip_quotes ipQuotesDB) { //throw new NotImplementedException(); if (iPQuotesModel == null) { //throw new ArgumentNullException(nameof(iPQuotesModel)); } if (ipQuotesDB == null) { //throw new ArgumentNullException(nameof(ipQuotesDB)); } ipQuotesDB.client_id = iPQuotesModel.client_id; ipQuotesDB.invoice_group_id = iPQuotesModel.invoice_group_id; ipQuotesDB.is_quote = iPQuotesModel.isquote; ipQuotesDB.notes = iPQuotesModel.notes; ipQuotesDB.quote_date_created = iPQuotesModel.quote_date_created; ipQuotesDB.quote_date_expires = iPQuotesModel.quote_date_expires; ipQuotesDB.quote_date_modified = iPQuotesModel.quote_date_modified; ipQuotesDB.quote_discount_amount = iPQuotesModel.quote_discount_amount; ipQuotesDB.quote_discount_percent = iPQuotesModel.quote_discount_percent; ipQuotesDB.quote_number = iPQuotesModel.quote_number; ipQuotesDB.quote_password = iPQuotesModel.quote_password; ipQuotesDB.quote_status_id = iPQuotesModel.quote_status_id; ipQuotesDB.quote_url_key = iPQuotesModel.quote_url_key; ipQuotesDB.user_id = iPQuotesModel.user_id; return(ipQuotesDB); }
public static IPQuotesModel Convert(ip_quotes iPQuotesDB) { if (iPQuotesDB == null) { //throw new ArgumentNullException(nameof(iPQuotesDB)); } var model = new IPQuotesModel(); model.quote_id = iPQuotesDB.quote_id; model.client_id = iPQuotesDB.client_id; model.invoice_group_id = iPQuotesDB.invoice_group_id; model.notes = iPQuotesDB.notes; model.quote_date_created = iPQuotesDB.quote_date_created; model.quote_date_expires = iPQuotesDB.quote_date_expires; model.quote_date_modified = iPQuotesDB.quote_date_modified; model.quote_discount_amount = iPQuotesDB.quote_discount_amount.HasValue ? iPQuotesDB.quote_discount_amount.Value : 0; model.quote_discount_percent = iPQuotesDB.quote_discount_percent.HasValue ? iPQuotesDB.quote_discount_percent.Value : 0; model.quote_number = iPQuotesDB.quote_number; model.quote_password = iPQuotesDB.quote_password; model.quote_status_id = iPQuotesDB.quote_status_id; model.quote_url_key = iPQuotesDB.quote_url_key; model.taxType = iPQuotesDB.taxType.HasValue ? iPQuotesDB.taxType.Value : 0; model.user_id = iPQuotesDB.user_id; model.client = Convert(iPQuotesDB.ip_clients); model.quote_amount = Convert(iPQuotesDB.ip_quote_amounts.FirstOrDefault()); IIPPayments paymentService = new IPPaymentsRepository(); model.payment = paymentService.FilterIPPaymentsByQuoteID(iPQuotesDB.quote_id); return(model); }
public int Add(IPInvoicesModel iPQuotesModel) { if (iPQuotesModel == null) { //throw new ArgumentNullException(nameof(iPQuotesModel)); } iPQuotesModel.quote_date_created = DateTime.Now; iPQuotesModel.quote_date_modified = DateTime.Now; iPQuotesModel.quote_date_expires = DateTime.Now.AddMonths(12); iPQuotesModel.quote_url_key = string.IsNullOrEmpty(iPQuotesModel.quote_url_key) ? string.Empty : iPQuotesModel.quote_url_key; iPQuotesModel.invoice_group_id = iPQuotesModel.invoice_group_id == 0 ? 1 : iPQuotesModel.invoice_group_id; iPQuotesModel.user_id = iPQuotesModel.user_id == 0 ? 1 : iPQuotesModel.user_id; ip_quotes ipQuotesDB = Mapper.Map(iPQuotesModel, new ip_quotes()); AMDSystemsEntities.ip_quotes.Add(ipQuotesDB); AMDSystemsEntities.SaveChanges(); return(ipQuotesDB.quote_id); }