public BoInventoryItem Dao_getInventoryItemById(int pIdInventoryItem)
        {
            SqlConnection lConex = new SqlConnection();

            using (lConex = Dao_SqlConnection(lConex))
            {
                try
                {
                    var lCommand = new SqlCommand
                    {
                        CommandText    = "spr_GetInventoryItem",
                        CommandTimeout = 30,
                        CommandType    = CommandType.StoredProcedure,
                        Connection     = lConex
                    };
                    lCommand.Parameters.Add(new SqlParameter("IdInventoryItem", pIdInventoryItem));

                    var lReader        = lCommand.ExecuteReader();
                    var oInventoryItem = new BoInventoryItem();
                    if (lReader.HasRows)
                    {
                        while (lReader.Read())
                        {
                            oInventoryItem.LStatus                   = new BoStatus();
                            oInventoryItem.LObject                   = new BoObject();
                            oInventoryItem.LProduct                  = new BoProduct();
                            oInventoryItem.LInventory                = new BoInventory();
                            oInventoryItem.LIdInventoryItem          = Convert.ToInt32(lReader["IdInventoryItem"].ToString());
                            oInventoryItem.LInventory.LIdInventory   = Convert.ToInt32(lReader["IdInventory"].ToString());
                            oInventoryItem.LInventory.LNameInventory = lReader["NameInventory"].ToString();
                            oInventoryItem.LProduct.LIdProduct       = Convert.ToInt32(lReader["IdProduct"].ToString());
                            oInventoryItem.LProduct.LNameProduct     = lReader["NameProduct"].ToString();
                            oInventoryItem.LCreationDate             = Convert.ToDateTime(lReader["CreationDate"].ToString());
                            oInventoryItem.LStatus.LIdStatus         = lReader["IdStatus"].ToString();
                            oInventoryItem.LQtySellable              = Convert.ToDecimal(lReader["QtySellable"].ToString());
                            oInventoryItem.LQtyNonSellable           = Convert.ToDecimal(lReader["QtyNonSellable"].ToString());
                            oInventoryItem.LObject.LIdObject         = Convert.ToInt32(lReader["IdObject"].ToString());
                        }
                    }
                    Dao_CloseSqlconnection(lConex);
                    return(oInventoryItem);
                }
                catch (Exception e)
                {
                    var lInventoryItem = new BoInventoryItem
                    {
                        LException  = e.Message,
                        LMessageDao = BoErrors.MsgErrorGetSql
                    };
                    if (e.InnerException != null)
                    {
                        lInventoryItem.LInnerException = e.InnerException.ToString();
                    }

                    Dao_CloseSqlconnection(lConex);
                    return(lInventoryItem);
                }
            }
        }
Exemplo n.º 2
0
        public string bll_DeleteInventoryItem(int pIdInventoryItem)
        {
            var oInventoryItem = new BoInventoryItem {
                LIdInventoryItem = pIdInventoryItem
            };

            return(this.LiDaoInventoryItem.Dao_DeleteInventoryItem(oInventoryItem));
        }
 public string Dao_SubstractInventoryItem(BoInventoryItem pInventoryItem)
 {
     this.LListParam = new List <SqlParameter>();
     dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdInventory", pInventoryItem.LInventory.LIdInventory.ToString());
     dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@CdProduct", pInventoryItem.LProduct.LCdProduct);
     dao_Addparameters(this.LListParam, SqlDbType.Decimal, "@QtySellable", pInventoryItem.LQtySellable.ToString(CultureInfo.CurrentCulture));
     return(Dao_executeSqlScalarWithProcedement(this.LListParam, "LTranSubstractInventoryItem", "spr_substractinventory"));
 }
 public string Dao_InsertInventoryItem(BoInventoryItem pInventoryItem)
 {
     this.LListParam = new List <SqlParameter>();
     dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdProduct", pInventoryItem.LProduct.LIdProduct.ToString());
     dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdInventory", pInventoryItem.LInventory.LIdInventory.ToString());
     dao_Addparameters(this.LListParam, SqlDbType.VarChar, "@IdStatus", pInventoryItem.LStatus.LIdStatus);
     dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdObject", pInventoryItem.LObject.LIdObject.ToString());
     dao_Addparameters(this.LListParam, SqlDbType.Decimal, "@QtySellable", pInventoryItem.LQtySellable.ToString(CultureInfo.CurrentCulture));
     dao_Addparameters(this.LListParam, SqlDbType.Decimal, "@QtyNonSellable", pInventoryItem.LQtyNonSellable.ToString(CultureInfo.CurrentCulture));
     return(Dao_executeSqlTransactionWithProcedement(this.LListParam, "LTranInsertInventoryItem", "spr_CreateInventoryItem"));
 }
Exemplo n.º 5
0
        public string bll_SubstractInventoryItem(BoOrderItem pOrderItem, int lIdInventory)
        {
            var lInventoryItem = new BoInventoryItem
            {
                LProduct = new BoProduct {
                    LCdProduct = pOrderItem.LProduct.LCdProduct
                },
                LInventory = new BoInventory {
                    LIdInventory = lIdInventory
                },
                LQtySellable = pOrderItem.LQty
            };
            var lResult = this.LiDaoInventoryItem.Dao_SubstractInventoryItem(lInventoryItem);

            return(lResult == EBooleans.Trues.GetHashCode().ToString() ? null : BoErrors.MsgEmptyProductWithcode.Replace(BoErrors.ReplaceInString1, pOrderItem.LProduct.LCdProduct));
        }
Exemplo n.º 6
0
        public string bll_InsertInventoryItem(int pIdInventory, int pIdProduct, int pIdObject, string pIdStatus, decimal pQtySellable, decimal pQtyNonSellable)
        {
            var oInventoryItem = new BoInventoryItem
            {
                LObject = new BoObject {
                    LIdObject = pIdObject
                },
                LStatus = new BoStatus {
                    LIdStatus = pIdStatus
                },
                LProduct = new BoProduct {
                    LIdProduct = pIdProduct
                },
                LInventory = new BoInventory {
                    LIdInventory = pIdInventory
                },
                LQtyNonSellable = pQtyNonSellable,
                LQtySellable    = pQtySellable
            };

            return(this.LiDaoInventoryItem.Dao_InsertInventoryItem(oInventoryItem));
        }
        public static MInventoryItem MInventoryItemById(this BoInventoryItem pInventoryItem)
        {
            var oMInventoryItem = new MInventoryItem
            {
                LStatus = new MStatus
                {
                    LIdStatus = pInventoryItem.LStatus.LIdStatus,
                    LDsEstado = pInventoryItem.LStatus.LDsEstado
                },
                LListStatus  = new List <SelectListItem>(),
                LListProduct = new List <SelectListItem>(),
                LProduct     = new MProduct
                {
                    LIdProduct   = pInventoryItem.LProduct.LIdProduct,
                    LNameProduct = pInventoryItem.LProduct.LNameProduct
                },
                LIdInventoryItem = pInventoryItem.LIdInventoryItem,
                LInventory       = new MInventory
                {
                    LIdInventory   = pInventoryItem.LInventory.LIdInventory,
                    LNameInventory = pInventoryItem.LInventory.LNameInventory
                },
                LQtySellable    = pInventoryItem.LQtySellable,
                LQtyNonSellable = pInventoryItem.LQtyNonSellable,
                LCreationDate   = pInventoryItem.LCreationDate,
                LObject         = new MObject
                {
                    LIdObject   = pInventoryItem.LObject.LIdObject,
                    LNameObject = pInventoryItem.LObject.LNameObject
                }
            };

            oMInventoryItem.LListStatus  = LiStatus.Bll_getListStatusByIdObject(oMInventoryItem.LObject.LIdObject).MListAllStatus();
            oMInventoryItem.LListProduct = LiProduct.bll_GetAllProduct().MListAllProduct(true);
            return(oMInventoryItem);
        }
 public string Dao_DeleteInventoryItem(BoInventoryItem pInventoryItem)
 {
     this.LListParam = new List <SqlParameter>();
     dao_Addparameters(this.LListParam, SqlDbType.Int, "@IdInventoryItem", pInventoryItem.LIdInventoryItem.ToString());
     return(Dao_executeSqlTransactionWithProcedement(this.LListParam, "LTranDeleteInventoryItem", "spr_DeleteInventoryItem"));
 }
Exemplo n.º 9
0
        // GET: InventoryItem/Details/5
        public ActionResult Details(int id)
        {
            BoInventoryItem lOInventoryItem = this.LInventoryItem.bll_GetInventoryItemById(id);

            return(this.View(lOInventoryItem.MInventoryItemById()));
        }
        public List <BoInventoryItem> Dao_getInventoryReport()
        {
            SqlConnection lConex = new SqlConnection();

            using (lConex = Dao_SqlConnection(lConex))
            {
                var lListReport = new List <BoInventoryItem>();
                try
                {
                    var lCommand = new SqlCommand
                    {
                        CommandText    = "spr_ReportInventory",
                        CommandTimeout = 30,
                        CommandType    = CommandType.StoredProcedure,
                        Connection     = lConex
                    };
                    var lReader = lCommand.ExecuteReader();
                    if (lReader.HasRows)
                    {
                        while (lReader.Read())
                        {
                            var lReport = new BoInventoryItem
                            {
                                LInventory = new BoInventory
                                {
                                    LIdInventory   = Convert.ToInt32(lReader["IdInventory"].ToString()),
                                    LNameInventory = lReader["NameInventory"].ToString()
                                },
                                LProduct = new BoProduct
                                {
                                    LIdProduct   = Convert.ToInt32(lReader["IdProduct"].ToString()),
                                    LCdProduct   = lReader["CdProduct"].ToString(),
                                    LNameProduct = lReader["NameProduct"].ToString()
                                },
                                LQtySellable    = Convert.ToDecimal(lReader["QtySellable"].ToString()),
                                LQtyNonSellable = Convert.ToDecimal(lReader["QtyNonSellable"].ToString()),
                            };
                            lListReport.Add(lReport);
                        }
                    }
                    Dao_CloseSqlconnection(lConex);
                    return(lListReport);
                }
                catch (Exception e)
                {
                    lListReport = new List <BoInventoryItem>();
                    var lReport = new BoInventoryItem
                    {
                        LException  = e.Message,
                        LMessageDao = BoErrors.MsgErrorGetSql
                    };

                    if (e.InnerException != null)
                    {
                        lReport.LInnerException = e.InnerException.ToString();
                    }
                    Dao_CloseSqlconnection(lConex);
                    lListReport.Add(lReport);
                    return(lListReport);
                }
            }
        }