Exemple #1
0
        protected void dtgMail_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "editrow")
            {
                try
                {
                    int id = ConvertUtility.ToInt32(e.Item.Cells[0].Text);

                    MailInfo info      = MailDB.GetInfo(id);
                    CheckBox chkAnswer = (CheckBox)e.Item.FindControl("chkAnswer");

                    info.Mail_Answer = ConvertUtility.ToBoolean(chkAnswer.Checked);

                    MailDB.Update(info);
                    lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch (Exception ex)
                {
                    lblUpdateStatus.Text = ex.ToString();
                }
            }
            if (e.CommandName == "delete")
            {
                int id = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                try
                {
                    MailDB.Delete(id);
                    lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
                }
            }
        }
Exemple #2
0
 protected void butDelAll_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (DataGridItem item in dtgMail.Items)
         {
             //					CheckBox chkSelect = (CheckBox)item.FindControl("chkSelect");
             //					if(chkSelect.Checked)
             //					{
             int      id        = ConvertUtility.ToInt32(item.Cells[0].Text);
             MailInfo info      = MailDB.GetInfo(id);
             CheckBox chkAnswer = (CheckBox)item.FindControl("chkAnswer");
             info.Mail_Answer = ConvertUtility.ToBoolean(chkAnswer.Checked);
             MailDB.Update(info);
             //					}
         }
         lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
     }
     catch
     {
         lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
     }
 }