Ejemplo n.º 1
0
 protected void dtgAdvertises_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     if (e.CommandName == "edit")
     {
         Response.Redirect(AppEnv.ADMIN_CMD + "advertiseupdate&advertiseid=" + e.Item.Cells[0].Text);
     }
     if (e.CommandName == "del")
     {
         try
         {
             AdvertiseDB.Delete(ConvertUtility.ToInt32(e.Item.Cells[0].Text));
             lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
             cmdSearch_Click(null, null);
         }
         catch
         {
             lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
         }
     }
     if (e.CommandName == "priority")
     {
         try
         {
             foreach (DataGridItem item in dtgAdvertises.Items)
             {
                 DropDownList dropPriority = (DropDownList)item.FindControl("dropPriority");
                 AdvertiseDB.SetPriority(ConvertUtility.ToInt32(item.Cells[0].Text), ConvertUtility.ToInt32(dropPriority.SelectedValue));
             }
             lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
             cmdSearch_Click(null, null);
         }
         catch
         {
             lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
         }
     }
 }