protected void gdvTipoCambio_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            var obec  = ((BEParameters)Session["InitPar"]);
            var index = gdvTipoCambio.EditingRowVisibleIndex;

            //if(((List<BEAlmacen>)Session["oitw"])[index].Tiempo == "Existente")

            ((List <BETipoCambio>)Session["ortt"])[index].RateUSD = Convert.ToDecimal(e.NewValues["RateUSD"]);
            ((List <BETipoCambio>)Session["ortt"])[index].RateEUR = Convert.ToDecimal(e.NewValues["RateEUR"]);

            BETipoCambio tp = new BETipoCambio();

            tp.RateDate = Convert.ToDateTime(e.NewValues["RateDate"]);
            tp.RateUSD  = Convert.ToDecimal(e.NewValues["RateUSD"]);
            tp.RateEUR  = Convert.ToDecimal(e.NewValues["RateEUR"]);

            gdvTipoCambio.CancelEdit();
            e.Cancel = true;
            gdvTipoCambio.DataSource = ((List <BETipoCambio>)Session["ortt"]);
            gdvTipoCambio.DataBind();

            using (var obrd = new BRDocument())
            {
                obrd.SaveCurrencyDates(tp, ((BEParameters)Session["InitPar"]).objSapSbo);
                ((BEParameters)Session["InitPar"]).Rate    = tp.RateUSD;
                ((BEParameters)Session["InitPar"]).RateEur = tp.RateEUR;
                //Rate1 = tp.RateUSD;
            }
        }
Exemplo n.º 2
0
        private string SaveItem()
        {
            var obec = ((BEParameters)Session["InitPar"]);
            var obj  = new BETipoCambio();

            //obj.RateDate = Convert.ToDateTime(dteFecha.Text);
            //obj.UserSing = obec.CardName;

            //if(txtDolar.Text != "0.00")
            //{
            //    obj.CurrencyUSD = "USD";
            //    obj.RateUSD = Convert.ToDecimal(txtDolar.Text);
            //}
            //if (txtEuro.Text != "0.00")
            //{
            //    obj.CurrencyEUR = "EUR";
            //    obj.RateEUR = Convert.ToDecimal(txtDolar.Text);
            //}

            using (var obrd = new BRDocument())
            {
                obrd.SaveCurrencyDates(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
            }
            var _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : "OKBP";

            //Init_VarSessions();
            return(_err);
        }
        private string SaveItem()
        {
            var obec = ((BEParameters)Session["InitPar"]);
            var obj  = new BETipoCambio();

            using (var obrd = new BRDocument())
            {
                //obrd.SaveCurrencyDates(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
            }
            var _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : "OKBP";

            return(_err);
        }
        protected void gdvTipoCambio_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            var obec = ((BEParameters)Session["InitPar"]);

            ((List <BETipoCambio>)Session["ortt"]).Clear();
            if (e.Parameters.Contains("INIT"))
            {
                var spl      = e.Parameters.Split(':');
                var listdias = GetDates(Convert.ToInt32(spl[1]), Convert.ToInt32(spl[2]));
                var obep     = new BEParameters()
                {
                    Socied = obec.Socied,
                    mes    = Convert.ToInt32(spl[1]),
                    año    = Convert.ToInt32(spl[2]),
                };
                var obrd = new BRDocument();
                var olst = obrd.DXP_GET_TIPOCAMBIO(obep);

                listdias.ForEach(i => {
                    BETipoCambio tp = new BETipoCambio();
                    tp.RateDate     = i;
                    ((List <BETipoCambio>)Session["ortt"]).Add(tp);
                });
                olst.ForEach(item => {
                    ((List <BETipoCambio>)Session["ortt"]).Where(tp => tp.RateDate == item.RateDate).ToList().ForEach(x => {
                        if (item.Currency == "USD")
                        {
                            x.RateUSD = item.Rate;
                        }
                        else if (item.Currency == "EUR")
                        {
                            x.RateEUR = item.Rate;
                        }
                    });
                });
                gdvTipoCambio.DataSource = Session["ortt"];
                gdvTipoCambio.DataBind();
            }
        }