Beispiel #1
0
        private void getData()
        {
            switch (dllSearch.SelectedIndex)
            {
            case 0:
                // member name
                query = "it.FirstName +' '+ it.SecondName +' '+ it.LastName +' '+ it.FamilyName LIKE '%' + @name + '%' ";
                EntityDataSource1.WhereParameters.Clear();
                EntityDataSource1.WhereParameters.Add("name", tbSearch.Text);
                EntityDataSource1.WhereParameters[0].Type = TypeCode.String;

                break;

            case 1:
                // file id

                query = "it.ClientID = @id";
                EntityDataSource1.WhereParameters.Clear();
                EntityDataSource1.WhereParameters.Add("id", tbSearch.Text);
                EntityDataSource1.WhereParameters[0].Type = TypeCode.Int32;


                break;

            case 2:
                // admission date
                query = "it.RefferedDate = @date";
                EntityDataSource1.WhereParameters.Clear();
                EntityDataSource1.WhereParameters.Add("date", tbSearch.Text);
                EntityDataSource1.WhereParameters[0].Type = TypeCode.DateTime;
                break;

            case 3:
                //phone number
                query = "it.Phone = @phone";
                EntityDataSource1.WhereParameters.Clear();
                EntityDataSource1.WhereParameters.Add("phone", tbSearch.Text);
                EntityDataSource1.WhereParameters[0].Type = TypeCode.Int64;
                break;

            case 4:
                //result = club.getClinetsByID(tbSearch.Text);
                //ID number
                query = "it.IDNumber = @id";
                EntityDataSource1.WhereParameters.Clear();
                EntityDataSource1.WhereParameters.Add("id", tbSearch.Text);
                EntityDataSource1.WhereParameters[0].Type = TypeCode.Int64;
                break;
            }
            EntityDataSource1.Where = query;
            EntityDataSource1.DataBind();
            fvResult.DataBind();
        }
Beispiel #2
0
        protected void gvSubs_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblError.Visible = false;
            GridView row = (GridView)sender;
            int      id  = Convert.ToInt32(row.SelectedRow.Cells[5].Text);

            // get the data then show th panel
            using (ClubDBEntities club = new ClubDBEntities())
            {
                var result = club.getSubDetails(id);
                fvDetails.DataSource = result;
                fvDetails.DataBind();
                SubID = id;
                Where = "it.SubID = " + id;
                EntityDataSource1.Where = Where;
                EntityDataSource1.DataBind();
                gvVisits.DataBind();
                pnlSubDetails.Visible = true;
                pnlVisit.Visible      = false;

                Panel pnlInt = (Panel)fvDetails.FindControl("pnlInt");
                Panel pnlNut = (Panel)fvDetails.FindControl("pnlNut");
                if (result.ElementAt(0).BPressure == null && result.ElementAt(0).BSugar == null)
                {
                    if (pnlInt != null)
                    {
                        pnlInt.Visible = false;
                    }
                }
                else
                {
                    if (pnlInt != null)
                    {
                        pnlInt.Visible = true;
                    }
                }
                if (result.ElementAt(0).Fat == null && result.ElementAt(0).Weight == null && result.ElementAt(0).Hieght == null)
                {
                    if (pnlNut != null)
                    {
                        pnlNut.Visible = false;
                    }
                }
                else
                {
                    if (pnlInt != null)
                    {
                        pnlNut.Visible = true;
                    }
                }
            }
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack)
     {
         EntityDataSource1.Where = query;
         EntityDataSource1.DataBind();
     }
     else
     {
         clicked = false;
         if (Request["ClientID"] != null)
         {
             int id = Convert.ToInt32(Request["ClientID"]);
             dllSearch.SelectedIndex = 1;
             setUI();
             tbSearch.Text = id.ToString();
             getData();
         }
     }
 }
Beispiel #4
0
 protected void btAgregarAs_Click(object sender, EventArgs e)
 {
     try
     {
         etMsj.Text = "";
         // Colección columna-valor para el método Insert
         ListDictionary nuevaFila = new ListDictionary();
         // Valores de la fila
         nuevaFila.Add("id_asignatura", ctIdAsig.Text);
         nuevaFila.Add("nombre", ctNombre.Text);
         // Insertar la fila en asignaturas
         EntityDataSource1.Insert(nuevaFila);
         etMsj.Text = "Operación realizada.";
     }
     catch (Exception exc)
     {
         string msjError = "Los datos no son correctos " +
                           "o la asignatura ya existe (clave duplicada)";
         etMsj.Text = msjError;
     }
 }
Beispiel #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            using (ClubDBEntities club = new ClubDBEntities())
            {
                lblError.Visible = false;
                var sub = (from i in club.Subscribtions
                           where i.SubID == SubID
                           select i).First();
                if (sub.LeftDays - 1 < 0)
                {
                    // dont save
                    lblNo.Text       = "انتهت أيام الاشتراك، لا يمكنك اضافة زيارة";
                    pnlVisit.Visible = false;
                    return;
                }
                else
                {
                    sub.LeftDays--;
                    sub.AttDays++;
                    Visit visit = new Visit();
                    visit.ClientID   = CntID;
                    visit.SubID      = SubID;
                    visit.Date       = DateTime.Now.Date;
                    visit.SigninTime = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
                    visit.SizeAfter  = tbAfter.Text;
                    visit.SizeBefore = tbBefore.Text;
                    club.Visits.AddObject(visit);
                    club.SaveChanges();
                    var result = club.getSubDetails(SubID);
                    fvDetails.DataSource = result;
                    fvDetails.DataBind();
                }

                // refresh
                EntityDataSource1.DataBind();
                gvVisits.DataBind();

                pnlVisit.Visible = false;
            }
        }
 // Perform page elements initialization.
 protected void Page_Init(object sender, EventArgs e)
 {
     // Get the metadata of the current table.
     table = EntityDataSource1.GetMetaTable();
 }