Example #1
0
        public Boolean Company_Delete(ref BaseEntity Entity, tBaseIdList BaseList)
        {
            bool       success = false;
            SqlCommand cmd     = null;

            try
            {
                cmd = new SqlCommand("sp_xP_Eliminar_Masivo_Empresa", clsConnection.GetConnection());
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@TYPE_BASEID", Value = BaseList, SqlDbType = SqlDbType.Structured, TypeName = "dbo.TY_BASEID"
                });
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.ExecuteNonQuery();

                success = true;
            }
            catch (Exception ex)
            {
                success = false;
                Entity.Errors.Add(new BaseEntity.ListError(ex, "Se ha producido un error al eliminar un recurso."));
            }
            finally
            {
                clsConnection.DisposeCommand(cmd);
            }
            return(success);
        }
        public Boolean Brand_Delete(ref BaseEntity Entity, tBaseIdList BaseList)
        {
            Boolean    success = false;
            SqlCommand cmd     = null;

            try
            {
                cmd = new SqlCommand("Brand_Delete_Sp", clsConnection.GetConnection());
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@Type_BaseId", Value = BaseList, SqlDbType = SqlDbType.Structured, TypeName = "dbo.TY_BASEID"
                });
                cmd.CommandType = CommandType.StoredProcedure;
                success         = cmd.ExecuteNonQuery() > 0 ? true : false;
            }
            catch (Exception ex)
            {
                success = false;
                Entity.Errors.Add(new BaseEntity.ListError(ex, "An error occurred  deleting a resource."));
            }
            finally
            {
                clsConnection.DisposeCommand(cmd);
            }
            return(success);
        }
Example #3
0
        public bool Delete(ref BaseEntity Entity, tBaseIdList BaseList)
        {
            bool       success = false;
            SqlCommand cmd     = null;

            try
            {
                cmd = new SqlCommand("SP_RESOURCECATEGORIES_DELETE", clsConnection.GetConnection());
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@TYPE_BASEID", Value = BaseList, SqlDbType = SqlDbType.Structured, TypeName = "dbo.TY_BASEID"
                });
                cmd.CommandType = CommandType.StoredProcedure;

                success = cmd.ExecuteNonQuery() > 0 ? true : false;
            }
            catch (Exception ex)
            {
                success = false;
                Entity.Errors.Add(new BaseEntity.ListError(ex, ex.Message));
            }
            finally
            {
                clsConnection.DisposeCommand(cmd);
            }
            return(success);
        }
        public Boolean ResourceCategories_Delete(ref BaseEntity Entity, tBaseIdList idList)
        {
            Boolean success = false;

            if (idList.Count > 0)
            {
                success = ResourceCategoriesDAO.Instance.Delete(ref Entity, idList);
            }
            else
            {
                Entity.Errors.Add(new BaseEntity.ListError(new Exception {
                }, "An error occurred while sending data"));
            }

            return(success);
        }
        public Boolean AppResource_Delete(ref BaseEntity entity, tBaseIdList idList)
        {
            Boolean success = false;

            if (idList.Count > 0)
            {
                success = AppResourceDAO.Instance.Delete(ref entity, idList);
            }
            else
            {
                entity.Errors.Add(new BaseEntity.ListError(new Exception {
                }, "An error occurred sending data"));
            }

            return(success);
        }
        public static Object SendDelete(String jsondata)
        {
            Boolean success = false;

            try
            {
                JavaScriptSerializer sr         = new JavaScriptSerializer();
                List <String>        listDes    = sr.Deserialize <List <String> >(jsondata);
                tBaseIdList          baseIdList = new tBaseIdList();

                foreach (String item in listDes)
                {
                    baseIdList.Add(new tBaseId {
                        Id = Convert.ToInt32(Encryption.Decrypt(HttpContext.Current.Server.UrlDecode(item))), Action = 0
                    });
                }

                BaseEntity objEntity = new BaseEntity();

                success = ProductBL.Instance.Product_Delete(ref objEntity, baseIdList);

                if (objEntity.Errors.Count == 0)
                {
                    if (success)
                    {
                        return(new { Lista = sr.Serialize(List()), sJSON = "Ok" });
                    }
                    else
                    {
                        return(new { Lista = new List <Products>(), sJSON = "NoOK" });
                    }
                }
                else
                {
                    return(new { Lista = new List <Products>(), sJSON = "No se pueden eliminar los registro(s)" });
                }
            }
            catch (Exception ex)
            {
                return(new { Lista = new List <Products>(), sJSON = "Ocurri un error al eliminar" });
            }
        }