Пример #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            int mid = 1, msgid = 1;
            //System.Windows.Forms.MessageBox.Show("Before alert " + Request.Params.Get("alert"));
            if (Request.Params.Get("alert") != null)
            {
                //System.Windows.Forms.MessageBox.Show("In alert ");
                Mails m;
                Messages mg;
                Clock c;
                bool MailEnabled = (Request.Params.Get("mail") != null);
                bool MessageEnabled = Request.Params.Get("message") != null;

                if (MailEnabled || MessageEnabled)
                {

                    c = InitializeClock();
                    c.Save();
                    if (MailEnabled)
                    {
                        Label1.Text += "  Mail  ";
                        m = new Mails(-1, TextBox1.Text, TextBox2.Text, TextBox3.Text, c.getId());
                        m.save();
                        mid = m.getId();
                    }
                    if (MessageEnabled)
                    {
                        Label1.Text += "   Message";
                        mg = new Messages(-1, TextBox4.Text, TextBox6.Text, c.getId());
                        mg.save();
                        msgid = mg.getId();
                    }
                }
            }
           // System.Windows.Forms.MessageBox.Show("Before saving");
            Label1.Text += "       Remainder";
            Reminder r = new Reminder(u.getUserName(), Calendar1.SelectedDate.ToString("dd/MMM/yyyy"), DropDownList10.SelectedItem.Text, TextBox7.Text, mid, msgid);
           // System.Windows.Forms.MessageBox.Show("After saving");
            Label1.Text = r.getQuery();
            if (r.save())
            {
                /*Response.Write("<script language='javascript'>"+
                                    "alert('Reminder added successfully..');"+
                                    "window.open('./RemindersList.aspx');"+
                                    "alert('new Page');"+
                               "</script>");*/
                Response.Redirect("RemindersList.aspx");
            }
            else
                Response.Write("<script language='javascript'>alert('An error occured in saving your reminder , try again after few seconds');</script>");
        }
        catch (Exception ee) { Response.Write(ee.Message); }
    }
Пример #2
0
    protected void FormView2_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
    {
        int MsgId = (int)Session["MSGID"];

        if (MsgId == DEFAULT_MSGID)   // 114  -->  Default MessageId
        {
            // Creating New Message
            Messages Default = Messages.getById(MsgId);
            Messages NewMessage = new Messages(-1, Default.getDestNumber(), Default.getMessage(), Default.getClockId());

            //Clearing Default Message
            Default.setDestNumber("");
            Default.setMessage("");
            Default.update();

            NewMessage.save();
            Session.Add("MSGID", NewMessage.getId());

            //System.Windows.Forms.MessageBox.Show(NewMessage.getId() + "");
            //Updating MessagesId of Reminder
            Reminder r = Reminder.getById(((int)Session["RID"]));
            r.setMessageId(NewMessage.getId());
            r.update();
            //System.Windows.Forms.MessageBox.Show("Reminder Updated");
        }
    }