예제 #1
0
        public List <BE_ProductCategory> GetProductCategory()
        {
            BE_ProductCategory bE_ProductCategory = new BE_ProductCategory();

            _database = new MySQLDatabase(connectionString);
            return(GetProductCategoryGeneral(bE_ProductCategory));
        }
        public BE_Json UpdateProductCategory([FromBody] BE_ProductCategory bE_ProductCategory)
        {
            BE_Json objJson     = null;
            var     objListaAux = string.Empty;

            try
            {
                BL_ProductCategory bL_ProductCategory = new BL_ProductCategory();
                bL_ProductCategory.connectionString = AppConfig.DbConnection;
                objListaAux = JsonConvert.SerializeObject(bL_ProductCategory.UpdateProductCategory(bE_ProductCategory));

                objJson        = new BE_Json();
                objJson.data   = (objListaAux == "null") ? "No se pudo editar" : objListaAux;
                objJson.status = (objListaAux == "null") ? CManager.RESULTADO_WCF.ERROR : 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);
        }
예제 #3
0
        public BE_ProductCategory CreateProductCategory(BE_ProductCategory bE_ProductCategory)
        {
            string strError_Mensaje = string.Empty;
            bool   boResultado      = false;

            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("_name", bE_ProductCategory.name);
            parameters.Add("_isEnabled", bE_ProductCategory.isEnabled);

            var productCategoryId = _database.ExecuteSPGetId("sp_createProductCategory", parameters);

            boResultado = (productCategoryId != null);
            if (boResultado)
            {
                bE_ProductCategory.productCategoryId = int.Parse(productCategoryId.ToString());
                return(bE_ProductCategory);
            }
            return(null);
        }
예제 #4
0
        public BE_ProductCategory UpdateProductCategory(BE_ProductCategory bE_ProductCategory)
        {
            string strError_Mensaje = string.Empty;
            bool   boResultado      = false;
            int    filasAfectadas   = 0;

            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("_productCategoryId", bE_ProductCategory.productCategoryId);
            parameters.Add("_name", bE_ProductCategory.name);
            parameters.Add("_isEnabled", bE_ProductCategory.isEnabled);

            filasAfectadas = _database.ExecuteSP("sp_updateProductCategory", parameters);

            boResultado = (filasAfectadas > 0);
            if (boResultado)
            {
                return(bE_ProductCategory);
            }
            return(null);
        }
예제 #5
0
        public List <BE_ProductCategory> GetProductCategoryGeneral(BE_ProductCategory bE_ProductCategory)
        {
            BE_ProductCategory          _bE_ProductCategory = null;
            List <BE_ProductCategory>   _lstProductCategory = new List <BE_ProductCategory>();
            Dictionary <string, object> parameters          = new Dictionary <string, object>();

            parameters.Add("_productCategoryId", (bE_ProductCategory.productCategoryId == 0) ? DBNull.Value : (object)bE_ProductCategory.productCategoryId);
            parameters.Add("_name", bE_ProductCategory.name);

            var rows = _database.QuerySP("sp_getProductCategoryGeneral", parameters);

            foreach (var row in rows)
            {
                _bE_ProductCategory = new BE_ProductCategory();
                _bE_ProductCategory.productCategoryId = string.IsNullOrEmpty(row["productCategoryId"]) ? 0 : int.Parse(row["productCategoryId"]);
                _bE_ProductCategory.name = row["name"];
                _lstProductCategory.Add(_bE_ProductCategory);
            }

            return(_lstProductCategory);
        }
예제 #6
0
 public BE_ProductCategory UpdateProductCategory(BE_ProductCategory bE_ProductCategory)
 {
     _database = new MySQLDatabase(connectionString);
     return(new DA_ProductCategory(_database).UpdateProductCategory(bE_ProductCategory));
 }
예제 #7
0
 private List <BE_ProductCategory> GetProductCategoryGeneral(BE_ProductCategory bE_ProductCategory)
 {
     _database = new MySQLDatabase(connectionString);
     return(new DA_ProductCategory(_database).GetProductCategoryGeneral(bE_ProductCategory));
 }