protected void cboModalPedidoTipoPedido_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int     idUser     = (int)Session["Usuario"];
                Cliente activeUser = cDAL.FindByUser(idUser);

                if (cboModalPedidoTipoPedido.SelectedItem.Text == "Delivery")
                {
                    txtModalPedidoDireccion.Text = string.IsNullOrEmpty(activeUser.Direccion) ? "" : activeUser.Direccion;
                    if (activeUser.Comuna.HasValue)
                    {
                        SetCbosFromCliente(cODAL.Find(activeUser.Comuna.Value));
                    }
                    divModalPedidoDireccion.Visible = true;
                }
                else
                {
                    divModalPedidoDireccion.Visible = false;
                }
            }
            catch (Exception ex)
            {
                UserModalPedidoMessage(ex.Message, "danger");
            }
        }
Пример #2
0
 protected void btnModalDireccionAceptar_Click(object sender, EventArgs e)
 {
     try
     {
         int    idComuna = int.Parse(cboComuna.SelectedValue);
         Comuna comuna   = cODAL.Find(idComuna);
         if (cboComuna.SelectedValue == "0")
         {
             throw new Exception("Seleccione una comuna");
         }
         if (!comuna.ValorEnvio.HasValue)
         {
             throw new Exception("De momento el delivery solo se hace dentro de la Provincia de Santiago");
         }
         if (txtModalPedidoDireccion.Text == "")
         {
             throw new Exception("Debe ingresar la dirección");
         }
         CloseModalDireccion();
     }
     catch (Exception ex)
     {
         UserMessageModalDireccion(ex.Message, "danger");
     }
 }
Пример #3
0
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                GridViewRow row = e.Row;

                Label label = (Label)row.FindControl("lblComuna");
                label.Text = label.Text != "" ? cDAL.Find(Convert.ToInt32(label.Text)).Nombre : "Sin Comuna";

                label      = (Label)row.FindControl("lblFechaEmpieza");
                label.Text = DateTime.Parse(label.Text).ToString("yyyy-MM-dd");
            }
        }
Пример #4
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName)
                {
                case "Agregar":
                    int   index  = Convert.ToInt32(e.CommandArgument);
                    Label codigo = (Label)GridView1.Rows[index].FindControl("lblCodigo");

                    Trabajador obj = tDAL.Find(Convert.ToInt32(codigo.Text));
                    Usuario    us  = uDAL.Find((int)obj.IdUsuario);
                    txtApellidoMat.Text = obj.ApellidoMat;
                    txtApellidoPat.Text = obj.ApellidoPat;
                    if (obj.Comuna.HasValue)
                    {
                        Comuna    com  = cDAL.Find(obj.Comuna.Value);
                        Provincia prov = pDAL.Find(com.IdProvincia.Value);
                        SetCboRegion(prov.IdRegion.Value);
                        SetCboProvincia(prov.IdRegion.Value, prov.IdProvincia);
                        SetCboComuna(com.IdProvincia.Value, com.IdComuna);
                    }
                    else
                    {
                        InitCbos();
                    }
                    cboTipoUsuario.SelectedValue = us.IdTipoUsuario == null ? "0" : us.IdTipoUsuario.ToString();
                    txtDireccion.Text            = obj.Direccion;
                    txtTelefono.Text             = obj.Telefono.ToString();
                    txtFechNac.Text      = obj.FechaNacimiento.HasValue ? obj.FechaNacimiento.Value.ToString("dd/MM/yyyy") : "";
                    txtNombre.Text       = obj.Nombres;
                    txtRut.Text          = obj.Rut;
                    txtSueldo.Text       = obj.Sueldo + "";
                    chkVigencia.Checked  = obj.Estado == 1 ? true : false;
                    chkVigencia.Enabled  = true;
                    btnAgregar.Visible   = false;
                    btnModificar.Visible = true;
                    divUsuario.Visible   = false;

                    ViewState["Codigo"] = Convert.ToInt32(codigo.Text);
                    break;

                case "Default":
                    break;
                }
            }
            catch (Exception ex)
            {
                UserMessage(ex.Message, "danger");
            }
        }
Пример #5
0
 protected void cboComuna_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         Comuna obj = cDAL.Find(Convert.ToInt32(cboComuna.SelectedValue));
         if (obj != null)
         {
             txtValor.Text = obj.ValorEnvio.ToString();
         }
         else
         {
             txtValor.Text = "";
         }
         divValorComuna.Visible    = true;
         divValorProvincia.Visible = false;
     }
     catch (Exception ex)
     {
         UserMessage(ex.Message, "danger");
     }
 }