public string Dao_getCdInvoice() { SqlConnection lConex = new SqlConnection(); using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex)) { try { var lCommand = new SqlCommand { CommandText = "spr_GetCdInvoice", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; var lReader = lCommand.ExecuteReader(); var lResult = ""; if (lReader.HasRows) { while (lReader.Read()) { lResult = lReader["CdInvoice"].ToString(); } } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(lResult); } catch (Exception e) { return(e.Message); } } }
public BoOrder Dao_getOrder(int pIdOrder) { SqlConnection lConex = new SqlConnection(); using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex)) { try { var lCommand = new SqlCommand { CommandText = "spr_GetOrder", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; lCommand.Parameters.Add(new SqlParameter("IdOrder", pIdOrder)); var lReader = lCommand.ExecuteReader(); var lOrder = new BoOrder(); if (lReader.HasRows) { while (lReader.Read()) { lOrder.LStatus = new BoStatus(); lOrder.LObject = new BoObject(); lOrder.LCustomer = new BoCustomer { LIdCustomer = Convert.ToInt32(lReader["IdCustomer"].ToString()), LNameCustomer = lReader["NameCustomer"].ToString(), LLastNameCustomer = lReader["LastNameCustomer"].ToString() }; lOrder.LIdOrder = Convert.ToInt32(lReader["IdOrder"].ToString()); lOrder.LInventory = new BoInventory { LIdInventory = Convert.ToInt32(lReader["IdInventory"].ToString()), LNameInventory = lReader["NameInventory"].ToString() }; lOrder.LCreationDate = Convert.ToDateTime(lReader["CreationDate"].ToString()); lOrder.LStatus.LIdStatus = lReader["IdStatus"].ToString(); lOrder.LObject.LIdObject = Convert.ToInt32(lReader["IdObject"].ToString()); } } Dao_CloseSqlconnection(lConex); return(lOrder); } catch (Exception e) { var lOrder = new BoOrder { LException = e.Message }; if (e.InnerException != null) { lOrder.LInnerException = e.InnerException.ToString(); } lOrder.LMessageDao = BoErrors.MsgErrorGetSql; Dao_CloseSqlconnection(lConex); return(lOrder); } } }
public string Dao_InsertPayment(BoPayment pPayment) { this.LListParam = new List <SqlParameter>(); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdOrder", pPayment.LOrder.LIdOrder.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Decimal, "@ValuePayment", pPayment.LValuePayment.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@IdStatus", pPayment.LStatus.LIdStatus); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdObject", pPayment.LObject.LIdObject.ToString()); return(DaoUtilsLib.Dao_executeSqlTransactionWithProcedement(this.LListParam, "LTranInsertPayment", "spr_CreatePayment")); }
public string Dao_UpdateInvoice(BoInvoice pInvoice) { this.LListParam = new List <SqlParameter>(); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdInvoice", pInvoice.LCustomer.LIdCustomer.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@CdInvoice", pInvoice.LCdInvoice); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdCustomer", pInvoice.LCustomer.LIdCustomer.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@IdStatus", pInvoice.LStatus.LIdStatus); return(DaoUtilsLib.Dao_executeSqlTransactionWithProcedement(this.LListParam, "LTranUpdateInvoice", "spr_UpdateInvoice")); }
public string Dao_InsertInvoice(BoInvoice pInvoice) { this.LListParam = new List <SqlParameter>(); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@CdInvoice", pInvoice.LCdInvoice); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdCustomer", pInvoice.LCustomer.LIdCustomer.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdOrder", pInvoice.LOrder.LIdOrder.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@IdStatus", pInvoice.LStatus.LIdStatus); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdObject", pInvoice.LObject.LIdObject.ToString()); return(DaoUtilsLib.Dao_executeSqlScalarWithProcedement(this.LListParam, "LTranInsertInvoice", "spr_CreateInvoice")); }
public BoCustomer Dao_getCustomerByDocument(string pNoIdentification, int pIdTypeIdentification) { SqlConnection lConex = new SqlConnection(); using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex)) { try { var lCommand = new SqlCommand { CommandText = "spr_GetCustomerByIdentification", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; lCommand.Parameters.Add(new SqlParameter("@NoIdentification", pNoIdentification)); lCommand.Parameters.Add(new SqlParameter("@IdTypeIdentification", pIdTypeIdentification)); var lReader = lCommand.ExecuteReader(); var oCustomer = new BoCustomer(); if (lReader.HasRows) { while (lReader.Read()) { oCustomer.LStatus = new BoStatus(); oCustomer.LObject = new BoObject(); oCustomer.LTypeIdentification = new BoTypeIdentification(); oCustomer.LIdCustomer = Convert.ToInt32(lReader["IdCustomer"].ToString()); oCustomer.LTypeIdentification.LIdTypeIdentification = Convert.ToInt32(lReader["IdTypeIdentification"].ToString()); oCustomer.LNoIdentification = lReader["NoIdentification"].ToString(); oCustomer.LNameCustomer = lReader["NameCustomer"].ToString(); oCustomer.LLastNameCustomer = lReader["LastNameCustomer"].ToString(); oCustomer.LCreationDate = Convert.ToDateTime(lReader["CreationDate"].ToString()); oCustomer.LModificationDate = Convert.ToDateTime(lReader["ModificationDate"].ToString()); oCustomer.LStatus.LIdStatus = lReader["IdStatus"].ToString(); oCustomer.LObject.LIdObject = Convert.ToInt32(lReader["IdObject"].ToString()); } } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(oCustomer); } catch (Exception e) { var oCustomer = new BoCustomer { LException = e.Message }; if (e.InnerException != null) { oCustomer.LInnerException = e.InnerException.ToString(); } oCustomer.LMessageDao = BoErrors.MsgErrorGetSql; DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(oCustomer); } } }
public string Dao_UpdateCustomer(BoCustomer pCustomer) { this.LListParams = new List <SqlParameter>(); DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.Int, "@IdCustomer", pCustomer.LIdCustomer.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.VarChar, "@NameCustomer", pCustomer.LNameCustomer); DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.VarChar, "@LastNameCustomer", pCustomer.LLastNameCustomer); DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.Int, "@IdTypeIdentification", pCustomer.LTypeIdentification.LIdTypeIdentification.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.VarChar, "@NoIdentification", pCustomer.LNoIdentification); DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.VarChar, "@IdStatus", pCustomer.LStatus.LIdStatus); return(DaoUtilsLib.Dao_executeSqlTransactionWithProcedement(this.LListParams, "LTranUpdateCustomer", "spr_UpdateCustomer")); }
public List <BoCashRegister> Dao_getListLastCashRegister() { SqlConnection lConex = new SqlConnection(); using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex)) { var lListCashRegister = new List <BoCashRegister>(); try { var lCommand = new SqlCommand { CommandText = "spr_GetAllItemsCashRegister", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; var lReader = lCommand.ExecuteReader(); if (lReader.HasRows) { while (lReader.Read()) { var lCashRegister = new BoCashRegister { LCreationDate = Convert.ToDateTime(lReader["CreationDate"].ToString()), LModificationDate = Convert.ToDateTime(lReader["ModificationDate"].ToString()), LValue = Convert.ToDecimal(lReader["Value"].ToString()), LDescription = lReader["Description"].ToString(), LIdCash = Convert.ToInt32(lReader["IdCash"].ToString()), LIdCashRegister = Convert.ToInt32(lReader["IdCashRegister"].ToString()), LIsInput = Convert.ToBoolean(lReader["IsInput"].ToString()) }; lListCashRegister.Add(lCashRegister); } } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(lListCashRegister); } catch (Exception e) { lListCashRegister = new List <BoCashRegister>(); var lCash = new BoCashRegister { LException = e.Message, LMessageDao = BoErrors.MsgErrorGetSql }; if (e.InnerException != null) { lCash.LInnerException = e.InnerException.ToString(); } DaoUtilsLib.Dao_CloseSqlconnection(lConex); lListCashRegister.Add(lCash); return(lListCashRegister); } } }
public string Dao_InsertProduct(BoProduct pProduct) { this.LListParam = new List <SqlParameter>(); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@NameProduct", pProduct.LNameProduct); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@CdProduct", pProduct.LCdProduct); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdUnit", pProduct.LUnit.LIdUnit.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Decimal, "@Price", pProduct.LValue.ToString(CultureInfo.CurrentCulture)); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdSupplier", pProduct.LSupplier.LIdSupplier.ToString()); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Decimal, "@PriceSupplier", pProduct.LValueSupplier.ToString(CultureInfo.CurrentCulture)); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@IdStatus", pProduct.LStatus.LIdStatus); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdObject", pProduct.LObject.LIdObject.ToString()); return(DaoUtilsLib.Dao_executeSqlTransactionWithProcedement(this.LListParam, "LTranInsertProduct", "spr_CreateProduct")); }
public List <BoDashBoard> Dao_getProductSellToday() { SqlConnection lConex = new SqlConnection(); using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex)) { try { var lCommand = new SqlCommand { CommandText = "spr_dsbProductSellToday", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; var lReader = lCommand.ExecuteReader(); var lListDashBoard = new List <BoDashBoard>(); if (lReader.HasRows) { while (lReader.Read()) { var lDashBoard = new BoDashBoard { Xstring = lReader["x"].ToString(), Yint = Convert.ToInt32(lReader["y"].ToString()) }; lListDashBoard.Add(lDashBoard); } } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(lListDashBoard); } catch (Exception e) { var lListDashBoard = new List <BoDashBoard>(); var lDashBoard = new BoDashBoard { LException = e.Message }; if (e.InnerException != null) { lDashBoard.LInnerException = e.InnerException.ToString(); } lDashBoard.LMessageDao = BoErrors.MsgErrorGetSql; lListDashBoard.Add(lDashBoard); DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(lListDashBoard); } } }
public BoCashRegister Dao_getCashOutPut(int pIdCash) { SqlConnection lConex = new SqlConnection(); using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex)) { var lCashOutPut = new BoCashRegister(); try { var lCommand = new SqlCommand { CommandText = "spr_GetCashOutPut", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; lCommand.Parameters.Add(new SqlParameter("IdCash", pIdCash)); var lReader = lCommand.ExecuteReader(); if (lReader.HasRows) { while (lReader.Read()) { lCashOutPut.LCreationDate = Convert.ToDateTime(lReader["CreationDate"].ToString()); lCashOutPut.LModificationDate = Convert.ToDateTime(lReader["ModificationDate"].ToString()); lCashOutPut.LValue = Convert.ToDecimal(lReader["ValueOutPut"].ToString()); lCashOutPut.LDescription = lReader["Descriptions"].ToString(); lCashOutPut.LIdCash = Convert.ToInt32(lReader["IdCashOutPut"].ToString()); lCashOutPut.LIsInput = true; } } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(lCashOutPut); } catch (Exception e) { lCashOutPut = new BoCashRegister { LException = e.Message, LMessageDao = BoErrors.MsgErrorGetSql }; if (e.InnerException != null) { lCashOutPut.LInnerException = e.InnerException.ToString(); } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(lCashOutPut); } } }
public string Dao_DeletePayment(BoPayment pPayment) { this.LListParam = new List <SqlParameter>(); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdPayment", pPayment.LIdPayment.ToString()); return(DaoUtilsLib.Dao_executeSqlTransactionWithProcedement(this.LListParam, "LTranDeletePayment", "spr_DeletePayment")); }
public string Dao_DeleteInvoice(BoInvoice pInvoice) { this.LListParam = new List <SqlParameter>(); DaoUtilsLib.dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdInvoice", pInvoice.LIdInvoice.ToString()); return(DaoUtilsLib.Dao_executeSqlTransactionWithProcedement(this.LListParam, "LTranDeleteInvoice", "spr_DeleteInvoice")); }
public List <BoInvoice> Dao_getInvoiceListAll(int pIdCustomer) { SqlConnection lConex = new SqlConnection(); using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex)) { var lListInvoice = new List <BoInvoice>(); try { var lCommand = new SqlCommand { CommandText = "spr_GetListInvoiceAll", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; lCommand.Parameters.Add(new SqlParameter("IdCustomer", pIdCustomer)); var lReader = lCommand.ExecuteReader(); if (lReader.HasRows) { while (lReader.Read()) { var oInvoice = new BoInvoice { LStatus = new BoStatus { LIdStatus = lReader["IdStatus"].ToString() }, LObject = new BoObject { LIdObject = Convert.ToInt32(lReader["IdObject"].ToString()) }, LCustomer = new BoCustomer { LIdCustomer = Convert.ToInt32(lReader["IdCustomer"].ToString()), LNameCustomer = lReader["NameCustomer"].ToString(), LLastNameCustomer = lReader["LastNameCustomer"].ToString() }, LIdInvoice = Convert.ToInt32(lReader["IdInvoice"].ToString()), LCdInvoice = lReader["CdInvoice"].ToString(), LCreationDate = Convert.ToDateTime(lReader["CreationDate"].ToString()) }; lListInvoice.Add(oInvoice); } } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(lListInvoice); } catch (Exception e) { lListInvoice = new List <BoInvoice>(); var lInvoice = new BoInvoice { LException = e.Message }; if (e.InnerException != null) { lInvoice.LInnerException = e.InnerException.ToString(); } lInvoice.LMessageDao = BoErrors.MsgErrorGetSql; DaoUtilsLib.Dao_CloseSqlconnection(lConex); lListInvoice.Add(lInvoice); return(lListInvoice); } } }
public BoProduct Dao_getProductByCode(string pCdProduct) { SqlConnection lConex = new SqlConnection(); using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex)) { var lProduct = new BoProduct(); try { var lCommand = new SqlCommand { CommandText = "spr_GetProductByCode", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; lCommand.Parameters.Add(new SqlParameter("CdProduct", pCdProduct)); var lReader = lCommand.ExecuteReader(); if (lReader.HasRows) { while (lReader.Read()) { lProduct.LIdProduct = Convert.ToInt32(lReader["IdProduct"].ToString()); lProduct.LNameProduct = lReader["NameProduct"].ToString(); lProduct.LCdProduct = lReader["CdProduct"].ToString(); lProduct.LCreationDate = Convert.ToDateTime(lReader["CreationDate"].ToString()); lProduct.LUnit = new BoUnit { LIdUnit = Convert.ToInt32(lReader["IdUnit"].ToString()) }; lProduct.LValue = Convert.ToDecimal(lReader["Price"].ToString()); lProduct.LSupplier = new BoSupplier { LIdSupplier = Convert.ToInt32(lReader["IdSupplier"].ToString()) }; lProduct.LValueSupplier = Convert.ToDecimal(lReader["PriceSupplier"].ToString()); lProduct.LStatus = new BoStatus { LIdStatus = lReader["IdStatus"].ToString(), LDsEstado = lReader["DsEstado"].ToString() }; lProduct.LObject = new BoObject { LIdObject = Convert.ToInt32(lReader["IdObject"].ToString()), LNameObject = lReader["NameObject"].ToString() }; } } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(lProduct); } catch (Exception e) { lProduct = new BoProduct { LException = e.Message, LMessageDao = BoErrors.MsgErrorGetSql }; if (e.InnerException != null) { lProduct.LInnerException = e.InnerException.ToString(); } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(lProduct); } } }
public List <BoCustomer> Dao_getListAllCustomer() { SqlConnection lConex = new SqlConnection(); using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex)) { try { var lCommand = new SqlCommand { CommandText = "spr_GetListAllCustomer", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; var lReader = lCommand.ExecuteReader(); var oListCustomer = new List <BoCustomer>(); if (lReader.HasRows) { while (lReader.Read()) { var oCustomer = new BoCustomer { LStatus = new BoStatus { LIdStatus = lReader["IdStatus"].ToString(), LDsEstado = lReader["DsEstado"].ToString() }, LObject = new BoObject { LIdObject = Convert.ToInt32(lReader["IdObject"].ToString()), LNameObject = lReader["NameObject"].ToString() }, LTypeIdentification = new BoTypeIdentification { LIdTypeIdentification = Convert.ToInt32(lReader["IdTypeIdentification"].ToString()), LTypeIdentification = lReader["TypeIdentification"].ToString() }, LIdCustomer = Convert.ToInt32(lReader["IdCustomer"].ToString()), LNoIdentification = lReader["NoIdentification"].ToString(), LNameCustomer = lReader["NameCustomer"].ToString(), LLastNameCustomer = lReader["LastNameCustomer"].ToString(), LCreationDate = Convert.ToDateTime(lReader["CreationDate"].ToString() == "" ? new DateTime().ToString(CultureInfo.InvariantCulture) : lReader["CreationDate"].ToString()), LModificationDate = Convert.ToDateTime(lReader["ModificationDate"].ToString() == "" ? new DateTime().ToString(CultureInfo.InvariantCulture) : lReader["ModificationDate"].ToString()) }; oListCustomer.Add(oCustomer); } } DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(oListCustomer); } catch (Exception e) { var oListCustomer = new List <BoCustomer>(); var oCustomer = new BoCustomer { LException = e.Message }; if (e.InnerException != null) { oCustomer.LInnerException = e.InnerException.ToString(); } oCustomer.LMessageDao = BoErrors.MsgErrorGetSql; oListCustomer.Add(oCustomer); DaoUtilsLib.Dao_CloseSqlconnection(lConex); return(oListCustomer); } } }
public string Dao_DeleteCustomer(BoCustomer pCustomer) { this.LListParams = new List <SqlParameter>(); DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.Int, "@IdCustomer", pCustomer.LIdCustomer.ToString()); return(DaoUtilsLib.Dao_executeSqlTransactionWithProcedement(this.LListParams, "LTranDeleteCustomer", "spr_DeleteCustomer")); }