i want to create ap application which generates popup alerts at the day of event ocurs as well as a day before the event will occur in a specific time interval as well.. events are stored in database and they are all date fields .. so i want to link those fields to create popups .. help me .
Mike Askew 131 Veteran Poster Featured Poster
i want to create ap application which generates popup alerts at the day of event ocurs as well as a day before the event will occur in a specific time interval as well.. events are stored in database and they are all date fields .. so i want to link those fields to create popups .. help me .
In order to help you, you must first provide us with what you have achieved. We do not write code for you, simply correct and enlighten on mistakes.
exception 0 Newbie Poster
yeah right MikeyIsMe, do you homework engr.akki
engr.akki 0 Newbie Poster
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace TherapyWorksNew
{
public partial class Main : Form
{
int Count;
int Act=1000;
int stc;
int ID;
string[,] Std = null;
string[,] Grp = null;
string[,] cpcab = null;
string[,] Cert_date= null;
string[,] Dip_date = null;
public Main()
{
InitializeComponent();
this.WindowState = FormWindowState.Maximized;
}
private void button1_Click(object sender, EventArgs e)
{
CreateGroup CG = new CreateGroup();
//CG.MdiParent = this;
CG.FormClosed += new FormClosedEventHandler(CG_FormClosed);
this.Hide();
CG.Show();
}
private void CG_FormClosed(object sender, FormClosedEventArgs e)
{
this.Show();
}
private void button2_Click(object sender, EventArgs e)
{
CreateStudent St = new CreateStudent();
//St.MdiParent = this;
St.FormClosed += new FormClosedEventHandler(St_FormClosed);
this.Hide();
St.Show();
}
private void St_FormClosed(object sender, FormClosedEventArgs e)
{
this.Show();
}
private void button3_Click(object sender, EventArgs e)
{
CreateTutor tut = new CreateTutor();
//tut.MdiParent = this;
tut.FormClosed += new FormClosedEventHandler(tut_FormClosed);
this.Hide();
tut.Show();
}
private void tut_FormClosed(object sender, FormClosedEventArgs e)
{
this.Show();
}
private void AssignementsStatus_Click(object sender, EventArgs e)
{
Assignments_Entry A_Ent = new Assignments_Entry();
A_Ent.Show();
}
private void button4_Click(object sender, EventArgs e)
{
SqlConnection Conn;
Conn = new SqlConnection("Data Source=AKII-PC\\SQLEXPRESS;Initial Catalog=tw;Persist Security Info=True;User ID=sa;Password=sa");
Conn.Open();
string ST_Count = "Select St_id from Tw_Student order by St_id Desc";
SqlCommand Comm_Count = new SqlCommand(ST_Count, Conn);
stc = Convert.ToInt32(Comm_Count.ExecuteScalar());
MessageBox.Show(stc.ToString());
Count = stc;
Std = new string[Count, Act];
for (ID = 0; ID < Count; ID++)
{
string query1 = "Select Gp_id from Tw_Student where St_id=" + ID;
SqlCommand Comm_Q1 = new SqlCommand(query1, Conn);
int G_ID = Convert.ToInt32(Comm_Q1.ExecuteScalar());
string query2 = "Select Gp_type from Tw_Group where Gp_id=" + G_ID;
SqlCommand Comm_Q2 = new SqlCommand(query2, Conn);
string G_Type = Convert.ToString(Comm_Q2.ExecuteScalar());
if (G_Type == "Certificate")
{
Act = 0; // AdmissionForm
string query3 = "Select AdmissionForm from Tw_Student where St_id='" + ID + "'AND AdmissionForm_Status='false'";
SqlCommand Comm_Q3 = new SqlCommand(query3, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q3.ExecuteScalar());
Act = 1; //TrainingEvaluation
string query4 = "Select TrainingEvaluation from Tw_Student where St_id='" + ID + "'AND TrainingEvaluation_Status='false'";
SqlCommand Comm_Q4 = new SqlCommand(query4, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q4.ExecuteScalar());
Act = 2;// LocalEssay1
string query5 = "Select LocalEssay1 from Tw_Student where St_id='" + ID + "'AND LocalEssay1_Status='false'";
SqlCommand Comm_Q5 = new SqlCommand(query5, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q5.ExecuteScalar());
Act = 3;// LocalEssay2
string query6 = "Select LocalEssay2 from Tw_Student where St_id='" + ID + "'AND LocalEssay2_Status='false'";
SqlCommand Comm_Q6 = new SqlCommand(query6, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q6.ExecuteScalar());
Act = 4;// LocalEssay3
string query7 = "Select LocalEssay3 from Tw_Student where St_id='" + ID + "'AND LocalEssay3_Status='false'";
SqlCommand Comm_Q7 = new SqlCommand(query7, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q7.ExecuteScalar());
Act = 5;//InternationalEssay1
string query8 = "Select InternationalEssay1 from Tw_Student where St_id='" + ID + "'AND InternationalEssay1_Status='false'";
SqlCommand Comm_Q8 = new SqlCommand(query8, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q8.ExecuteScalar());
Act = 6;//InternationalEssay2
string query9 = "Select InternationalEssay2 from Tw_Student where St_id='" + ID + "'AND InternationalEssay2_Status='false'";
SqlCommand Comm_Q9 = new SqlCommand(query9, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q9.ExecuteScalar());
Act = 7;//Fishbonds
string query10 = "Select Fishbowls from Tw_Student where St_id='" + ID + "'AND Fishbowls_Status='false'";
SqlCommand Comm_Q10 = new SqlCommand(query10, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q10.ExecuteScalar());
Act = 8;//SelfAssessmentReport
string query11 = "Select SelfAssessmentReport from Tw_Student where St_id='" + ID + "'AND SelfAssessmentReport_Status='false'";
SqlCommand Comm_Q11 = new SqlCommand(query11, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q11.ExecuteScalar());
Act = 9;//PeerAssessmentReport
string query12 = "Select PeerAssessmentReport from Tw_Student where St_id='" + ID + "'AND PeerAssessmentReport_Status='false'";
SqlCommand Comm_Q12 = new SqlCommand(query12, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q12.ExecuteScalar());
Act = 10;//TutorAssessmentReport
string query13 = "Select TutorAssessmentReport from Tw_Student where St_id='" + ID + "'AND TutorAssessmentReport_Status='false'";
SqlCommand Comm_Q13 = new SqlCommand(query13, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q13.ExecuteScalar());
Act = 11;//TailorMade
string query14 = "Select TailorMade from Tw_Student where St_id='" + ID + "'AND TailorMade_Status='false'";
SqlCommand Comm_Q14 = new SqlCommand(query14, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q14.ExecuteScalar());
Act = 12;//CLR
string query15 = "Select CLR from Tw_Student where St_id='" + ID + "'AND CLR_Status='false'";
SqlCommand Comm_Q15 = new SqlCommand(query15, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q15.ExecuteScalar());
}
else if (G_Type == "Diploma")
{
Act = 13;//
string query16 = "Select AdmissionForm from Tw_Student where St_id='" + ID + "' AND AdmissionForm_Status='false'";
SqlCommand Comm_Q16 = new SqlCommand(query16, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q16.ExecuteScalar());
Act = 14;//TrainingEvaluation
string query17 = "Select TrainingEvaluation from Tw_Student where St_id='" + ID + "' AND TrainingEvaluation_Status='false'";
SqlCommand Comm_Q17 = new SqlCommand(query17, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q17.ExecuteScalar());
Act = 15;//LocalEssay1
string query18 = "Select LocalEssay1 from Tw_Student where St_id='" + ID + "' AND LocalEssay1_Status='false'";
SqlCommand Comm_Q18 = new SqlCommand(query18, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q18.ExecuteScalar());
Act = 16;// LocalEssay2
string query19 = "Select LocalEssay2 from Tw_Student where St_id='" + ID + "' AND LocalEssay2_Status='false'";
SqlCommand Comm_Q19 = new SqlCommand(query19, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q19.ExecuteScalar());
Act = 17;// LocalEssay3
string query20 = "Select LocalEssay3 from Tw_Student where St_id='" + ID + "' AND LocalEssay3_Status='false'";
SqlCommand Comm_Q20 = new SqlCommand(query20, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q20.ExecuteScalar());
Act = 18;//InternationalEssay1
string query21 = "Select InternationalEssay1 from Tw_Student where St_id='" + ID + "' AND InternationalEssay1_Status='false'";
SqlCommand Comm_Q21 = new SqlCommand(query21, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q21.ExecuteScalar());
Act = 19;//InternationalEssay2
string query22 = "Select InternationalEssay2 from Tw_Student where St_id='" + ID + "' AND InternationalEssay2_Status='false'";
SqlCommand Comm_Q22 = new SqlCommand(query22, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q22.ExecuteScalar());
Act = 20;//Fishbowls
string query23 = "Select Fishbowls from Tw_Student where St_id='" + ID + "' AND Fishbowls_Status='false'";
SqlCommand Comm_Q23 = new SqlCommand(query23, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q23.ExecuteScalar());
Act = 21;//OneTapedSession
string query24 = "Select OneTapedSession from Tw_Student where St_id='" + ID + "' AND OneTapedSession_Status='false'";
SqlCommand Comm_Q24 = new SqlCommand(query24, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q24.ExecuteScalar());
Act = 22;//ClinicalObservedSession
string query25 = "Select ClinicalObservedSession from Tw_Student where St_id='" + ID + "' AND ClinicalObservedSession_Status='false'";
SqlCommand Comm_Q25 = new SqlCommand(query25, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q25.ExecuteScalar());
Act = 23;//SelfAssessmentReport
string query26 = "Select SelfAssessmentReport from Tw_Student where St_id='" + ID + "' AND SelfAssessmentReport_Status='false'";
SqlCommand Comm_Q26 = new SqlCommand(query26, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q26.ExecuteScalar());
Act = 24;//PeerAssessmentReport
string query27 = "Select PeerAssessmentReport from Tw_Student where St_id='" + ID + "' AND PeerAssessmentReport_Status='false'";
SqlCommand Comm_Q27 = new SqlCommand(query27, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q27.ExecuteScalar());
Act = 25;//TutorAssessmentReport
string query28 = "Select TutorAssessmentReport from Tw_Student where St_id='" + ID + "' AND TutorAssessmentReport_Status='false'";
SqlCommand Comm_Q28 = new SqlCommand(query28, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q28.ExecuteScalar());
Act = 26;//ReflectiveJournals
string query29 = "Select ReflectiveJournals from Tw_Student where St_id='" + ID + "' AND ReflectiveJournals_Status='false'";
SqlCommand Comm_Q29 = new SqlCommand(query29, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q29.ExecuteScalar());
Act = 27;//CaseStudy
string query30 = "Select CaseStudy from Tw_Student where St_id='" + ID + "' AND CaseStudy_Status='false'";
SqlCommand Comm_Q30 = new SqlCommand(query30, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q30.ExecuteScalar());
Act = 28;//ClientHoursSupervisionReport
string query31 = "Select ClientHoursSupervisionReport from Tw_Student where St_id='" + ID + "' AND ClientHoursSuperVisionReport_Status='false'";
SqlCommand Comm_Q31 = new SqlCommand(query31, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q31.ExecuteScalar());
Act = 29;// TailorMode
string query32 = "Select TailorMade from Tw_Student where St_id='" + ID + "'AND TailorMade_Status='false'";
SqlCommand Comm_Q32 = new SqlCommand(query32, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q32.ExecuteScalar());
Act = 30;//CLR
string query33 = "Select CLR from Tw_Student where St_id='" + ID + "' AND CLR_Status='false'";
SqlCommand Comm_Q33 = new SqlCommand(query33, Conn);
Std[ID, Act] = Convert.ToString(Comm_Q33.ExecuteScalar());
}
}
}
public void Popup(String[,] cd, DateTime td)
{
td = DateTime.Now;
if(cd[ID,Act].Contains(Convert.ToString(td.AddDays(-2))))
{
}
else if (cd[ID,Act].Contains(Convert.ToString(td.AddDays(-1))))
{
//
}
else if (cd[ID,Act].Contains(Convert.ToString(td)))
{
//
}
else if (cd[ID, Act].Contains(Convert.ToString(td.AddDays(1))))
{
//
}
}
private void Main_Load_1(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dataSet1.Tw_Student' table. You can move, or remove it, as needed.
//this.tw_StudentTableAdapter.Fill(this.dataSet1.Tw_Student);
String[] Certt = new String[20];
Certt[0] = "AdmissionForm";
Certt[1] = "TrainingEvaluation";
Certt[2] = "LocalEssay1";
Certt[3] = "LocalEssay2";
Certt[4] = "LocalEssay3";
Certt[5] = "InternationalEssay1";
Certt[6] = "InternationalEssay2";
Certt[7] = "Fishbowls";
Certt[8] = "SelfAssessmentReport";
Certt[9] = "PeerAssessmentReport";
Certt[10] = "TailorMade";
Certt[11] = "CLR";
Certt[17] = "TutorAssessmentReport";
String[] Dipt = new String[20];
Dipt[0] = "AdmissionForm";
Dipt[1] = "TrainingEvaluation";
Dipt[2] = "LocalEssay1";
Dipt[3] = "LocalEssay2";
Dipt[4] = "LocalEssay3";
Dipt[5] = "InternationalEssay1";
Dipt[6] = "InternationalEssay2";
Dipt[7] = "Fishbowls";
Dipt[8] = "OneTapedSession";
Dipt[9] = "ClinicalObservedSession";
Dipt[10] = "SelfAssessmentReport";
Dipt[11] = "PeerAssessmentReport";
Dipt[12] = "ReflectiveJournals";
Dipt[13] = "CaseStudy";
Dipt[14] = "ClientHoursSupervisionReport";
Dipt[15] = "TailorMade";
Dipt[16] = "CLR";
SqlConnection Conn;
Conn = new SqlConnection("Data Source=AKII-PC\\SQLEXPRESS;Initial Catalog=tw;Persist Security Info=True;User ID=sa;Password=sa");
Conn.Open();
string GT_Count = "Select Gp_id from Tw_Group order by Gp_id Desc";
SqlCommand Comm_Count = new SqlCommand(GT_Count, Conn);
stc = Convert.ToInt32(Comm_Count.ExecuteScalar());
MessageBox.Show(stc.ToString());
Count = stc;
int ck;
for (ID = 0; ID < Count; ID++)
{
for (int k = 0; k < 20; k++)
{
string query1 = "Select Gp_id from Tw_Group where Gp_id=" + ID;
SqlCommand Comm_Q1 = new SqlCommand(query1, Conn);
int G_ID = Convert.ToInt32(Comm_Q1.ExecuteScalar());
string query2 = "Select Gp_type from Tw_Group where Gp_id=" + G_ID;
SqlCommand Comm_Q2 = new SqlCommand(query2, Conn);
string G_Type = Convert.ToString(Comm_Q2.ExecuteScalar());
if (G_Type == "Certificate")
{
String query3 = "Select " + Certt[k] + " from Tw_Group where Gp_id='" + G_ID + "'";
SqlCommand comm1 = new SqlCommand(query3, Conn);
Cert_date[ID,k] = Convert.ToString(comm1.ExecuteScalar());
groupBox1.Text = Convert.ToString(Cert_date[ID,k]);
}
else if (G_Type == "Diploma")
{
String query4 = "Select " + Dipt[k] + " from Tw_Group where Gp_id='" + G_ID + "'";
SqlCommand comm2 = new SqlCommand(query4, Conn);
Dip_date[ID,k] = Convert.ToString(comm2.ExecuteScalar());
}
}
}
}
private void timer1_Tick(object sender, EventArgs e)
{
}
}
}
This is my coding .i hav fetched data from 2 two tables 1st is Tw_group and 2nd is Tw_Student and stored it in 2d array. i have a timer on main page as well with interval of half an hour .. now every times the application is run i want the timer to start and after every interval it automatically run main_1_load function so that the group tasks are checked.. and the only problem im having is !st how to see whether the arrays are getting the values from Db or not . and second is that how do i check that a value in the array is equal to current date and a day before. help me guyz ..
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.