Esempio n. 1
0
 /*public static IEnumerable<Entity> SelectPaged
     (
         int startRowIndex,
         int maximumRows
     )
 {
     return Select().Skip(startRowIndex).Take(maximumRows);
 }*/
 public static int Insert(Entity entityToInsert)
 {
     VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();
     db.Entities.InsertOnSubmit(entityToInsert);
     db.SubmitChanges();
     return entityToInsert.Entity_ID;
 }
Esempio n. 2
0
 public static IEnumerable<Volunteer> SelectVolunteerSchedule(DateTime dateSelected, string selectedShift)
 {
     VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();
     var date = db.Shifts.Single(s => s.Shift_Date == dateSelected && s.Shift_Name == selectedShift);
     var query = date.Volunteers;
     return query;
 }
Esempio n. 3
0
 public static void Delete(Entity entityToDelete)
 {
     VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();
     db.Entities.Attach(entityToDelete);
     db.Entities.DeleteOnSubmit(entityToDelete);
     db.SubmitChanges();
 }
Esempio n. 4
0
 public static int Insert(Shift shiftToInsert)
 {
     VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();
     db.Shifts.InsertOnSubmit(shiftToInsert);
     db.SubmitChanges();
     return shiftToInsert.Shift_ID;
 }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // convert textbox entry to type int
        int IDtxtbx;
        IDtxtbx = Convert.ToInt32(textBox1.Text);
        //int IDtxtbx = int.Parse(textBox1.Text);

        // Create a gridview to display entity attributes to user to
        // verify if this is the correct selection
        VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();
        Confirm_grdView.DataSource = db.Entities.Where(n => n.Entity_ID == (IDtxtbx));
        Confirm_grdView.DataBind();
    }
Esempio n. 6
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            grdEntity.Visible = true;

            VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();

            grdEntity.DataSource = db.Entities.Where(n =>
                n.Entity_Contact_LName == (lnameBox.Text) &&
                n.Entity_Contact_FName == (fnameBox.Text)&&
                n.Entity_Contact_MName == (middleIBox.Text));
            grdEntity.DataBind();
        }
    }
Esempio n. 7
0
    protected void btnClient_Click(object sender, EventArgs e)
    {
        pnlBinaryField2.Visible = false;
        pnlSelect.Visible = true;

        VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();
        var shiftID = db.Shifts.Where(s =>s.Shift_Name == rblSelectedLiteral.Text && s.Shift_Date == Calendar1.SelectedDate).Select(s => new {s.Shift_ID});
        int shift_ID = int.Parse(shiftID.ToString());

        byte CommuServ;

        if (cbxCommServ.Checked)
        {
            CommuServ = 1;

        }
        else
        {
            CommuServ = 0;
        }
        byte isClient;

        if (cbxClient.Checked)
        {
            isClient = 1;

        }
        else
        {
            isClient = 0;
        }
        /*System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
        //Convert to binary data
        byte[] binaryData = encoding.GetBytes(CommuServ);*/

        srcIndividual.InsertParameters["EntID"].DefaultValue = grdIndividual_Entity.SelectedValue.ToString();
        srcIndividual.InsertParameters["ShiftID"].DefaultValue = shiftID.ToString();
        //srcIndividual.InsertParameters["CommServ"].DefaultValue = CommuServ.ToString();
        //  Convert.ToByte(srcIndividual.InsertParameters["CommServ"].DefaultValue= CommuServ);

        //srcIndividual.InsertParameters.Add("Client", SqlDbType.Binary);
        //  Convert.ToByte(srcIndividual.InsertParameters["Client"].DefaultValue = isClient);

        srcIndividual.Insert();
        grdSelect.Visible = true;
    }
Esempio n. 8
0
 public static void Update(Entity oldEntity, Entity newEntity)
 {
     VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();
     db.Entities.Attach(newEntity, oldEntity);
     db.SubmitChanges();
 }
Esempio n. 9
0
 public static IEnumerable<Entity> Select()
 {
     VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();
     return db.Entities.OrderByDescending(e => e.Entity_ID);
 }
Esempio n. 10
0
 public static IEnumerable<Shift> Select()
 {
     VolunteerDatabaseDataContext db = new VolunteerDatabaseDataContext();
     return db.Shifts.OrderByDescending(s => s.Shift_ID);
 }