public Dictionary <Object, dynamic> deleteMaterialType(TipoMaterial registeredMaterialType)
        {
            try
            {
                TipoMaterial delMaterialType = db.TipoMaterial.Find(data["id"]);

                string oldContent = delMaterialType.toString();
                delMaterialType.Eliminado = 1;
                delMaterialType.IdEstado  = Status.Inactive;
                string newContent = delMaterialType.toString();

                db.Entry(delMaterialType).State = System.Data.Entity.EntityState.Modified;

                Bitacora paymentLog = createLog(Log.Delete, Log.MaterialType, oldContent, newContent);
                db.Bitacora.Add(paymentLog);

                db.SaveChanges();

                return(result(Result.Processed, Result.Deleted, null));
            }
            catch (Exception ex)
            {
                return(result(Result.Failed, "Error al eliminar el registro: " + ex.Message, null));
            }
        }
Пример #2
0
        public Dictionary <Object, dynamic> deletePaymentMethod(TipoPago registeredPayment)
        {
            try
            {
                TipoPago delPaymentMethod = db.TipoPago.Find(data["id"]);

                string oldContent = delPaymentMethod.toString();
                delPaymentMethod.Eliminado = 1;
                string newContent = delPaymentMethod.toString();

                db.Entry(delPaymentMethod).State = System.Data.Entity.EntityState.Modified;

                Bitacora paymentLog = createLog(Log.Delete, Log.PaymentMethods, oldContent, newContent);
                db.Bitacora.Add(paymentLog);

                db.SaveChanges();

                return(result(Result.Processed, Result.Deleted, null));
            }
            catch (Exception ex)
            {
                return(result(Result.Failed, "Error al eliminar el registro: " + ex.Message, null));
            }
        }
        public Dictionary <Object, dynamic> deleteClient(Cliente registeredClient)
        {
            try
            {
                Cliente delClient = db.Cliente.Find(data["id"]);

                string oldContent = delClient.toString();
                delClient.Eliminado = 1;
                string newContent = delClient.toString();

                db.Entry(delClient).State = System.Data.Entity.EntityState.Modified;

                Bitacora clientLog = createLog(Log.Delete, Log.Client, oldContent, newContent);
                db.Bitacora.Add(clientLog);

                db.SaveChanges();

                return(result(Result.Processed, Result.Deleted, null));
            }
            catch (Exception ex)
            {
                return(result(Result.Failed, "Error al eliminar el registro: " + ex.Message, null));
            }
        }