Beispiel #1
0
 public static void RecordPulse(Guid vid, long pageid)
 {
     using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext())
     {
         dc.ExecuteCommand("UPDATE dbo.PageVisit Set LastHeartBeat = GETUTCDATE() WHERE ID = " + pageid);
     }
 }
    protected void DeleteButton_Click(object sender, EventArgs e)
    {
        using (RockyingDataClassesDataContext db = new RockyingDataClassesDataContext(Utility.ConnectionString))
        {
            string query = "Delete FROM [EmailMessage] WHERE 1=1 ";

            if (TypeDropDown.SelectedValue != "")
            {
                query = string.Format("{0} AND([EmailType] = {1})", query, TypeDropDown.SelectedValue);
            }

            if (GroupDropDown.SelectedValue != "")
            {
                query = string.Format("{0} AND(EmailGroup = '{1}')", query, GroupDropDown.SelectedValue);
            }

            if (SentDropDown.SelectedValue != "")
            {
                query = string.Format("{0} AND([IsSent] = {1})", query, SentDropDown.SelectedValue);
            }

            if (ReadDropDown.SelectedValue != "")
            {
                query = string.Format("{0} AND([IsRead] = {1})", query, ReadDropDown.SelectedValue);
            }

            //query = string.Format("{0} ORDER BY CreateDate desc ", query);

            db.ExecuteCommand(query, new object[] { });
            Bind(0);
        }
    }
Beispiel #3
0
    protected void btnDeleteRecords_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in MemberGridView.Rows)
        {
            if ((row.FindControl("chkSelect") as CheckBox).Checked)
            {
                int Emp_ID = Convert.ToInt32(MemberGridView.DataKeys[row.RowIndex].Value);
                using (RockyingDataClassesDataContext db = new RockyingDataClassesDataContext(Utility.ConnectionString))
                {
                    db.ExecuteCommand("DELETE FROM Member WHERE ID = " + Emp_ID, new object[] { });
                }
            }
        }

        Bind(0);
    }
 protected void SubmitButton_Click(object sender, EventArgs e)
 {
     try
     {
         using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
         {
             int rows = dc.ExecuteCommand(QueryTextBox.Text.Trim());
             message1.Text     = string.Format("Command executed successfully. {0} rows affected.", rows);
             message1.Indicate = AlertType.Success;
             message1.Visible  = true;
         }
     }
     catch (Exception ex)
     {
         message1.Text     = string.Format("{0}<br/>{1}<br/>{2}", ex.Message, ex.Source, ex.StackTrace);
         message1.Indicate = AlertType.Error;
         message1.Visible  = true;
     }
 }