Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Binds Data to the gridview displayed on default.aspx
        //the XML resource is generated from the customer API under the session_start class in global.asax

        using (DataSet ds = new DataSet())
        {
            ds.ReadXml(Server.MapPath("~/App_Data/clients_transform.xml"));
            GridViewClients.DataSource = ds;
            GridViewClients.DataBind();
        }
    }
        protected void ButtonSave_Click(object sender, EventArgs e)
        {
            var client = new ClientInfo
            {
                Id          = string.IsNullOrWhiteSpace(TextBoxIDClient.Text) ? 0 : int.Parse(TextBoxIDClient.Text),
                Phone       = string.IsNullOrWhiteSpace(TextBoxPhone.Text) ? string.Empty : TextBoxPhone.Text,
                LastReading = string.IsNullOrWhiteSpace(TextBoxReadLast.Text) ? 0 : int.Parse(TextBoxReadLast.Text),
                Readed      = CheckBoxReaded.Checked
            };

            ClientsRepository.GetInstance().Insert(client);
            GridViewClients.DataSource = ClientsRepository.GetInstance().SelectAll();
            GridViewClients.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string        CS  = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
         SqlConnection con = new SqlConnection(CS);
         SqlCommand    cmd = new SqlCommand("Get_All_Clients_Report", con);
         cmd.CommandType = CommandType.StoredProcedure;
         con.Open();
         SqlDataReader rdr = cmd.ExecuteReader();
         GridViewClients.DataSource = rdr;
         GridViewClients.DataBind();
         rdr.Close();
         con.Close();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     GridViewClients.DataSource = ClientsRepository.GetInstance().SelectAll();
     GridViewClients.DataBind();
 }