Пример #1
0
        protected void gvActos_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Acto a = new Acto();

            Label        txId            = (Label)gvActos.Rows[e.RowIndex].FindControl("lbEditClave");
            TextBox      txClaveActo     = (TextBox)gvActos.Rows[e.RowIndex].FindControl("txEditClaveActo");
            TextBox      txClaveIngresos = (TextBox)gvActos.Rows[e.RowIndex].FindControl("txEditClaveIngresos");
            TextBox      txNombre        = (TextBox)gvActos.Rows[e.RowIndex].FindControl("txEditNombre");
            TextBox      txCuenta        = (TextBox)gvActos.Rows[e.RowIndex].FindControl("txEditCuenta");
            DropDownList txArea          = (DropDownList)gvActos.Rows[e.RowIndex].FindControl("ddlEditArea");
            CheckBoxList cbsecciones     = (CheckBoxList)gvActos.FooterRow.FindControl("cblSeccion");
            String       secciones       = "";

            foreach (ListItem item in cbsecciones.Items)
            {
                if (item.Selected)
                {
                    secciones += item.Value + ";";
                }
            }

            String Resultado = a.Actualizar(int.Parse(txId.Text), int.Parse(txClaveActo.Text), txClaveIngresos.Text, txNombre.Text.ToUpper(), txCuenta.Text, int.Parse(txArea.SelectedValue), secciones);

            gvActos.EditIndex  = -1;
            gvActos.DataSource = main.Actos.Catalogo();
            gvActos.DataBind();
            if (Resultado.Equals("OK"))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Datos actualizados Correctamente')", true);
            }
        }
Пример #2
0
        protected void gvActos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("AGREGAR"))
            {
                Acto a = new Acto();

                TextBox      txtClave    = (TextBox)gvActos.FooterRow.FindControl("txClaveActo");
                TextBox      txtClaveI   = (TextBox)gvActos.FooterRow.FindControl("txClaveIngresos");
                TextBox      txtNombre   = (TextBox)gvActos.FooterRow.FindControl("txNombreActo");
                TextBox      txtCuenta   = (TextBox)gvActos.FooterRow.FindControl("txCuenta");
                DropDownList txArea      = (DropDownList)gvActos.FooterRow.FindControl("ddlEditArea");
                CheckBoxList cbsecciones = (CheckBoxList)gvActos.FooterRow.FindControl("cblSeccion");
                String       secciones   = "";
                foreach (ListItem item in cbsecciones.Items)
                {
                    if (item.Selected)
                    {
                        secciones += item.Value + ";";
                    }
                }

                String Resultado = a.GuardarNuevo(int.Parse(txtClave.Text), txtClaveI.Text, txtNombre.Text.ToUpper(), txtCuenta.Text, int.Parse(txArea.SelectedValue), secciones);

                gvActos.DataSource = main.Actos.Catalogo();
                gvActos.DataBind();
                if (Resultado.Equals("OK"))
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Datos agregados Correctamente')", true);
                }
            }
        }
    private string RenderActo(Acto acto)
    {
        var actoChecked = acto.Ofertado ? " checked=\"checked\"" : string.Empty;

        return(string.Format(
                   CultureInfo.InvariantCulture,
                   @"<div class=""col col-xs-4"" style=""margin-bottom:8px;""><input class=""ckacto"" type=""checkbox"" {0} id=""{1}"">&nbsp;{2}</div>",
                   actoChecked,
                   acto.Id,
                   acto.Description));
    }
Пример #4
0
        protected void radbMovimientos_SelectedIndexChanged(object sender, EventArgs e)
        {
            formularioRegistro.Visible = false;
            string[] datos = Session["IDPRELACION"].ToString().Split(';');
            if (datos.Length == 2)
            {
                listamovimientos = Prelacion.ObtenerMovimientosPrelacion(int.Parse(datos[0]), "REVISION");
            }
            else
            {
                listamovimientos = Prelacion.ObtenerMovimientosPrelacion(int.Parse(Session["IDPRELACION"].ToString()), "");
            }

            foreach (Movimientos var in listamovimientos)
            {
                if (radbMovimientos.SelectedValue.Equals(var.ClavePrelacionActo.ToString()))
                {
                    ddlSeccion.Visible = true;
                    ddlSeccion.Items.Clear();
                    ddlSeccion.Items.Add("Elige una Seccion");
                    string[] words = var.Acto.Seccion.ToString().Split(';');
                    foreach (string word in words)
                    {
                        ListItem l    = new ListItem();
                        String   secc = Acto.ObtenerSeccion(word);
                        l.Text  = secc;
                        l.Value = word;
                        ddlSeccion.Items.Add(l);
                    }
                    ddlSeccion.Items.RemoveAt(ddlSeccion.Items.Count - 1);
                    if (ddlSeccion.Items.Count > 2)
                    {
                        ddlSeccion.Visible = true;
                    }
                    else
                    {
                        ddlSeccion.Visible = false;
                    }
                }
            }
        }
Пример #5
0
        protected void btAgregarMovimiento_Click(object sender, EventArgs e)
        {
            DataTable Temporal = (DataTable)Session["tablaActos"];

            if (!ddlActos.SelectedValue.ToString().Equals("0") && !txValorBase.Text.Equals("0.00"))
            {
                Parametro par  = new Parametro();
                Acto      acto = new Acto();
                Tarifa    tar  = acto.ObtenerTarifa(int.Parse(ddlActos.SelectedValue.ToString()));

                //Llenar el grid con los datos del movimiento
                if (Temporal.Rows[0][0].ToString().Equals(""))
                {
                    Temporal.Rows.Clear();
                }

                int repetir = 1;

                if (txRepetir.Text.Length > 0)
                {
                    repetir = int.Parse(txRepetir.Text);
                }

                for (int i = 0; i < repetir; i++)
                {
                    DataRow dr = Temporal.NewRow();
                    dr["Id"]          = Temporal.Rows.Count + 1;
                    dr["Acto"]        = ddlActos.SelectedValue.ToString();
                    dr["Movimiento"]  = ddlMovimientos.SelectedValue.ToString();
                    dr["Descripcion"] = ddlMovimientos.SelectedItem.Text.ToString();
                    dr["ValorBase"]   = txValorBase.Text;

                    //calcular el costo del movimiento
                    String cant = "";
                    if (!(tar.SmFijo.ToString()).Equals("0"))
                    {
                        float salMin = float.Parse(par.ObtenerSalario());
                        cant = ((float.Parse(tar.SmFijo.ToString())) * salMin).ToString("0.00");
                    }
                    else
                    {
                        float valorC = (tar.Porcentaje * float.Parse(txValorBase.Text)) / 100;
                        float salMax = tar.SmMaximo * (float.Parse(par.ObtenerSalario()));
                        if (valorC > salMax)
                        {
                            cant = salMax.ToString("0.00");
                        }
                        else
                        {
                            cant = valorC.ToString("0.00");
                        }
                    }
                    dr["Cantidad"]  = cant;
                    dr["Descuento"] = tar.Descuento.ToString();
                    dr["Subtotal"]  = (float.Parse(cant) - tar.Descuento).ToString("0.00");
                    Temporal.Rows.Add(dr);
                    Session["tablaActos"]    = Temporal;
                    gvMovimientos.DataSource = Temporal;
                    gvMovimientos.DataBind();
                }

                float total = 0;
                foreach (DataRow row in Temporal.Rows)
                {
                    total += float.Parse(row["Subtotal"].ToString());
                }
                txTotal.Text           = "$" + total.ToString("0.00");
                ddlActos.SelectedIndex = 0;
                ddlMovimientos.Items.Clear();
                ddlMovimientos.Items.Add("Listado de movimientos");
                ddlMovimientos.SelectedIndex = 0;
            }
        }
Пример #6
0
    private void GetActos()
    {
        var res                  = new StringBuilder("[");
        var resCombo             = new StringBuilder();
        var precios              = Acto.ByTarifa(this.TarifaId).OrderBy(a => a.EspecialidadName);
        var especialidadIdActual = string.Empty;
        var first                = true;

        foreach (var acto in precios)
        {
            var especialidadId = acto.EspecialidadName;
            if (especialidadId != especialidadIdActual)
            {
                if (especialidadIdActual != string.Empty)
                {
                    res.Append("]},");
                    res.Append(Environment.NewLine);
                }

                especialidadIdActual = especialidadId;
                first = true;
                res.AppendFormat(
                    CultureInfo.InvariantCulture,
                    @"{{""Id"":""{0}"",""Name"":""{1}"",""Actos"":[",
                    especialidadId,
                    especialidadId);
            }

            if (first)
            {
                first = false;
            }
            else
            {
                res.Append(",");
            }

            var amount     = "null";
            var percentage = "null";

            if (acto.Precio != null)
            {
                amount = string.Format("{0:####0.00}", acto.Precio).Replace(',', '.');
            }

            if (acto.Porcentage != null)
            {
                percentage = string.Format("{0:####0.00}", acto.Porcentage).Replace(',', '.');
            }

            res.AppendFormat(
                CultureInfo.InvariantCulture,
                @"{{""Id"":""{0}"",""Name"":""{1}"",""Amount"":{2},""Discount"":{3},""E"":""{5}"",""T"":""{4}""}}",
                acto.Id,
                SbrinnaCoreFramework.Tools.JsonCompliant(acto.Description),
                amount,
                percentage,
                SbrinnaCoreFramework.Tools.JsonCompliant(TarifaId),
                SbrinnaCoreFramework.Tools.JsonCompliant(especialidadId));

            resCombo.AppendFormat(
                CultureInfo.InvariantCulture,
                @"<option value=""{0}"">{1} - {2}</option>",
                acto.Id,
                acto.EspecialidadName,
                acto.Description);
        }

        if (especialidadIdActual != string.Empty)
        {
            res.Append("]}");
        }

        res.Append("]");
        this.Precios = res.ToString();
        this.CmbEspecialidadItems.Text = resCombo.ToString();
    }
        /// <summary>Log on application</summary>
        /// <param name="email">User email</param>
        /// <param name="password">User password</param>
        /// <param name="clientAddress">IP address from log on action</param>
        /// <returns>Result of action</returns>
        public static ActionResult ApplicationAccess(string email, string password, string clientAddress)
        {
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
            {
                return(ActionResult.NoAction);
            }

            var res    = ActionResult.NoAction;
            var result = new LogOnObject
            {
                Id                = string.Empty,
                UserName          = string.Empty,
                Result            = LogOnResult.NoUser,
                MustResetPassword = false
            };

            var binding = HttpContext.Current.Session["SForceConnection"] as SforceService;
            var query   = string.Format(
                CultureInfo.InvariantCulture,
                @"SELECT Id, name,nIF__c,usuario_ASPADLand__c,Password_ASPADLand__c FROM Account WHERE usuario_ASPADLand__c = '{0}'",
                email);

            var bindingResult = binding.query(query);
            var login         = false;

            if (bindingResult != null)
            {
                foreach (var r in bindingResult.records)
                {
                    Account ac = r as Account;
                    if (ac.Password_ASPADLand__c.Equals(password))
                    {
                        var actosCentro = Acto.ByCentro(ac.Usuario_ASPADLand__c);
                        var actos       = Acto.All;

                        foreach (var acto in actos)
                        {
                            foreach (var actoCentro in actosCentro)
                            {
                                if (actosCentro.Any(a => a.Id.Equals(acto.Id, StringComparison.OrdinalIgnoreCase)))
                                {
                                    acto.Ofertado = true;
                                    break;
                                }
                            }
                        }

                        login           = true;
                        result.Result   = LogOnResult.Ok;
                        result.Id       = ac.Id;
                        result.UserName = ac.Name;
                        HttpContext.Current.Session["User"]            = ApplicationUser.GetById(ac.Id);
                        HttpContext.Current.Session["Actos"]           = actosCentro;
                        HttpContext.Current.Session["Colectivos"]      = Colectivo.All;
                        HttpContext.Current.Session["ColectivosASPAD"] = Colectivo.AllASPAD;
                        break;
                    }
                }
            }

            if (!login)
            {
                result.Result = LogOnResult.Fail;
                // weke: LogOnFailed(result.Id);
            }

            // weke: TraceLogin(result, email, clientAddress);
            res.SetSuccess(result);
            return(res);
        }