public string bll_DeleteInvoice(int pIdInvoice)
        {
            var lInvoice = new BoInvoice {
                LIdInvoice = pIdInvoice
            };

            return(this.LiDaoInvoice.Dao_DeleteInvoice(lInvoice));
        }
Esempio n. 2
0
 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"));
 }
Esempio n. 3
0
 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"));
 }
Esempio n. 4
0
        public BoInvoice Dao_getInvoiceById(int pIdInvoice)
        {
            SqlConnection lConex = new SqlConnection();

            using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex))
            {
                var lInvoice = new BoInvoice();
                try
                {
                    var lCommand = new SqlCommand
                    {
                        CommandText    = "spr_GetInvoice",
                        CommandTimeout = 30,
                        CommandType    = CommandType.StoredProcedure,
                        Connection     = lConex
                    };
                    lCommand.Parameters.Add(new SqlParameter("IdInvoice", pIdInvoice));

                    var lReader = lCommand.ExecuteReader();
                    if (lReader.HasRows)
                    {
                        while (lReader.Read())
                        {
                            lInvoice.LStatus                     = new BoStatus();
                            lInvoice.LObject                     = new BoObject();
                            lInvoice.LCustomer                   = new BoCustomer();
                            lInvoice.LListInvoiceItem            = new List <BoInvoiceItem>();
                            lInvoice.LIdInvoice                  = Convert.ToInt32(lReader["IdInvoice"].ToString());
                            lInvoice.LCdInvoice                  = lReader["CdInvoice"].ToString();
                            lInvoice.LCreationDate               = Convert.ToDateTime(lReader["CreationDate"].ToString());
                            lInvoice.LCustomer.LIdCustomer       = Convert.ToInt32(lReader["IdCustomer"].ToString());
                            lInvoice.LCustomer.LNameCustomer     = lReader["NameCustomer"].ToString();
                            lInvoice.LCustomer.LLastNameCustomer = lReader["LastNameCustomer"].ToString();
                            lInvoice.LStatus.LIdStatus           = lReader["IdStatus"].ToString();
                            lInvoice.LObject.LIdObject           = Convert.ToInt32(lReader["IdObject"].ToString());
                        }
                    }
                    DaoUtilsLib.Dao_CloseSqlconnection(lConex);
                    return(lInvoice);
                }
                catch (Exception e)
                {
                    lInvoice = new BoInvoice {
                        LException = e.Message
                    };
                    if (e.InnerException != null)
                    {
                        lInvoice.LInnerException = e.InnerException.ToString();
                    }
                    lInvoice.LMessageDao = BoErrors.MsgErrorGetSql;
                    DaoUtilsLib.Dao_CloseSqlconnection(lConex);
                    return(lInvoice);
                }
            }
        }
        public static MInvoice TrasferToMInvoice(this BoInvoice lBoInvoice)
        {
            var oMInvoice = new MInvoice
            {
                LIdInvoice    = lBoInvoice.LIdInvoice,
                LCdInvoice    = lBoInvoice.LCdInvoice,
                LCreationDate = lBoInvoice.LCreationDate,
                LCustomer     = new MCustomer
                {
                    LIdCustomer       = lBoInvoice.LCustomer.LIdCustomer,
                    LNameCustomer     = lBoInvoice.LCustomer.LNameCustomer,
                    LLastNameCustomer = lBoInvoice.LCustomer.LLastNameCustomer
                },
                LListMInvoiceItem = lBoInvoice.LListInvoiceItem.MListInvoiceItem()
            };

            return(oMInvoice);
        }
        public string bll_UpdateInvoice(string pCdInvoice, int pIdCustomer, int pIdObject, string pIdStatus)
        {
            var lInvoice = new BoInvoice
            {
                LObject = new BoObject {
                    LIdObject = pIdObject
                },
                LStatus = new BoStatus {
                    LIdStatus = pIdStatus
                },
                LCustomer = new BoCustomer {
                    LIdCustomer = pIdCustomer
                },
                LCdInvoice = pCdInvoice
            };

            return(this.LiDaoInvoice.Dao_UpdateInvoice(lInvoice));
        }
Esempio n. 7
0
 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"));
 }