Inheritance: WeddingLibrary.Web.TemplateMasterPage
Exemplo n.º 1
1
        protected void Boton_Mercado_Pago_Click(object sender, EventArgs e)
        {
            decimal Valor_Carga = LBCDC.Mercado_Pago(TextBox_Mercado_Pago.Text, TextBox_Mercado_Pago_Movil.Text, TextBox_PagoFacil.Text, TextBox_PagoFacil_Movil.Text); // analisis de donde pidio la carga pc o movil

            if (Valor_Carga == -9) // fallo los botones en javascript
            {
                return;
            }

            MP mp = new MP("7071654091217780", "F4SUQfv2CA4YUvPj0VsFROGywMkcYvyC");

            Hashtable preference = mp.createPreference("{\"items\":[{\"title\":\"clases\",\"quantity\":1,\"currency_id\":\"ARS\",\"unit_price\":" + Valor_Carga + "}],\"external_reference\":\"" + (string)Session["Usuario"] + "\"}");

            String accessToken = mp.getAccessToken();

            Response.Redirect((((Hashtable)preference["response"])["init_point"]).ToString());
        }
Exemplo n.º 2
1
        private void guardardatos()
        {
            String[] Producto;
            String[] Proveedor;
            String[] PrecioPesos;
            String[] PrecioDolar;
            String[] Cantidad;
            Decimal totalpreciopesosadicionales = 0;
            Decimal totalpreciodolaradicionales = 0;

            Decimal totalpreciopesos= 0;
            Decimal totalpreciodolar= 0;

            DataTable dtProductos = new DataTable();
            DataTable dtProveedor = new DataTable();
            DataTable dtPrecioPesos = new DataTable();
            DataTable dtPrecioDolar = new DataTable();
            DataTable dtCantidad = new DataTable();

            DataSet dsProductos = new DataSet();
            DataSet dsProveedor = new DataSet();
            DataSet dsPrecioPesos = new DataSet();
            DataSet dsPrecioDolar = new DataSet();
            DataSet dsCantidad = new DataSet();

            DataSet ds = new DataSet();
            SqlDataAdapter adapter;
            String tabla = "";

            String preciosindto = "";
            Decimal cambio = 0;
            Decimal valorcambio = 0;

            DataTable dtFormaPago = new DataTable();
            DataSet dsFormaPago = new DataSet();

            DataTable dtFactura = new DataTable();
            DataSet dsFactura = new DataSet();

            try{

                dtFormaPago.Columns.Add("TipoPago");
                dtFormaPago.Columns.Add("TipoTelefono");
                dtFormaPago.Columns.Add("PaisTelefono");
                dtFormaPago.Columns.Add("CodAreaTelefono");
                dtFormaPago.Columns.Add("NroTelefono");

                //FormaPago
                DataRow row = dtFormaPago.NewRow();
                row["TipoPago"] = hdfFormaPago.Value;
                row["TipoTelefono"] = ddlTipoTelefono.SelectedIndex;
                row["PaisTelefono"] = ddlPaisTelefono.SelectedIndex;
                row["CodAreaTelefono"] = txtCodigoAreaCiudad.Text;
                row["NroTelefono"] = txtNroLocal.Text;

                dtFormaPago.Rows.Add(row);
                dsFormaPago.Tables.Add(dtFormaPago);

                dtFactura.Columns.Add("SituacionFiscal");
                dtFactura.Columns.Add("RazonSocial");
                dtFactura.Columns.Add("CUILCUIT");
                dtFactura.Columns.Add("CodigoPostal");
                dtFactura.Columns.Add("Domicilio");
                dtFactura.Columns.Add("CiudadDomicilio");
                dtFactura.Columns.Add("PaisDomicilio");
                dtFactura.Columns.Add("TipoTelefono");
                dtFactura.Columns.Add("PaisTelefono");
                dtFactura.Columns.Add("CodAreaCiudad");
                dtFactura.Columns.Add("NroLocal");

                //FormaPago
                DataRow row1 = dtFactura.NewRow();
                row1["SituacionFiscal"] = ddlSituacionFiscal.SelectedIndex;
                row1["RazonSocial"] = txtNombreoRazonSocial.Text;
                row1["CUILCUIT"] = txtCuit.Text;
                row1["CodigoPostal"] = txtCodigoPostal.Text;
                row1["Domicilio"] = txtDomicilio.Text;
                row1["CiudadDomicilio"] = txtCiudad.Text;
                row1["PaisDomicilio"] = ddlPaisTelefono.SelectedIndex;
                row1["TipoTelefono"] = ddlTipoTelefonoFactura.SelectedIndex;
                row1["PaisTelefono"] = ddlPaisTelefonoFactura.SelectedIndex;
                row1["CodAreaCiudad"] = txtCodigoAreaCiudad.Text;
                row1["NroLocal"] = txtNroLocalFactura.Text;

                dtFactura.Rows.Add(row1);
                dsFactura.Tables.Add(dtFactura);

                Session["InfoFormasdePago"] = dsFormaPago;
                Session["InfoFactura"] = dsFactura;

                dtProductos.Columns.Add("IdProductos");
                dtProveedor.Columns.Add("IdProveedor");
                dtPrecioPesos.Columns.Add("PrecioPesos");
                dtPrecioDolar.Columns.Add("PrecioDolar");
                dtCantidad.Columns.Add("Cantidad");

                Producto = hdfIdProducto.Value.Split('*');
                Proveedor = hdfIdProveedor.Value.Split('*');
                Cantidad = hdfCantidad.Value.Split('*');

                System.Data.SqlClient.SqlConnection conn;
                conn = new System.Data.SqlClient.SqlConnection();
                conn.ConnectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;

                conn.Open();
                SqlCommand command = new SqlCommand("spselProductosIntangibles", conn);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("IdProveedor", hdfIdProveedor.Value);
                command.ExecuteNonQuery();
                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
                conn.Close();

                conversiondemonedas moneda = new conversiondemonedas();

                if ((ds != null) && (ds.Tables[0].Rows.Count > 0))
                {
                    for (int j = 0; j < Producto.Count(); j++)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            if (ds.Tables[0].Rows[i]["IdProducto"].ToString() == Producto[j].ToString())
                            {
                                preciosindto = ds.Tables[0].Rows[i]["Tarifa"].ToString();
                                cambio = moneda.GetConvertion("ARS", "USD");
                                valorcambio = Decimal.Round(Convert.ToDecimal(ds.Tables[0].Rows[i]["Tarifa"].ToString()) * cambio, 2);
                                hdfPrecioPesos.Value = hdfPrecioPesos.Value + preciosindto + "*";
                                hdfPrecioDolar.Value = hdfPrecioDolar.Value + valorcambio + "*";
                            }
                        }
                    }
                }

                PrecioPesos = hdfPrecioPesos.Value.Split('*');
                PrecioDolar = hdfPrecioDolar.Value.Split('*');

                ds.Dispose();
                conn.Close();

                if (hdfOpcionAdicionales.Value == "1") {

                    if (Producto.Count() - 1 > 0)
                    {
                        for (int x = 0; x < Producto.Count() - 1; x++)
                        {
                            DataRow row3 = dtProductos.NewRow();
                            row3["IdProductos"] = Producto[x].ToString();
                            dtProductos.Rows.Add(row3);

                            DataRow row4 = dtProveedor.NewRow();
                            row4["IdProveedor"] = Proveedor[x].ToString();
                            dtProveedor.Rows.Add(row4);

                            DataRow row5 = dtPrecioPesos.NewRow();
                            row5["PrecioPesos"] = PrecioPesos[x].ToString();
                            dtPrecioPesos.Rows.Add(row5);

                            DataRow row6 = dtPrecioDolar.NewRow();
                            row6["PrecioDolar"] = PrecioDolar[x].ToString();
                            dtPrecioDolar.Rows.Add(row6);

                            DataRow row7 = dtCantidad.NewRow();
                            row7["Cantidad"] = Cantidad[x].ToString();
                            dtCantidad.Rows.Add(row7);
                        }
                    }
                }

                dsProductos.Tables.Add(dtProductos);
                dsProveedor.Tables.Add(dtProveedor);
                dsPrecioPesos.Tables.Add(dtPrecioPesos);
                dsPrecioDolar.Tables.Add(dtPrecioDolar);
                dsCantidad.Tables.Add(dtCantidad);

                Session["Productos"] = dsProductos;
                Session["Proveedor"] = dsProveedor;
                Session["PrecioPesos"] = dsPrecioPesos;
                Session["PrecioDolar"] = dsPrecioDolar;
                Session["Cantidad"] = dsCantidad;

                if (PrecioPesos.Count() > 0){

                    for (int z = 0; z < PrecioPesos.Count()-1 ; z++){
                        totalpreciopesosadicionales += Convert.ToDecimal(PrecioPesos[z].ToString());
                        totalpreciodolaradicionales += Convert.ToDecimal(PrecioDolar[z].ToString());
                    }

                }

                totalpreciopesos += totalpreciopesosadicionales + Convert.ToDecimal(lblPrecioPesos.Text);

                totalpreciodolar += totalpreciodolaradicionales + Convert.ToDecimal(lblPrecioDolar.Text);

                MP mp = new MP("3592982235689583", "iwzO6CMeOH6gA0dMYnCtvZZo7L6aUYO3");

                String url1 = "";
                String url2 = "";
                String url3 = "";

                //url1 = "http://testing.portsoft.com.ar/tusegurodeviaje/pago-confirmado.aspx?op=" + lblFechaSalida.Text + "_" + lblFechaLlegada.Text + "_" + Convert.ToString(totalpreciopesos) + "_" + Convert.ToString(totalpreciodolar) + "";
                //url2 = "http://testing.portsoft.com.ar/tusegurodeviaje/pago-pendiente.aspx?op=" + lblFechaSalida.Text + "_" + lblFechaLlegada.Text + "_" + Convert.ToString(totalpreciopesos) + "_" + Convert.ToString(totalpreciodolar) + "";
                //url3 = "http://testing.portsoft.com.ar/tusegurodeviaje/pago-fallo.aspx?op=" + lblFechaSalida.Text + "_" + lblFechaLlegada.Text + "_" + Convert.ToString(totalpreciopesos) + "_" + Convert.ToString(totalpreciodolar) + "";

                url1 = "http://localhost:50814/pago-confirmado.aspx?op=" + lblFechaSalida.Text + "_" + lblFechaLlegada.Text + "_" + Convert.ToString(totalpreciopesos) + "_" + Convert.ToString(totalpreciodolar) + "";
                url2 = "http://localhost:50814/pago-pendiente.aspx?op=" + lblFechaSalida.Text + "_" + lblFechaLlegada.Text + "_" + Convert.ToString(totalpreciopesos) + "_" + Convert.ToString(totalpreciodolar) + "";
                url3 = "http://localhost:50814/pago-fallo.aspx?op=" + lblFechaSalida.Text + "_" + lblFechaLlegada.Text + "_" + Convert.ToString(totalpreciopesos) + "_" + Convert.ToString(totalpreciodolar) + "";

                String datos = "{\"items\":[{\"title\":\"sdk-dotnet\",\"quantity\":1,\"currency_id\":\"ARS\",\"unit_price\":" + Convert.ToString(totalpreciopesos) + "}] , \"back_urls\":{\"success\": \"" + url1 + "\", \"pending\": \"" + url2 + "\",\"failure\":\"" + url3 + "\"} }";

                Hashtable preference = mp.createPreference(datos);
                Hashtable url = ((Hashtable)preference["response"]);

                hdfUrl.Value = url["sandbox_init_point"].ToString();

                Response.Redirect(url["sandbox_init_point"].ToString());

            }
            catch (Exception ex){
                Response.Write(ex.Message);
            }
            finally{
            }
        }
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable paymentMethods = mp.get ("/v1/payment_methods");

		Console.WriteLine (paymentMethods.ToString());
	}
        static MultiplayerCompatibility()
        {
            if (!MP.enabled)
            {
                return;
            }

            // Sync all gizmo clicks

            MP.RegisterSyncMethod(typeof(Command_Process), nameof(Command_Process.ChangeProcess)).SetContext(SyncContext.MapSelected);
            MP.RegisterSyncMethod(typeof(Command_Quality), nameof(Command_Quality.ChangeQuality)).SetContext(SyncContext.MapSelected);

            var methods = new[] {
                nameof(UF_Utility.FinishProcess),
                nameof(UF_Utility.ProgressOneDay),
                nameof(UF_Utility.ProgressHalfQuadrum),
                nameof(UF_Utility.EmptyObject),
                nameof(UF_Utility.FillObject),
                nameof(UF_Utility.LogSpeedFactors),
            };

            foreach (string methodName in methods)
            {
                MP.RegisterSyncMethod(typeof(UF_Utility), methodName);
            }

            MP.RegisterSyncWorker <UF_Process>(UF_Process_SyncWorker, shouldConstruct: false);
        }
Exemplo n.º 5
0
        // Token: 0x06000050 RID: 80 RVA: 0x000038C0 File Offset: 0x00001AC0
        static MultiplayerSupport()
        {
            if (!MP.enabled)
            {
                return;
            }

            MP.RegisterSyncMethod(typeof(RPGraphene_Vent), "ToggleUseFixed");
            MP.RegisterSyncMethod(typeof(Building_TempRegulator), "ToggleUseBoost");
            MP.RegisterSyncMethod(typeof(Building_RPThingMaker), "RPMakerSelectThing");
            MP.RegisterSyncMethod(typeof(Building_RPThingMaker), "SetProdControlValues");
            MP.RegisterSyncMethod(typeof(Building_RPThingMaker), "ToggleProducing");
            MP.RegisterSyncMethod(typeof(Building_RPThingMaker), "RPMakerSelectLimit");
            MP.RegisterSyncMethod(typeof(Building_RPThingMaker), "SetStockLimits");
            MP.RegisterSyncMethod(typeof(Building_RPThingMaker), "ToggleDebug");
            MethodInfo[] array =
            {
                AccessTools.Method(typeof(Building_RPGrapheneBatterySmall), "Tick"),
                AccessTools.Method(typeof(Building_RPGrapheneBatterySmall), "PostApplyDamage"),
                AccessTools.Method(typeof(Globals),                         "DoSecSpecialEffects")
            };
            foreach (var methodInfo in array)
            {
                FixRNG(methodInfo);
            }
        }
 private static void CommonSensePatchPostix()
 {
     if (MP.IsInMultiplayer)
     {
         MP.WatchEnd();
     }
 }
        public static void Initialize()
        {
            try {
                if (!MP.enabled)
                {
                    return;
                }
                const string expectedAPIVersion = "0.1";
                if (!MP.API.Equals(expectedAPIVersion))
                {
                    throw new Exception($"MP API version mismatch. This mod is designed to work with MPAPI version {expectedAPIVersion}");
                }

                // register synchronized methods
                MP.RegisterSyncMethod(typeof(DefensivePositionsManager), nameof(DefensivePositionsManager.ToggleAdvancedMode));
                MP.RegisterSyncMethod(typeof(PawnSavedPositionHandler), nameof(PawnSavedPositionHandler.SetDefensivePosition));
                MP.RegisterSyncMethod(typeof(PawnSavedPositionHandler), nameof(PawnSavedPositionHandler.DiscardSavedPosition));
                MP.RegisterSyncMethod(typeof(PawnSquadHandler), nameof(PawnSquadHandler.SetSquadMembers));
                MP.RegisterSyncMethod(typeof(PawnSquadHandler), nameof(PawnSquadHandler.ClearSquad));

                // register instance resolvers
                MP.RegisterSyncWorker <DefensivePositionsManager>(ManagerSyncer, typeof(DefensivePositionsManager));
                MP.RegisterSyncWorker <PawnSavedPositionHandler>(PawnHandlerSyncer, typeof(PawnSavedPositionHandler));
                MP.RegisterSyncWorker <PawnSquadHandler>(SquadHandlerSyncer, typeof(PawnSquadHandler));

                DefensivePositionsManager.Instance.Logger.Message("Applied Multiplayer API compatibility layer");
            } catch (Exception e) {
                DefensivePositionsManager.Instance.Logger.Error("Failed to apply Multiplayer API compatibility layer: " + e);
            }
        }
Exemplo n.º 8
0
        static ExtendedOutfitProxy()
        {
            if (!MP.enabled)
            {
                return;
            }

            ProxyFields = new ISyncField[] {
                MP.RegisterSyncField(typeof(ExtendedOutfitProxy), nameof(targetWeight))
                .SetBufferChanges().PostApply(Update)
            };

            ExtendedOutfitFields = new ISyncField[] {
                MP.RegisterSyncField(typeof(ExtendedOutfit), nameof(ExtendedOutfit.targetTemperaturesOverride)),
                MP.RegisterSyncField(typeof(ExtendedOutfit), nameof(ExtendedOutfit.targetTemperatures)),
                MP.RegisterSyncField(typeof(ExtendedOutfit), nameof(ExtendedOutfit.PenaltyWornByCorpse)),
                MP.RegisterSyncField(typeof(ExtendedOutfit), nameof(ExtendedOutfit.AutoWorkPriorities)),
            };

            MP.RegisterSyncMethod(typeof(ExtendedOutfit), nameof(ExtendedOutfit.AddStatPriority));
            MP.RegisterSyncMethod(typeof(ExtendedOutfit), nameof(ExtendedOutfit.RemoveStatPriority));

            MP.RegisterSyncMethod(typeof(ExtendedOutfitProxy), nameof(SetStat));

            MP.RegisterSyncWorker <ExtendedOutfit>(ExtendedOutfitSyncer);
        }
Exemplo n.º 9
0
        public CashRegister(ModContentPack mod)
        {
            var type = AccessTools.TypeByName("CashRegister.Shifts.ITab_Register_Shifts");

            MpCompat.RegisterLambdaMethod(type, "GetGizmos", 1).SetContext(SyncContext.MapSelected);
            MP.RegisterSyncWorker <object>(NoSync, type, shouldConstruct: true);
            MP.RegisterSyncMethod(typeof(CashRegister), nameof(SyncedSetShifts)).ExposeParameter(1).ExposeParameter(2).ExposeParameter(3).ExposeParameter(4).ExposeParameter(5).MinTime(100);
            MpCompat.harmony.Patch(AccessTools.Method(type, "FillTab"),
                                   prefix: new HarmonyMethod(typeof(CashRegister), nameof(PreFillTab)),
                                   postfix: new HarmonyMethod(typeof(CashRegister), nameof(PostFillTab)));

            type = AccessTools.TypeByName("CashRegister.Gizmo_Radius");
            gizmoRadiusConstructor = AccessTools.GetDeclaredConstructors(type).First(x => x.GetParameters().Length == 1);
            gizmoSelectionField    = AccessTools.FieldRefAccess <Building[]>(type, "selection");
            MP.RegisterSyncMethod(AccessTools.DeclaredMethod(type, "ButtonDown"));
            MP.RegisterSyncMethod(AccessTools.DeclaredMethod(type, "ButtonUp"));
            MP.RegisterSyncMethod(AccessTools.DeclaredMethod(type, "ButtonCenter"));
            MP.RegisterSyncWorker <Gizmo>(SyncGizmoRadius, type);

            type             = AccessTools.TypeByName("CashRegister.Building_CashRegister");
            cashRegisterType = type.MakeArrayType();
            shiftsListField  = AccessTools.FieldRefAccess <IList>(type, "shifts");

            type             = AccessTools.TypeByName("CashRegister.Shifts.Shift");
            shiftConstructor = AccessTools.Constructor(type);
            timetableField   = AccessTools.FieldRefAccess <object>(type, "timetable");
            assignedField    = AccessTools.FieldRefAccess <List <Pawn> >(type, "assigned");

            type       = AccessTools.TypeByName("CashRegister.Timetable.TimetableBool");
            timesField = AccessTools.FieldRefAccess <List <bool> >(type, "times");
        }
Exemplo n.º 10
0
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable customer = mp.post ("/v1/customers", "{\"email\": \"[email protected]\"}");

		Console.WriteLine (customer.ToString());
	}
Exemplo n.º 11
0
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable cards = mp.get ("/v1/customers/[CUSTOMER_ID]/cards");

		Console.WriteLine (cards["response"].ToString());
	}
Exemplo n.º 12
0
 void Awake()
 {
     if (MP.instance == null)
     {
         MP.instance = this;
     }
 }
Exemplo n.º 13
0
        public ActionResult VerMP(int id)
        {
            ViewBag.Message    = "Inbox";
            Session["UserIDG"] = Session["UserIDG"];
            Session["UserID"]  = Session["UserID"];
            Session["User"]    = Session["User"];
            MP mp = new MP();

            mp = mp.getMPByID(id);
            User user = new User();

            user = user.getUserID(mp.id_from);
            List <string> items = new List <string>();

            items.Add(mp.title);
            items.Add(mp.date_send);
            items.Add(mp.msg);
            items.Add(user.name);
            ViewBag.Items = items;
            if (mp.check.Equals(1))
            {
                return(View());
            }
            String sql     = "Update  MP set check_read = '1' where id_message = '" + id + "'";
            int    retorno = 0;

            using (SqlConnection connection = BD.getConnection())
            {
                SqlCommand Comando = new SqlCommand(string.Format(sql), connection);
                retorno = Comando.ExecuteNonQuery();
                connection.Close();
            }
            return(View());
        }
Exemplo n.º 14
0
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable payment = mp.get ("/v1/payments/[ID]");

		Console.WriteLine (payment.ToString());
	}
Exemplo n.º 15
0
        private static void PostFillTab(ITab __instance, ref object[] __state)
        {
            if (MP.IsInMultiplayer && (bool)__state[0])
            {
                MP.WatchEnd();

                // Since we got non-null value in prefix, assume same here
                var soul          = pawnSoulITabSoulToShowGetter.Invoke(__instance, Array.Empty <object>());
                var favourTracker = compSoulFavourTrackerField(soul);

                var previousFavourList = (float[])__state[1];
                var favoursList        = soulFavourTrackerFavoursField(favourTracker);

                // Check for changes, revert them (if any) and change them in synced method
                for (var i = 0; i < favoursList.Count; i++)
                {
                    var newValue = favourProgressFavourValueField(favoursList[i]);
                    var oldValue = previousFavourList[i];

                    if (newValue != oldValue)
                    {
                        favourProgressFavourValueField(favoursList[i]) = oldValue;
                        SyncFavourValue((ThingComp)soul, i, newValue);
                        // We could break here, but let's just keep going in case there's more than one changed
                        // There shouldn't be more than a single difference, but let's be safe
                    }
                }
            }
        }
Exemplo n.º 16
0
        // Token: 0x060000A5 RID: 165 RVA: 0x00005CCC File Offset: 0x00003ECC
        static MultiplayerSupport()
        {
            if (!MP.enabled)
            {
                return;
            }

            MP.RegisterSyncMethod(typeof(GhostGearApparel), "GGCaltropsUse");
            MP.RegisterSyncMethod(typeof(GhostGearApparel), "GGRepulse");
            MP.RegisterSyncMethod(typeof(GhostGearApparel), "UseGrappleHook");
            MethodInfo[] array =
            {
                AccessTools.Method(typeof(HaywireData),    "TrySetHaywireTicks"),
                AccessTools.Method(typeof(HaywireUtility), "Rnd100"),
                AccessTools.Method(typeof(HaywireUtility), "RndTicks"),
                AccessTools.Method(typeof(HaywireUtility), "RndHWWanderRadius"),
                AccessTools.Method(typeof(HaywireUtility), "GetRandomThing"),
                AccessTools.Method(typeof(HaywireEffect),  "RndDmg"),
                AccessTools.Method(typeof(HaywireEffect),  "GetCandidate"),
                AccessTools.Method(typeof(GHInjury),       "DoGHRelatedInjury"),
                AccessTools.Method(typeof(GHInjury),       "SetUpInjVars")
            };
            foreach (var methodInfo in array)
            {
                FixRNG(methodInfo);
            }
        }
 public static IEnumerable <ISyncMethod> RegisterSyncMethodsByIndex(Type type, string prefix, params int[] index)
 {
     foreach (var method in MethodsByIndex(type, prefix, index))
     {
         yield return(MP.RegisterSyncMethod(method));
     }
 }
Exemplo n.º 18
0
 static void DrawLockPostfix()
 {
     if (MP.IsInMultiplayer)
     {
         MP.WatchEnd();
     }
 }
Exemplo n.º 19
0
 public OneBedToSleepWithAll(ModContentPack mod)
 {
     compType = AccessTools.TypeByName("OneBedToSleepWithAll.CompPolygamyMode");
     MpCompat.RegisterLambdaMethod(compType, "CompGetGizmosExtra", 1);
     // Comp has a null props.compClass, most likely it's dynamically created
     MP.RegisterSyncWorker <ThingComp>(SyncCompPolygamyMode, compType);
 }
Exemplo n.º 20
0
        static void LateLoad()
        {
            Type type = AccessTools.TypeByName("PocketSand.PawnExtensions");

            MP.RegisterSyncMethod(type, "EquipFromInventory");
            MP.RegisterSyncMethod(type, "DropFromInventory");
        }
Exemplo n.º 21
0
        private static void PreFillTab(ITab __instance, ref object[] __state)
        {
            if (MP.IsInMultiplayer)
            {
                __state = new object[2];

                var soul = pawnSoulITabSoulToShowGetter.Invoke(__instance, Array.Empty <object>());

                if (soul != null)
                {
                    MP.WatchBegin();
                    var prayerTracker = compSoulPrayerTrackerField(soul);
                    prayerTrackerAllowPrayingSync.Watch(prayerTracker);
                    prayerTrackerShowPrayerSync.Watch(prayerTracker);
                    __state[0] = true;


                    var favourTracker = compSoulFavourTrackerField(soul);
                    var favoursList   = soulFavourTrackerFavoursField(favourTracker);

                    var favorValues = new float[favoursList.Count];
                    for (var i = 0; i < favoursList.Count; i++)
                    {
                        favorValues[i] = favourProgressFavourValueField(favoursList[i]);
                    }

                    __state[1] = favorValues;
                }
                else
                {
                    __state[0] = false;
                }
            }
        }
        public void LatePatch()
        {
            // Facepaint
            changeFacepaintDialogType = AccessTools.TypeByName("VFEV.Facepaint.Dialog_ChangeFacepaint");
            //setFacepaintMethod = AccessTools.Method(changeFacepaintDialogType, "SetHairstyle");
            orderedFacepaintDefsField = AccessTools.Field(changeFacepaintDialogType, "orderedFacepaintDefs");

            newFacepaintComboSync = MP.RegisterSyncField(AccessTools.Field(changeFacepaintDialogType, "newFacepaintCombo"));
            coloursTiedSync       = MP.RegisterSyncField(AccessTools.Field(changeFacepaintDialogType, "coloursTied"));
            MP.RegisterSyncMethod(changeFacepaintDialogType, "SetHairstyle");
            MP.RegisterSyncWorker <Window>(SyncDialog, changeFacepaintDialogType);

            MP.RegisterSyncMethod(typeof(VanillaFactionsVikings), nameof(SyncedTryRemoveWindow));

            MpCompat.harmony.Patch(AccessTools.Method(changeFacepaintDialogType, "DoWindowContents"),
                                   prefix: new HarmonyMethod(typeof(VanillaFactionsVikings), nameof(PreDoWindowContents)),
                                   postfix: new HarmonyMethod(typeof(VanillaFactionsVikings), nameof(PostDoWindowContents)));

            var type = AccessTools.Inner(changeFacepaintDialogType, "FacepaintCombination");

            MP.RegisterSyncWorker <object>(SyncFacepaintCombination, type);

            facepaintDefOneField    = AccessTools.Field(type, "facepaintDefOne");
            facepaintDefTwoField    = AccessTools.Field(type, "facepaintDefTwo");
            facepaintColourOneField = AccessTools.Field(type, "colourOne");
            facepaintColourTwoField = AccessTools.Field(type, "colourTwo");

            MpCompat.harmony.Patch(AccessTools.Method(typeof(WindowStack), nameof(WindowStack.TryRemove), new[] { typeof(Window), typeof(bool) }),
                                   prefix: new HarmonyMethod(typeof(VanillaFactionsVikings), nameof(PreTryRemoveWindow)));
        }
        private static void LatePatch()
        {
            // Window_Psyker
            psykerWindowType      = AccessTools.TypeByName("Corruption.Psykers.Window_Psyker");
            psykerWindowCompField = AccessTools.Field(psykerWindowType, "comp");
            MP.RegisterSyncMethod(typeof(CorruptionPsykers), nameof(SyncedAddMinorDiscipline));

            MpCompat.harmony.Patch(AccessTools.Method(psykerWindowType, nameof(Window.DoWindowContents)),
                                   prefix: new HarmonyMethod(typeof(CorruptionPsykers), nameof(PrePsykerDoWindowContents)),
                                   postfix: new HarmonyMethod(typeof(CorruptionPsykers), nameof(PostPsykerDoWindowContents)));

            MP.RegisterSyncMethod(typeof(CorruptionPsykers), nameof(SyncedTryLearnPower));

            var psykerLearnablePowerType = AccessTools.TypeByName("Corruption.Psykers.PsykerLearnablePower");

            var type = AccessTools.TypeByName("Corruption.Psykers.CompPsyker");

            compPsykerTryLearnPowerMethod   = AccessTools.Method(type, "TryLearnPower", new Type[] { psykerLearnablePowerType });
            compPsykerAddXpMethod           = AccessTools.Method(type, "AddXP");
            compPsykerMainDisciplineField   = AccessTools.Field(type, "MainDiscipline");
            compPsykerMinorDisciplinesField = AccessTools.Field(type, "minorDisciplines");
            compPsykerXpSyncField           = MP.RegisterSyncField(type, "PsykerXP");

            type = AccessTools.TypeByName("Corruption.Psykers.PsykerDisciplineDef");
            psykerDisciplineDefAbilitiesField = AccessTools.Field(type, "abilities");

            var database = typeof(DefDatabase <>).MakeGenericType(new Type[] { type });

            getDefByShortHash = AccessTools.Method(database, "GetByShortHash");

            MpCompat.harmony.Patch(AccessTools.Method(psykerWindowType, "DrawSelectedPower"),
                                   transpiler: new HarmonyMethod(typeof(CorruptionPsykers), nameof(Transpiler)));
        }
Exemplo n.º 24
0
 // Token: 0x060000CB RID: 203 RVA: 0x00009830 File Offset: 0x00007A30
 static MultiplayerSupport()
 {
     if (!MP.enabled)
     {
         return;
     }
     MP.RegisterSyncMethod(typeof(Building_MSDrugMix), "MSMixerSelectChem", null);
     MP.RegisterSyncMethod(typeof(Building_MSDrugMix), "SetProdControlValues", null);
     MP.RegisterSyncMethod(typeof(Building_MSDrugMix), "ToggleProducing", null);
     MP.RegisterSyncMethod(typeof(Building_MSDrugMix), "MSMixerSelectLimit", null);
     MP.RegisterSyncMethod(typeof(Building_MSDrugMix), "SetStockLimits", null);
     MP.RegisterSyncMethod(typeof(Building_MSDrugMix), "ToggleDebug", null);
     MP.RegisterSyncMethod(typeof(MSStimWorn), "MSDoStimSelect", null);
     MP.RegisterSyncMethod(typeof(MSStimWorn), "MSUseStim", null);
     MethodInfo[] array = new MethodInfo[]
     {
         AccessTools.Method(typeof(MSBitsUtility), "GetBitsYield", null, null),
         AccessTools.Method(typeof(MSBitsUtility), "GetIsBitsSource", null, null),
         AccessTools.Method(typeof(MSExoticUtility), "DoMSTranscendence", null, null),
         AccessTools.Method(typeof(MSExoticUtility), "DoMSPerpetuity", null, null),
         AccessTools.Method(typeof(HediffComp_MSRegen), "ResetTicksToHeal", null, null),
         AccessTools.Method(typeof(HediffComp_MSRegen), "TryHealRandomOldWound", null, null),
         AccessTools.Method(typeof(MSHediffComp_TendDuration), "CompTended", null, null),
         AccessTools.Method(typeof(MSHediffComp_TendDuration), "CompPostTick", null, null),
         AccessTools.Method(typeof(MSCompFoodPoisonable), "PostIngested", null, null),
         AccessTools.Method(typeof(HediffComp_MSCure), "SetTicksToCure", null, null),
         AccessTools.Method(typeof(MSHediffComp_GrowthMode), "CompPostPostAdd", null, null),
         AccessTools.Method(typeof(MSHediffComp_GrowthMode), "CompPostTick", null, null),
         AccessTools.Method(typeof(MSHediffComp_GrowthMode), "MSAdjustment", null, null)
     };
     for (int i = 0; i < array.Length; i++)
     {
         MultiplayerSupport.FixRNG(array[i]);
     }
 }
Exemplo n.º 25
0
    void OnEquipmentChanged(Equipment newItem, Equipment oldItem)
    {
        if (newItem != null)
        {
            HP.AddModifier(newItem.HP_modifier);
            MP.AddModifier(newItem.MP_modifier);
            PhysicalAttack.AddModifier(newItem.PhysicalAttack_modifier);
            PhysicalDefense.AddModifier(newItem.PhysicalDefense_modifier);
            MagicalAttack.AddModifier(newItem.MagicalAttack_modifier);
            MagicalDefense.AddModifier(newItem.MagicalDefense_modifier);
            CriticalRate.AddModifier(newItem.CriticalRate_modifier);
            UpdateStats();
        }

        if (oldItem != null)
        {
            HP.AddModifier(oldItem.HP_modifier);
            MP.AddModifier(oldItem.MP_modifier);
            PhysicalAttack.AddModifier(oldItem.PhysicalAttack_modifier);
            PhysicalDefense.AddModifier(oldItem.PhysicalDefense_modifier);
            MagicalAttack.AddModifier(oldItem.MagicalAttack_modifier);
            MagicalDefense.AddModifier(oldItem.MagicalDefense_modifier);
            CriticalRate.AddModifier(oldItem.CriticalRate_modifier);
            UpdateStats();
        }
    }
Exemplo n.º 26
0
 static MultiplayerPatch()
 {
     if (MP.enabled)
     {
         MP.RegisterAll();
     }
 }
        static void LateSyncMethods()
        {
            // Artillery fix
            {
                var type = AccessTools.TypeByName("VFESecurity.CompLongRangeArtillery");

                selectedCompsProperty  = AccessTools.Property(type, "SelectedComps");
                turretProperty         = AccessTools.Property(type, "Turret");
                targetedTileField      = AccessTools.Field(type, "targetedTile");
                resetWarmupTicksMethod = AccessTools.DeclaredMethod(type, "ResetWarmupTicks");

                MP.RegisterSyncMethod(type, "ResetForcedTarget");
                MP.RegisterSyncMethod(typeof(VFESecurity), nameof(SetTargetedTile));

                MpCompat.harmony.Patch(AccessTools.Method(type, "SetTargetedTile"), new HarmonyMethod(typeof(VFESecurity), nameof(Prefix)));
            }

            // RNG fix
            {
                var methods = new[]
                {
                    // ArtilleryComp:TryResolveArtilleryCount is called by ArtilleryComp:CompTick
                    "VFESecurity.ArtilleryComp:BombardmentTick",
                    "VFESecurity.ArtilleryComp:TryStartBombardment",
                    "VFESecurity.Building_Shield:Notify_EnergyDepleted",
                    "VFESecurity.Building_Shield:Draw",
                    "VFESecurity.CompLongRangeArtillery:CompTick",
                };

                PatchingUtilities.PatchPushPopRand(AccessTools.Method("VFESecurity.Building_Shield:AbsorbDamage", new Type[] { typeof(float), typeof(DamageDef), typeof(float) }));
                PatchingUtilities.PatchPushPopRand(methods);
            }
        }
Exemplo n.º 28
0
 //
 // GET: /MP/
 public ActionResult Index()
 {
     MP mp = new MP();
     mp.ID = 111;
     mp.Name = "Ampy";
     return View(mp);
 }
Exemplo n.º 29
0
        static void WatchPrefix(ITab_Pawn_Visitor __instance)
        {
            if (MP.IsInMultiplayer)
            {
                MP.WatchBegin();

                Pawn pawn = __instance.SelPawn;

                object comp = GetCompMethod.Invoke(pawn, null);

                _chat.Watch(comp);
                _recruit.Watch(comp);
                _arrived.Watch(comp);
                _sentAway.Watch(comp);

                _areaGuest.Watch(comp);
                _areaShop.Watch(comp);

                object worldComp = GetMapCompMethod.Invoke(null, new object[] { pawn.Map });

                _defMode.Watch(worldComp);
                _defAreaGuest.Watch(worldComp);
                _defAreaShop.Watch(worldComp);
            }
        }
 private static void PostSyncBombType()
 {
     if (MP.IsInMultiplayer)
     {
         MP.WatchEnd();
     }
 }
        public CleaningArea(ModContentPack mod)
        {
            Type type = CleaningAreaMapComponentType = AccessTools.TypeByName("CleaningArea.CleaningArea_MapComponent");

            MP.RegisterSyncMethod(AccessTools.PropertySetter(type, "cleaningArea"));
            MP.RegisterSyncWorker <MapComponent>(SyncWorkerForCleaningArea, type);
        }
Exemplo n.º 32
0
        public MaxPool2D(LayerData data) : base(data)
        {
            MP mp = JsonConvert.DeserializeObject <MP>(data.classData);

            width  = mp.width;
            height = mp.height;
        }
Exemplo n.º 33
0
        public WorkTab(ModContentPack mod)
        {
            // Changing priorities
            var type = AccessTools.TypeByName("WorkTab.PriorityManager");

            MP.RegisterSyncMethod(AccessTools.PropertySetter(type, "ShowPriorities"));

            type = AccessTools.TypeByName("WorkTab.Pawn_Extensions");
            MP.RegisterSyncMethod(AccessTools.Method(type, "SetPriority", new[] { typeof(Pawn), typeof(WorkTypeDef), typeof(int), typeof(List <int>) }));
            MP.RegisterSyncMethod(AccessTools.Method(type, "SetPriority", new[] { typeof(Pawn), typeof(WorkTypeDef), typeof(int), typeof(int), typeof(bool) }));
            MP.RegisterSyncMethod(AccessTools.Method(type, "SetPriority", new[] { typeof(Pawn), typeof(WorkGiverDef), typeof(int), typeof(List <int>) }));
            MP.RegisterSyncMethod(AccessTools.Method(type, "SetPriority", new[] { typeof(Pawn), typeof(WorkGiverDef), typeof(int), typeof(int), typeof(bool) }));
            // This one not needed as it calls SetPriority, but it'll
            // end up calling it numerous times - let's just do it in one command.
            MP.RegisterSyncMethod(type, "DisableAll");

            // Technically we don't have to do this, as pasting calls SetPriority...
            // But well, it ends up being called almost 2000 times in vanilla with DLCs alone...
            // So I felt like it'll be smarter to sync it as a single command instead of potentially
            // couple thousand with mods.
            type = AccessTools.TypeByName("WorkTab.PawnColumnWorker_CopyPasteDetailedWorkPriorities");
            copyPasteColumnWorkerConstructor = AccessTools.DeclaredConstructor(type);
            clipboardField = AccessTools.StaticFieldRefAccess <Dictionary <WorkGiverDef, int[]> >(AccessTools.Field(type, "clipboard"));
            var method = AccessTools.Method(type, "PasteTo");

            pasteToMethod = AccessTools.MethodDelegate <PasteTo>(method);
            MpCompat.harmony.Patch(method,
                                   prefix: new HarmonyMethod(typeof(WorkTab), nameof(PrePasteTo)));

            MP.RegisterSyncMethod(typeof(WorkTab), nameof(SyncedPasteTo));

            // We don't really need to sync those, but not doing so will end up with
            // a bunch of unnecessary synced calls (one per colonists)
            // Sadly, there isn't a call like that in case of checkbox priorities - only numeric ones
            var types = new (string typeName, Type parameterType)[]
Exemplo n.º 34
0
 protected void GainLevel()
 {
     Level++;
     HP.LevelUp(Level);
     MP.LevelUp(Level);
     agi.LevelUp(Level);
 }
 private static void CommonSensePatchPostix()
 {
     if (MP.IsInMultiplayer && (bool)manualUnloadEnabledField.GetValue(null))
     {
         MP.WatchEnd();
     }
 }
Exemplo n.º 36
0
	public static void Main () {
		MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");

		Hashtable balance = mp.get ("/users/USER_ID/mercadopago_account/balance");

		Console.WriteLine (balance.ToString());
	}
Exemplo n.º 37
0
 static void WatchPostfix()
 {
     if (MP.IsInMultiplayer)
     {
         MP.WatchEnd();
     }
 }
Exemplo n.º 38
0
        // Token: 0x06000074 RID: 116 RVA: 0x0000552C File Offset: 0x0000372C
        static MultiplayerSupport()
        {
            if (!MP.enabled)
            {
                return;
            }

            MP.RegisterSyncMethod(typeof(JetPackApparel), "UseJetPack");
            MP.RegisterSyncMethod(typeof(JetPackApparel), "ToggleSlowBurn");
            MP.RegisterSyncMethod(typeof(JetPackApparel), "RefuelJP");
            MP.RegisterSyncMethod(typeof(JetPackApparel), "DropFuelJP");
            MP.RegisterSyncMethod(typeof(JetPackApparel), "ChangeFuelJP");
            MP.RegisterSyncMethod(typeof(JetPackApparel), "DebugUseJP");
            MethodInfo[] array =
            {
                AccessTools.Method(typeof(JPInjury),    "CheckForExplosion"),
                AccessTools.Method(typeof(JPInjury),    "DoJPRelatedInjury"),
                AccessTools.Method(typeof(JPInjury),    "SetUpInjVars"),
                AccessTools.Method(typeof(JPSkyFaller), "JPImpact"),
                AccessTools.Method(typeof(JPSkyFaller), "JPIgnite")
            };
            foreach (var methodInfo in array)
            {
                FixRNG(methodInfo);
            }
        }
Exemplo n.º 39
0
 // Use this for initialization
 void Start()
 {
     placeNow = true;
     barrelsCounter = gameObject.GetComponentsInChildren<Text> ()[3];
     mpScript = mapCam.GetComponent<MP> ();
     dialogCanvas = gameObject.GetComponent<Canvas> ();
     dialogCanvas.enabled = false;
 }
Exemplo n.º 40
0
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Dictionary<String, String> filters = new Dictionary<String, String> ();
		filters.Add("email", "your.payer@email");

		Hashtable customer = mp.get ("/v1/customers/search", filters);

		Console.WriteLine (customer.ToString());
	}
Exemplo n.º 41
0
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable payment = mp.post("/v1/payments", "{"+
			"\"transaction_amount\": 100,"+
			"\"description\": \"Title of what you are paying for\","+
			"\"payment_method_id\": \"TICKET_PAYMENT_METHOD_ID\","+
			"\"payer\": {"+
				"\"email\": \"[email protected]\""+
			"}"+
		"}");
	}
        protected void Button1_Click1(object sender, EventArgs e)
        {
            MP m = new MP("5963566471355778", "iw3YTvnu7oTT5pQFzuww5SBgvfP9or3X");

            for (int i = 0; i < 100; i++)
            {

                JObject teste = RetornaMovimentos(m, (i*10));
                InserirMOvimentos(teste);

            }
        }
Exemplo n.º 43
0
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Dictionary<String, String> filters = new Dictionary<String, String> ();
		filters.Add("email", "your.payer@email");

		Hashtable saved_customer = mp.get ("/v1/customers/search", filters);
		Integer customer_id = saved_customer["response"]["id"];

		Hashtable card = mp.post ("/v1/customers/"+customer_id+"/cards", "{\"token\": \"ff8080814c11e237014c1ff593b57b4d\"}");

		Console.WriteLine (card.ToString());
	}
Exemplo n.º 44
0
    public static void Main()
    {
        MP mp = new MP("ACCESS_TOKEN");

        Hashtable payment = mp.post("/v1/payments", "{"+
            "'transaction_amount': 100,"+
            "'description': 'Title of what you are paying for',"+
            "'payment_method_id': 'TICKET_PAYMENT_METHOD_ID',"+
            "'payer': {"+
                "'email': '*****@*****.**'"+
            "}"+
        "}");
    }
Exemplo n.º 45
0
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable payment = mp.post("/v1/payments", "{"+
			"\"transaction_amount\": 100,"+
			"\"token\": \"ff8080814c11e237014c1ff593b57b4d\","+
			"\"description\": \"Title of what you are paying for\","+
			"\"installments\": 1,"+
			"\"payer\": {"+
				"\"id\": \"12345678\""+
			"}"+
		"}");
	}
Exemplo n.º 46
0
    public static void Main()
    {
        MP mp = new MP("ACCESS_TOKEN");

        Hashtable payment = mp.post("/v1/payments", "{"+
            "'transaction_amount': 100,"+
            "'token': 'ff8080814c11e237014c1ff593b57b4d',"+
            "'description': 'Title of what you are paying for',"+
            "'installments': 1,"+
            "'payer': {"+
                "'id': '12345678'"+
            "}"+
        "}");
    }
Exemplo n.º 47
0
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable payment = mp.post("/v1/payments", "{"+
			"\"transaction_amount\": 100,"+
			"\"token\": \"ff8080814c11e237014c1ff593b57b4d\","+
			"\"description\": \"Title of what you are paying for\","+
			"\"installments\": 1,"+
			"\"payment_method_id\": \"visa\","+
			"\"payer\": {"+
				"\"email\": \"[email protected]\""+
			"}"+
		"}");
	}
Exemplo n.º 48
0
	public static void Main () {
		MP mp = new MP("USER_AT");

		Hashtable payment = mp.post("/v1/payments", "{"+
			"\"transaction_amount\": 100,"+
			"\"token\": \"ff8080814c11e237014c1ff593b57b4d\","+
			"\"description\": \"Title of what you are paying for\","+
			"\"installments\": 1,"+
			"\"payer\": {"+
				"\"id\": \"12345678\""+
			"},"+
			"\"payment_method_id\": \"visa\","+
			"\"application_fee\": 2.56"+
		"}");
	}
Exemplo n.º 49
0
    public static void Main()
    {
        MP mp = new MP("ACCESS_TOKEN");

        Hashtable payment = mp.post("/v1/payments", "{"+
            "'transaction_amount': 100,"+
            "'token': 'ff8080814c11e237014c1ff593b57b4d',"+
            "'description': 'Title of what you are paying for',"+
            "'installments': 1,"+
            "'payment_method_id': 'visa',"+
            "'payer': {"+
                "'email': '*****@*****.**'"+
            "}"+
        "}");
    }
Exemplo n.º 50
0
    public static void Main()
    {
        MP mp = new MP("USER_AT");

        Hashtable payment = mp.post("/v1/payments", "{"+
            "'transaction_amount': 100,"+
            "'token': 'ff8080814c11e237014c1ff593b57b4d',"+
            "'description': 'Title of what you are paying for',"+
            "'installments': 1,"+
            "'payer': {"+
                "'id': '12345678'"+
            "},"+
            "'payment_method_id': 'visa',"+
            "'application_fee': 2.56"+
        "}");
    }
Exemplo n.º 51
0
        public ICell Develop(NeuronType neurontype, double threshold = -50, double initpotential = -60, double restpotential = -60, double r = 5, double c = 2, double resetpotential = -60, double refractoryperiod = 1)
        {
            INeuron neuron = null;
            switch (neurontype)
            {
                case NeuronType.MP:
                    neuron = new MP(threshold, initpotential);
                    break;
                case NeuronType.LI:
                    neuron = new LI(threshold, initpotential, r, c, restpotential);
                    break;
                case NeuronType.IF:
                    neuron = new IF(threshold, resetpotential, refractoryperiod, initpotential, r, c, restpotential);
                    break;
            }

            return Develop(neuron);
        }
Exemplo n.º 52
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MP mp = new MP("7071654091217780", "F4SUQfv2CA4YUvPj0VsFROGywMkcYvyC");

            mp.sandboxMode(false); // cambiar por mp.sandboxMode(false);
            string Nombre_de_archivo = Request["id"].ToString();

            JObject payment_info = mp.getPaymentInfo(Nombre_de_archivo);

            if (Nombre_de_archivo.Length == 9) // trato de capturar la respuesta y sacarla del juego enviada desde MP
            {
                Response.Write(payment_info["response"]);
                return;
            }
            else // trato de capturar la primera respuesta y trabajarla
            {

                //Preparando para enviar al correo electrónico
                MailMessage correo = new MailMessage();
                correo.From = new MailAddress("*****@*****.**");
                correo.To.Add("*****@*****.**");

                SmtpClient smtp = new SmtpClient("smtp.gmail.com");
                smtp.Port = 587;

                smtp.Credentials = new NetworkCredential("*****@*****.**", "qsoiqzuliwweyeog");

                smtp.EnableSsl = true;

                string cuerpo = "";

                string valorar = "";

                string mensaje = payment_info["response"].ToString();

                string reemplazo_llave_abierto = mensaje.Replace("{", "");
                string reemplazo_llave_cerrado = reemplazo_llave_abierto.Replace("}", "");
                string reemplazo_comillas = reemplazo_llave_cerrado.Replace("\"", "");
                string reemplazo_espacios = reemplazo_comillas.Replace(" ", "");

                string[] descomponer = reemplazo_comillas.Split(',');

                string[] Archivo = reemplazo_espacios.Split(':');

                string[] lista = Archivo[3].Split(',');

                for (int i = 0; i <= descomponer.Length - 1; i++)
                {

                    string linea = descomponer[i];

                    string[] dividir = linea.Split(':');

                    string[] temporal = new string[3];

                    if (dividir != null)
                    {

                        Array.Copy(dividir, temporal, Math.Min(dividir.Length, temporal.Length));

                    }

                    dividir = temporal;

                    cuerpo = cuerpo + dividir[0] + ":\t" + dividir[1] + ":\t" + dividir[2] + "\n";

                    if (i == 3)
                    {
                        valorar = temporal[2];
                    }

                }

                try
                {

                    if (valorar == null) // no confirmado el pago
                    {
                        correo.Subject = "NO Confirmado MercadoPago - DUDA - " + DateTime.Now;
                        smtp.Send("*****@*****.**", "*****@*****.**", correo.Subject, "MercadoPago no aprovó: " + Nombre_de_archivo + "\n" + cuerpo);

                        StreamWriter web = File.CreateText(Server.MapPath("~/desaprovado/" + Nombre_de_archivo + ".html"));

                        web.Write(reemplazo_comillas);

                        web.Flush();
                        web.Close();
                    }
                    else  // confirmado el pago
                    {
                        correo.Subject = "Confirmacion MercadoPago - Bien - " + DateTime.Now;
                        smtp.Send("*****@*****.**", "*****@*****.**", correo.Subject, "MercadoPago está OK: " + Nombre_de_archivo + "\n" + cuerpo);

                        StreamWriter web = File.CreateText(Server.MapPath("~/OK/" + Nombre_de_archivo + ".html"));

                        web.Write(reemplazo_comillas);

                        web.Flush();
                        web.Close();

                    }

                }
                catch (Exception)
                {

                    return;

                }

            }
        }
Exemplo n.º 53
0
	public static void Main () {
		MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");

		mp.refundPayment(":ID");
	}
        private JObject RetornaMovimentos(MP m, Int32 offset)
        {
            // Sets the filters you want
            Dictionary<String, String> filters = new Dictionary<String, String>();
            filters.Add("site_id", "MLB"); // Argentina: MLA; Brasil: MLB

            return m.searchPayment(filters, offset, 0);
        }
	public static void Main () {
		MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");

		mp.put("/preapproval/:ID", "{\"auto_recurring\": {\"transaction_amount\": NEW_AMOUNT}}");
	}
Exemplo n.º 56
0
	public static void Main () {
		MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");

		mp.cancelPreapprovalPayment(":ID");
	}
Exemplo n.º 57
0
	public static void Main () {
		MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");

		mp.put("/preapproval/:ID", "{\"status\": \"paused\"}");
	}
        private void guardardatos()
        {
            DataTable dtFormaPago = new DataTable();
            DataSet dsFormaPago = new DataSet();

            DataTable dtFactura = new DataTable();
            DataSet dsFactura = new DataSet();

            DataSet dsViajeros;
            DataSet dsOtraInfo;
            DataSet dsInfoEmergencia;

            DataSet ds = new DataSet();

            DataSet dsProducto;
            DataSet dsProveedor;
            DataSet dsPrecioPesos;
            DataSet dsPrecioDolar;
            DataSet dsCantidad;
            DataSet dsDatosViaje;

            dsViajeros = (DataSet)Session["Viajeros"];
            dsOtraInfo = (DataSet)Session["OtraInfoViajeros"];
            dsInfoEmergencia = (DataSet)Session["InfoEmergencia"];
            dsFormaPago = (DataSet)Session["InfoFormasdePago"];
            dsFactura = (DataSet)Session["InfoFactura"];
            dsDatosViaje = (DataSet)Session["DatosViaje"];

            dsProducto = (DataSet)Session["Productos"];
            dsProveedor = (DataSet)Session["Proveedor"];
            dsPrecioPesos = (DataSet)Session["PrecioPesos"];
            dsPrecioDolar = (DataSet)Session["PrecioDolar"];
            dsCantidad = (DataSet)Session["Cantidad"];

            String opciones = "";
            String[] Datos;
            int EsProductoAdicional = 0;
            String IdOperacionRetorno = "";

            SqlDataAdapter adapter;

            try
            {

                MP mp = new MP("3592982235689583", "iwzO6CMeOH6gA0dMYnCtvZZo7L6aUYO3");

                mp.sandboxMode(true);

                Dictionary<String, String> filters = new Dictionary<String, String>();

                filters.Add("status", "success");

                Hashtable searchResult = mp.searchPayment(filters);

                ////Hashtable payment_info = mp.getPaymentInfo(Request["id"]);

                ////if ((int)payment_info["status"] == 200){
                ////    Response.Write(payment_info["response"]);
                ////}

                Hashtable payment = (Hashtable)searchResult["response"];

                ArrayList collection = (ArrayList)payment["results"];

                Hashtable items = (Hashtable)collection[0];

                Hashtable item = (Hashtable)items["collection"];

                opciones = Request.QueryString["op"];
                Datos = opciones.Split('_');

                Session.Remove("Viajeros");
                Session.Remove("OtraInfoViajeros");
                Session.Remove("InfoEmergencia");
                Session.Remove("InfoFormasdePago");
                Session.Remove("InfoFactura");
                Session.Remove("DatosViaje");

                Session.Remove("Productos");
                Session.Remove("Proveedor");
                Session.Remove("PrecioPesos");
                Session.Remove("PrecioDolar");
                Session.Remove("Cantidad");

                try
                {
                    if ((dsFactura != null) && (dsFactura.Tables[0].Rows.Count > 0))
                    {
                        if ((dsFormaPago != null) && (dsFormaPago.Tables[0].Rows.Count > 0))
                        {

                            System.Data.SqlClient.SqlConnection conn;
                            conn = new System.Data.SqlClient.SqlConnection();
                            conn.ConnectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;

                            conn.Open();
                            SqlCommand command = new SqlCommand("spOperaciones", conn);
                            command.CommandType = CommandType.StoredProcedure;

                            SqlParameter paramCodRetorno = new SqlParameter("pCodigo", SqlDbType.Int);
                            paramCodRetorno.Direction = ParameterDirection.Output;
                            command.Parameters.Add(paramCodRetorno);
                            command.Parameters.AddWithValue("Facturacion_CodSituacionFiscal", Convert.ToInt32(dsFactura.Tables[0].Rows[0]["SituacionFiscal"].ToString()));
                            command.Parameters.AddWithValue("Facturacion_NombreoRazonSocial", dsFactura.Tables[0].Rows[0]["RazonSocial"].ToString());
                            command.Parameters.AddWithValue("Facturacion_CUILCUIT", dsFactura.Tables[0].Rows[0]["CUILCUIT"].ToString());
                            command.Parameters.AddWithValue("Facturacion_CodigoPostal", dsFactura.Tables[0].Rows[0]["CodigoPostal"].ToString());
                            command.Parameters.AddWithValue("Facturacion_Domicilio", dsFactura.Tables[0].Rows[0]["Domicilio"].ToString());
                            command.Parameters.AddWithValue("Facturacion_Ciudad", dsFactura.Tables[0].Rows[0]["CiudadDomicilio"].ToString());
                            command.Parameters.AddWithValue("Facturacion_IdPais", Convert.ToInt32(dsFactura.Tables[0].Rows[0]["PaisDomicilio"].ToString()));
                            command.Parameters.AddWithValue("Facturacion_TipoTelefono", Convert.ToInt32(dsFactura.Tables[0].Rows[0]["TipoTelefono"].ToString()));
                            command.Parameters.AddWithValue("Facturacion_IdPaisTelefono", Convert.ToInt32(dsFactura.Tables[0].Rows[0]["PaisTelefono"].ToString()));
                            command.Parameters.AddWithValue("Facturacion_CodArea", dsFactura.Tables[0].Rows[0]["CodAreaCiudad"].ToString());
                            command.Parameters.AddWithValue("Facturacion_NroTelefono", dsFactura.Tables[0].Rows[0]["NroLocal"].ToString());
                            command.Parameters.AddWithValue("IdOrigen", Convert.ToInt32(dsDatosViaje.Tables[0].Rows[0]["IdOrigen"].ToString()));
                            command.Parameters.AddWithValue("IdDestino", Convert.ToInt32(dsDatosViaje.Tables[0].Rows[0]["IdDestino"].ToString()));
                            command.Parameters.AddWithValue("IdProducto", Convert.ToInt32(dsDatosViaje.Tables[0].Rows[0]["IdProducto"].ToString()));
                            command.Parameters.AddWithValue("FechaPartida", Datos[0].ToString());
                            command.Parameters.AddWithValue("FechaRegreso", Datos[1].ToString());
                            command.Parameters.AddWithValue("ImporteTarifaPesos", Convert.ToDecimal(Datos[2].ToString()));
                            command.Parameters.AddWithValue("ImporteTarifaDolar", Convert.ToDecimal(Datos[3].ToString()));
                            command.Parameters.AddWithValue("IdFormadePago", Convert.ToInt32(dsFormaPago.Tables[0].Rows[0]["TipoPago"].ToString()));
                            command.Parameters.AddWithValue("IdBancoEmisor", 0);
                            command.Parameters.AddWithValue("IdTarjeta", 0);
                            command.Parameters.AddWithValue("NroTarjeta", 0);
                            command.Parameters.AddWithValue("VtoDia", 0);
                            command.Parameters.AddWithValue("VtoAnio", 0);
                            command.Parameters.AddWithValue("CodigoSeguridad", 0);
                            command.Parameters.AddWithValue("NroCuotas", 0);
                            //command.Parameters.AddWithValue("Id_OperacionMercadoPago", Convert.ToInt32(item["id"]));
                            command.Parameters.AddWithValue("Id_OperacionMercadoPago", 1);
                            command.Parameters.AddWithValue("Estado", 3);
                            command.Parameters.AddWithValue("TipoTelefono", Convert.ToInt32(dsFormaPago.Tables[0].Rows[0]["TipoTelefono"].ToString()));
                            command.Parameters.AddWithValue("CodArea", dsFormaPago.Tables[0].Rows[0]["CodAreaTelefono"].ToString());
                            command.Parameters.AddWithValue("NroTelefono", dsFormaPago.Tables[0].Rows[0]["NroTelefono"].ToString());
                            command.Parameters.AddWithValue("IdPais", Convert.ToInt32(dsFormaPago.Tables[0].Rows[0]["PaisTelefono"].ToString()));
                            command.ExecuteNonQuery();
                            adapter = new SqlDataAdapter(command);
                            conn.Close();
                            IdOperacionRetorno = paramCodRetorno.SqlValue.ToString();
                            lblOperacion.Text = IdOperacionRetorno;

                            if ((dsViajeros != null) && (dsViajeros.Tables[0].Rows.Count > 0))
                            {

                                //if ((dsOtraInfo != null) && (dsOtraInfo.Tables[0].Rows.Count > 0))
                                //{

                                    for (int y = 0; y < dsViajeros.Tables[0].Rows.Count; y++)
                                    {

                                        System.Data.SqlClient.SqlConnection conn1;
                                        conn1 = new System.Data.SqlClient.SqlConnection();
                                        conn1.ConnectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;

                                        conn1.Open();
                                        SqlCommand command1 = new SqlCommand("spPasajeros", conn1);
                                        command1.CommandType = CommandType.StoredProcedure;

                                        SqlParameter paramCodRetorno1 = new SqlParameter("pCodigo", SqlDbType.Int);
                                        paramCodRetorno1.Direction = ParameterDirection.Output;
                                        command1.Parameters.Add(paramCodRetorno1);
                                        command1.Parameters.AddWithValue("Nombre", dsViajeros.Tables[0].Rows[y]["Nombre"].ToString());
                                        command1.Parameters.AddWithValue("Apellido", dsViajeros.Tables[0].Rows[y]["Apellido"].ToString());
                                        command1.Parameters.AddWithValue("FechaNac", dsViajeros.Tables[0].Rows[y]["Fecha"].ToString());
                                        command1.Parameters.AddWithValue("Edad", Convert.ToInt32(dsViajeros.Tables[0].Rows[y]["Edad"].ToString()));
                                        command1.Parameters.AddWithValue("TipoDocu", 1);
                                        command1.Parameters.AddWithValue("NroDocumento", Convert.ToInt32(dsViajeros.Tables[0].Rows[y]["DNI"].ToString()));
                                        command1.Parameters.AddWithValue("IdPaisResidencia", Convert.ToInt32(dsViajeros.Tables[0].Rows[y]["Pais"].ToString()));
                                        command1.Parameters.AddWithValue("Ciudad", dsViajeros.Tables[0].Rows[y]["Ciudad"].ToString());
                                        command1.Parameters.AddWithValue("Domicilio", "");
                                        command1.Parameters.AddWithValue("TipoTelefono", 0);
                                        command1.Parameters.AddWithValue("CodArea", "");
                                        command1.Parameters.AddWithValue("Telefono", "");
                                        command1.Parameters.AddWithValue("Email", dsViajeros.Tables[0].Rows[y]["Email"].ToString());
                                        command1.Parameters.AddWithValue("ContactoEmergencia_Apellido", dsInfoEmergencia.Tables[0].Rows[0]["Apellido"].ToString());
                                        command1.Parameters.AddWithValue("ContactoEmergencia_Nombre", dsInfoEmergencia.Tables[0].Rows[0]["Nombre"].ToString());
                                        command1.Parameters.AddWithValue("ContactoEmergencia_TipoTelefono", Convert.ToInt32(dsInfoEmergencia.Tables[0].Rows[0]["TipoTelefono"].ToString()));
                                        command1.Parameters.AddWithValue("ContactoEmergencia_CodArea", dsInfoEmergencia.Tables[0].Rows[0]["CodCiudad"].ToString());
                                        command1.Parameters.AddWithValue("ContactoEmergencia_Telefono", dsInfoEmergencia.Tables[0].Rows[0]["NumeroLocal"].ToString());
                                        command1.Parameters.AddWithValue("ContactoEmergencia_Email", dsInfoEmergencia.Tables[0].Rows[0]["Email"].ToString());
                                        command1.Parameters.AddWithValue("ContactoEmergencia_IdPaisResidencia", Convert.ToInt32(dsInfoEmergencia.Tables[0].Rows[0]["Pais"].ToString()));
                                        command1.Parameters.AddWithValue("ContactoEmergencia_Ciudad", "");
                                        command1.Parameters.AddWithValue("InfoContacto_Apellido", dsOtraInfo.Tables[0].Rows[0]["Apellido"].ToString());
                                        command1.Parameters.AddWithValue("InfoContacto_Nombre", dsOtraInfo.Tables[0].Rows[0]["Nombre"].ToString());
                                        command1.Parameters.AddWithValue("InfoContacto_TipoTelefono", Convert.ToInt32(dsOtraInfo.Tables[0].Rows[0]["TipoTelefono"].ToString()));
                                        command1.Parameters.AddWithValue("InfoContacto_CodArea", dsOtraInfo.Tables[0].Rows[0]["CodCiudad"].ToString());
                                        command1.Parameters.AddWithValue("InfoContacto_Telefono", dsOtraInfo.Tables[0].Rows[0]["NumeroLocal"].ToString());
                                        command1.Parameters.AddWithValue("InfoContacto_Email", dsOtraInfo.Tables[0].Rows[0]["Email"].ToString());
                                        command1.Parameters.AddWithValue("InfoContacto_IdPaisResidencia", Convert.ToInt32(dsOtraInfo.Tables[0].Rows[0]["Pais"].ToString()));
                                        command1.Parameters.AddWithValue("InfoContacto_Ciudad", "");
                                        command1.ExecuteNonQuery();
                                        adapter = new SqlDataAdapter(command1);
                                        conn1.Close();

                                        if (paramCodRetorno1.SqlValue.ToString() != null)
                                        {
                                            System.Data.SqlClient.SqlConnection conn2;
                                            conn2 = new System.Data.SqlClient.SqlConnection();
                                            conn2.ConnectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;

                                            conn2.Open();
                                            SqlCommand command2 = new SqlCommand("spOperacionesPasajeros", conn2);
                                            command2.CommandType = CommandType.StoredProcedure;
                                            command2.Parameters.AddWithValue("IdOperacion", Convert.ToInt32(paramCodRetorno.SqlValue.ToString()));
                                            command2.Parameters.AddWithValue("IdPasajero", Convert.ToInt32(paramCodRetorno1.SqlValue.ToString()));
                                            command2.ExecuteNonQuery();
                                            adapter = new SqlDataAdapter(command2);
                                            adapter.Fill(ds);
                                            conn2.Close();
                                            ds.Dispose();
                                        }
                                    }
                                //}
                            }

                            if ((dsProducto != null) && (dsProducto.Tables[0].Rows.Count > 0))
                            {
                                for (int z = 0; z < dsProducto.Tables[0].Rows.Count; z++)
                                {

                                    System.Data.SqlClient.SqlConnection conn3;
                                    conn3 = new System.Data.SqlClient.SqlConnection();
                                    conn3.ConnectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;

                                    conn3.Open();
                                    SqlCommand command3 = new SqlCommand("spOperacionesProductosAdicionales", conn3);
                                    command3.CommandType = CommandType.StoredProcedure;
                                    command3.Parameters.AddWithValue("IdOperacion", Convert.ToInt32(paramCodRetorno.SqlValue.ToString()));
                                    command3.Parameters.AddWithValue("IdProducto", Convert.ToInt32(dsProducto.Tables[0].Rows[z]["IdProductos"].ToString()));
                                    command3.Parameters.AddWithValue("IdProveedor", Convert.ToInt32(dsProveedor.Tables[0].Rows[z]["IdProveedor"].ToString()));
                                    command3.Parameters.AddWithValue("ImporteTarifa", Convert.ToDecimal(dsPrecioPesos.Tables[0].Rows[z]["PrecioPesos"].ToString()));
                                    command3.Parameters.AddWithValue("IdMoneda", Convert.ToInt32(1));
                                    command3.Parameters.AddWithValue("Cantidad", Convert.ToInt32(dsCantidad.Tables[0].Rows[z]["Cantidad"].ToString()));
                                    command3.ExecuteNonQuery();
                                    adapter = new SqlDataAdapter(command3);
                                    adapter.Fill(dsProducto);
                                    conn3.Close();
                                    dsProducto.Dispose();
                                }

                            }
                        }
                    }

                    cargarvinculos(dsViajeros, IdOperacionRetorno);

                    dsFormaPago.Dispose();
                    dsFactura.Dispose();
                    dsViajeros.Dispose();
                    dsOtraInfo.Dispose();
                    dsInfoEmergencia.Dispose();
                    dsProducto.Dispose();
                    dsProveedor.Dispose();
                    dsCantidad.Dispose();
                    dsPrecioPesos.Dispose();
                    dsPrecioDolar.Dispose();
                    dsDatosViaje.Dispose();
                    muestrareporte(IdOperacionRetorno);
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
                finally
                {
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            finally
            {
            }
        }
Exemplo n.º 59
0
 public ActionResult Index(MP mp)
 {
     return View(mp);
 }