Example #1
0
        //protected void btnDelete_Click(object sender, CommandEventArgs e)
        //{
        //    TimeCustomers bpe = TimeCustomers.ReadSafe(Convert.ToInt32(e.CommandArgument));
        //    if (bpe != null)
        //    {
        //        bpe.Delete();
        //        RefreshEntries();
        //        updEntries.Update();
        //    }
        //}
        protected void rptCustomers_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                string allKeys = Convert.ToString(e.CommandArgument);
                int pkID = Convert.ToInt32(allKeys);
                _currentCustomer = TimeCustomers.Read(pkID);
                Session["CurrentCustomer"] = _currentCustomer;
                txtName.Text = _currentCustomer.CustomerName;
               txtDescription.Text = _currentCustomer.Description;
            }

            if (e.CommandName == "Delete")
            {
                string allKeys = Convert.ToString(e.CommandArgument);
                int pkID = Convert.ToInt32(allKeys);
                _currentCustomer = TimeCustomers.Read(pkID);
                _currentCustomer.Delete();
                _currentCustomer = null;
                Session["CurrentCustomer"] = _currentCustomer;
                RefreshEntries();
                updEntries.Update();
                lblSuccessMessage.Text = "Successfully deleted data!";
                mpSuccess.Show();
            }
        }