Exemple #1
0
        protected void cmdAddNew_Click(object sender, EventArgs e)
        {
            try
            {
                CommandInfo command = new CommandInfo();
                command.CommandParams   = txtParams.Text;
                command.CommandUrl      = txtUrl.Text;
                command.CommandParentID = ConvertUtility.ToInt32(dropParent.SelectedValue);
                command.CommandKey      = dropCommandKeys.SelectedValue;
                command.CommandOrder    = ConvertUtility.ToInt32(dropIndex.SelectedValue);
                command.CommandEnable   = chkEnable.Checked;
                command.CommandVisible  = chkVisble.Checked;
                command.IsSuperUser     = false;

                int commandId = CommandController.AddCommand(command);
                int i         = 0;
                foreach (DataGridItem item in dgrNameFollowLang.Items)
                {
                    CommandInfo _commandInfo = new CommandInfo();

                    TextBox txtName = (TextBox)item.FindControl("txtName");
                    _commandInfo.CommandName = txtName.Text;

                    _commandInfo.CommandID = commandId;

                    CommandController.AddCommandByLang(_commandInfo, item.Cells[1].Text);
                    i++;
                }
                lblUpdateStatus.Text = MiscUtility.MSG_UPDATE_SUCCESS;
            }
            catch (Exception ex)
            {
                lblUpdateStatus.Text = ex.Message;
            }
        }