Exemplo n.º 1
0
    protected void uxGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            string rmaActionID = ((HiddenField)uxGrid.Rows[e.RowIndex].FindControl("uxRmaActionIDHidden")).Value;
            string name        = ((TextBox)uxGrid.Rows[e.RowIndex].FindControl("uxNameText")).Text;
            bool   isCheck     = ((CheckBox)uxGrid.Rows[e.RowIndex].FindControl("uxEnabledCheck")).Checked;

            if (!String.IsNullOrEmpty(rmaActionID))
            {
                RmaAction action = new RmaAction();
                action.RmaActionID = rmaActionID;
                action.Name        = name;
                action.IsEnabled   = isCheck;
                DataAccessContext.RmaActionRepository.Save(action);
            }

            //End editing
            uxGrid.EditIndex = -1;
            RefreshGrid();

            uxMessage.DisplayMessage(Resources.RmaActionMessages.UpdateSuccess);
        }
        catch (Exception)
        {
            string message = Resources.RmaActionMessages.UpdateError;
            throw new ApplicationException(message);
        }
        finally
        {
            // Avoid calling Update() automatically by GridView
            e.Cancel = true;
        }
    }
Exemplo n.º 2
0
    protected void uxGrid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Add")
        {
            try
            {
                string name    = ((TextBox)uxGrid.FooterRow.FindControl("uxNameText")).Text;
                bool   isCheck = ((CheckBox)uxGrid.FooterRow.FindControl("uxEnabledCheck")).Checked;

                RmaAction action = new RmaAction();
                action.Name      = name;
                action.IsEnabled = isCheck;
                DataAccessContext.RmaActionRepository.Save(action);

                ((TextBox)uxGrid.FooterRow.FindControl("uxNameText")).Text         = "";
                ((CheckBox)uxGrid.FooterRow.FindControl("uxEnabledCheck")).Checked = false;

                uxMessage.DisplayMessage(Resources.RmaActionMessages.AddSuccess);
            }
            catch (Exception)
            {
                string message = Resources.RmaActionMessages.AddError;
                throw new VevoException(message);
            }

            RefreshGrid();
        }

        if (e.CommandName == "Edit")
        {
            uxGrid.ShowFooter   = false;
            uxAddButton.Visible = true;
        }
    }
Exemplo n.º 3
0
    private void CreateDummyRow(IList <RmaAction> list)
    {
        RmaAction action = new RmaAction();

        action.RmaActionID = "-1";

        list.Add(action);
    }