public bool UpdateSchedule(BE_Schedule bE_Schedule) { string strError_Mensaje = string.Empty; bool boResultado = false; try { logger.Debug("In CreateSchedule(bE_Schedule) "); Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("_InvoiceId", (string.IsNullOrWhiteSpace(bE_Schedule.Invoice.invoiceId)) ? DBNull.Value : (object)bE_Schedule.Invoice.invoiceId); parameters.Add("_StartDate", bE_Schedule.StartDate); parameters.Add("_EndDate", bE_Schedule.EndDate); parameters.Add("_Delivery", bE_Schedule.Delivery); parameters.Add("_PaymentMethod", (bE_Schedule.PaymentMethod == 0) ? DBNull.Value : (object)bE_Schedule.PaymentMethod); var scheduleId = _database.ExecuteSPGetId("sp_UpdateSchedule", parameters); boResultado = (scheduleId != null); return(boResultado); } catch (Exception ex) { logger.Fatal(ex, "UpdateSchedule Exception: " + ex.Message); throw ex; } }
public BE_Json Update([FromBody] BE_Schedule bE_Schedule) { BE_Json objJson = null; var objListaAux = string.Empty; try { BL_Schedule _blSchedule = new BL_Schedule(); _blSchedule.connectionString = AppConfig.DbConnection; objListaAux = JsonConvert.SerializeObject(_blSchedule.UpdateSchedule(bE_Schedule)); objJson = new BE_Json(); objJson.data = objListaAux; objJson.status = CManager.RESULTADO_WCF.OK; } catch (Exception ex) { objJson = new BE_Json(); objJson.data = "Hubo en error en servidor:" + ex.Message + ";" + ex.StackTrace + ";" + ex.ToString(); objJson.status = CManager.RESULTADO_WCF.ERROR; objJson.status = CManager.RESULTADO_WCF.ERROR; } finally { objListaAux = null; } return(objJson); }
public bool CreateSchedule(BE_Schedule bE_Schedule) { _database = new MySQLDatabase(connectionString); bool bOk = true; BL_Invoice blInvoice = new BL_Invoice(); blInvoice.connectionString = connectionString; //blInvoice._database = _database; VE_Invoice invoice = blInvoice.CreateInvoiceGeneral(bE_Schedule.Invoice); bOk = (invoice != null); if (exist(bE_Schedule)) { bOk = bOk && new DA_Schedule(_database).UpdateSchedule(bE_Schedule); } else { bOk = bOk && new DA_Schedule(_database).CreateSchedule(bE_Schedule); } return(bOk); }
public List <BE_Schedule> GetScheduleGeneral(BE_Schedule bE_Schedule) { try { BE_Schedule _bE_Schedule = null; List <BE_Schedule> _lstSchedule = new List <BE_Schedule>(); Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("_InvoiceId", (string.IsNullOrWhiteSpace(bE_Schedule.Invoice.invoiceId)) ? DBNull.Value : (object)bE_Schedule.Invoice.invoiceId); // parameters.Add("_StartDate", bE_Schedule.StartDate); //parameters.Add("_EndDate", bE_Schedule.EndDate); //parameters.Add("_Delivery", bE_Schedule.Delivery); //parameters.Add("_PaymentMethod", (bE_Schedule.PaymentMethod == 0) ? DBNull.Value : (object)bE_Schedule.PaymentMethod); DA_Invoice InvoiceDA = new DA_Invoice(this._database); var rows = _database.QuerySP("sp_getScheduleGeneral", parameters); foreach (var row in rows) { BE_Schedule _temp = new BE_Schedule(); // _temp.Invoice = InvoiceDA.getInvoiceGeneral(new Pago.BE.n.Filters.BEInvoiceFilter() { invoiceId = bE_Schedule.Invoice.invoiceId })[0]; //InvoiceDA.getInvoiceGeneral(new Pago.BE.n.Filters.BEInvoiceFilter() { invoiceId = (bE_Schedule.Invoice.invoiceId) }); _temp.StartDate = (row["StartDate"] == null) ? null : _bE_Schedule.StartDate; _temp.StartDate = (row["StartDate"] == null) ? null : _bE_Schedule.StartDate; _temp.EndDate = (row["EndDate"] == null) ? null : _bE_Schedule.EndDate; _temp.Delivery = (row["Delivery"] == null) ? null : _bE_Schedule.Delivery; _temp.PaymentMethod = (row["PaymentMethod"] == null) ? 0 : int.Parse(row["PaymentMethod"].ToString()); _lstSchedule.Add(_temp); } return(_lstSchedule); } catch (Exception ex) { throw ex; } }
public bool exist(BE_Schedule bE_Schedule) { return(this.GetScheduleGeneral(bE_Schedule).Count == 1); }
public List <BE_Schedule> GetScheduleGeneral(BE_Schedule bE_Schedule) { _database = new MySQLDatabase(connectionString); return(new DA_Schedule(_database).GetScheduleGeneral(bE_Schedule)); }