コード例 #1
0
        public Dictionary <Object, dynamic> insertPaymentMethodFromMaintenance()
        {
            if (String.IsNullOrEmpty(data["description"]))
            {
                return(result(Result.Failed, Result.Empty, null));
            }

            try
            {
                string oldContent, newContent;

                TipoPago paymentMethod = CreatePaymentMethod();
                oldContent = "";
                newContent = paymentMethod.toString();

                Bitacora paymentMethodLog = createLog(Log.Insert, Log.PaymentMethods, oldContent, newContent);

                db.TipoPago.Add(paymentMethod);
                db.Bitacora.Add(paymentMethodLog);
                db.SaveChanges();

                return(result(Result.Processed, Result.Inserted, null));
            }
            catch (Exception ex)
            {
                return(result(Result.Failed, "Se ha generado un error: " + ex.Message, null));
            }
        }
コード例 #2
0
        public Dictionary <Object, dynamic> insertProductFromMaintenance()
        {
            if (String.IsNullOrEmpty(data["description"]))
            {
                return(result(Result.Failed, Result.Empty, null));
            }

            try
            {
                string   oldContent, newContent;
                Producto product = CreateProduct();
                oldContent = "";
                newContent = product.ToString();
                Bitacora productLog = createLog(Log.Insert, Log.Product, oldContent, newContent);
                db.Producto.Add(product);
                db.Bitacora.Add(productLog);
                db.SaveChanges();

                return(result(Result.Processed, Result.Inserted, null));
            }
            catch (Exception ex)
            {
                return(result(Result.Failed, "Se ha generado un error: " + ex.Message, null));
            }
        }
コード例 #3
0
        public Dictionary <Object, dynamic> insertMaterialTypeFromMaintenance()
        {
            if (String.IsNullOrEmpty(data["description"]))
            {
                return(result(Result.Failed, Result.Empty, null));
            }

            try
            {
                string oldContent, newContent;

                TipoMaterial materialType = CreateMaterialType();
                oldContent = "";
                newContent = materialType.toString();

                Bitacora materialTypeLog = createLog(Log.Insert, Log.MaterialType, oldContent, newContent);

                db.TipoMaterial.Add(materialType);
                db.Bitacora.Add(materialTypeLog);
                db.SaveChanges();

                return(result(Result.Processed, Result.Inserted, null));
            }
            catch (Exception ex)
            {
                return(result(Result.Failed, "Se ha generado un error: " + ex.Message, null));
            }
        }
コード例 #4
0
        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));
            }
        }