Example #1
0
 protected void select_All()
 {
     try
     {
         //Opening the connection to the DB
         NpgsqlConnection conn = new NpgsqlConnection(connstring);
         conn.Open();
         //The Select SQL Command to execute
         string            sql = "SELECT * FROM machine";
         NpgsqlDataAdapter da  = new NpgsqlDataAdapter(sql, conn);
         da.Fill(ds);
         conn.Close();
         if (ds.Tables[0].Rows.Count > 0)
         {
             MachineGridView.DataSource = ds;
             MachineGridView.DataBind();
         }
         else
         {
             ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
             MachineGridView.DataSource = ds;
             MachineGridView.DataBind();
             int columncount = MachineGridView.Rows[0].Cells.Count;
             MachineGridView.Rows[0].Cells.Clear();
             MachineGridView.Rows[0].Cells.Add(new TableCell());
             MachineGridView.Rows[0].Cells[0].ColumnSpan = columncount;
             MachineGridView.Rows[0].Cells[0].Text       = Resources.General.NoRecordFound;
         }
     }
     catch (Exception msg)
     {
         //DB error are trown in a Label
         ErrorManagement.Text = Resources.General.AnErrorHasOccured + ": " + msg.ToString();
     }
 }
Example #2
0
 protected void MachineDataSource_OnUpdated(object sender, ObjectDataSourceStatusEventArgs e)
 {
     MachineGridView.DataBind();
     if ((int)e.ReturnValue == 0)
     {
         Msg.Text = "Employee was not updated. Please try again.";
     }
 }
Example #3
0
 protected void DetailsView_ItemDeleted(Object sender, DetailsViewDeletedEventArgs e)
 {
     MachineGridView.DataBind();
 }
Example #4
0
 protected void _DetailsView_ItemUpdated(Object sender, DetailsViewUpdatedEventArgs e)
 {
     MachineGridView.DataBind();
 }