Ejemplo n.º 1
0
        protected void rptCustomers_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Edit")
                {
                    string allKeys = Convert.ToString(e.CommandArgument);
                    int pkID = Convert.ToInt32(allKeys);
                    _currentProjectHours = TimeProjectHours.Read(pkID);
                    Session["CurrentProjectHours"] = _currentProjectHours;
                    txtDate.Text = _currentProjectHours.DateOfWork.ToString("M/d/yyyy", CultureInfo.InvariantCulture);
                    txtHours.Text = _currentProjectHours.HoursOfWork.ToString();
                    ddlDepartment.SelectedValue = ddlDepartment.Items.FindByValue(_currentProjectHours.TimeDepartmentID.ToString()).Value;
                    ddlResoures.SelectedValue = ddlResoures.Items.FindByValue(_currentProjectHours.TimeResourceID.ToString()).Value;
                    ddlProject.SelectedValue = ddlProject.Items.FindByValue(_currentProjectHours.TimeProjectID.ToString()).Value;
                    txtDescription.Text = _currentProjectHours.Description;
                    ddlProject.Focus();
                }

                if (e.CommandName == "Delete")
                {
                    string allKeys = Convert.ToString(e.CommandArgument);
                    int pkID = Convert.ToInt32(allKeys);
                    _currentProjectHours = TimeProjectHours.Read(pkID);
                    _currentProjectHours.Delete();
                    _currentProjectHours = null;
                    Session["CurrentProjectHours"] = _currentProjectHours;
                    RefreshEntriesDateSpread();
                    updEntries.Update();
                    ddlProject.Focus();
                    lblSuccessMessage.Text = "Successfully deleted data!";
                    mpSuccess.Show();
                }
            }
            catch (Exception ex)
            {

            }
        }
Ejemplo n.º 2
0
 protected void rptCustomers_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         string allKeys = Convert.ToString(e.CommandArgument);
         int pkID = Convert.ToInt32(allKeys);
         _currentProjectHours = TimeProjectHours.Read(pkID);
         _currentProjectHours.Delete();
         _currentProjectHours = null;
         Session["CurrentProjectHours"] = _currentProjectHours;
         //RefreshEntries();
         //updEntries.Update();
     }
 }