void cb1_CheckedChanged(object sender, EventArgs e) { //should be a checkBox //try //Response.Write("We are here!!!"); { CheckBox c = (CheckBox)sender; Table tb1 = (Table)c.Parent.Parent.Parent; TableRow tr1 = (TableRow)c.Parent.Parent; if (c.Checked) { string s = c.ToolTip; Guid g = new Guid(c.ID); if (s.ToUpper().Contains("GROUP")) { MessageGroup m = new MessageGroup(); m.Load(g); m.DateDelivered = DateTime.Now; m.Delivered = true; m.Save(); } else { MessageStudent m = new MessageStudent(); m.Load(g); m.DateDelivered = DateTime.Now.AddMinutes(-5); m.Delivered = true; m.Save(); } } tb1.Controls.Remove(tr1); } //going to redraw table.. //DisplayGroupMsg(GroupCode.Value); //catch { } }
protected void Button_SendMessage_Click(object sender, EventArgs e) { DateTime t1 = Calendar2.SelectedDate; //so we send the message to the students indicated...... //first who is it from... string s = ""; Utility u = new Utility(); /* * string struser = Context.User.Identity.Name; * Guid personID = u.GetPersonID(struser, out s); #if DEBUG * personID = new Guid("20744211-d0f0-4e69-af84-020c1023dfda");//cc #endif * if (personID == Guid.Empty) * { * Server.Transfer("StartForm.aspx"); * } * else * { * s = u.Get_StaffCode(personID); * s = u.Get_StaffID(s); * } */ s = u.GetsStaffIdfromRequest(Request).ToString(); //first make a message... Message m1 = new Message(); m1.Msg = u.CleanInvertedCommas(TextBox1.Text); m1.StaffId = new Guid(s); m1.ValidFrom = Calendar2.SelectedDate; m1.ValidUntil = DateTime.Now.AddDays(7); //m1.DocumentURL = TextBox_URL.Text; Guid Id = m1.Save(); //now loop though the students and the groups.... s = TextBox_StudentList.Text; string s1 = ""; int i = 0; i = s.IndexOf(":"); while (i > 0) { s1 = s.Substring(0, i); //s1 has student GUID MessageStudent mst1 = new MessageStudent(); mst1.StudentId = new Guid(s1); mst1.MessageId = Id; mst1.Delivered = false; mst1.Save(); s = s.Substring(i + 1); i = s.IndexOf(":"); } s = TextBox_GroupList.Text; s1 = ""; i = s.IndexOf(":"); while (i > 0) { s1 = s.Substring(0, i); //s1 has Group GUID MessageGroup mst2 = new MessageGroup(); mst2.GroupId = new Guid(s1); mst2.MessageId = Id; mst2.Delivered = false; mst2.Save(); s = s.Substring(i + 1); i = s.IndexOf(":"); } Server.Transfer("../content/StartForm.aspx"); }