public override string Execute(string sourceText, CommandParameters parameters)
        {
            if (string.IsNullOrEmpty(parameters.TextToAppend))
                throw new SimpleEditException((string)App.Current.FindResource("ErrorCommandParametersEmpty"));

            // Escape from special symbols.
            string TextToRemove = Regex.Escape(parameters.TextToAppend);
            Regex regText;
            // Case check
            if (parameters.IsCaseSensitive == false)
                regText = new Regex(TextToRemove, RegexOptions.Multiline | RegexOptions.IgnoreCase);
            else
                regText = new Regex(TextToRemove, RegexOptions.Multiline);

            // Generate Match collection: find all occurrences of TextToRemove in sourceText.
            MatchCollection mc = regText.Matches(sourceText);
            if (mc.Count <= 0)
                throw new SimpleEditException((string)App.Current.FindResource("TextNotFoundError"));

            int SearchTemplateLength = TextToRemove.Length;
            // Remove text in all occurrences.
            int Index = 0;
            int IndexAdd = 0; //every time we remove text, indexes changes
            foreach (Match match in mc)
            {
                Index = match.Index + IndexAdd;
                sourceText = sourceText.Remove(Index, SearchTemplateLength);
                IndexAdd -= SearchTemplateLength;
            }

            return sourceText;
        }
        public override string Execute(string sourceText, CommandParameters parameters)
        {
            if (string.IsNullOrEmpty(parameters.FirstBorder) || string.IsNullOrEmpty(parameters.SecondBorder))
            {
                throw new SimpleEditException((string)App.Current.FindResource("ErrorCommandParametersEmpty"));
            }

            int LastFromIndex = 0;
            int LastToIndex = 0;
            int NextIndex = 0;
            string From = parameters.FirstBorder;
            string To = parameters.SecondBorder;
            int FromLength = From.Length;
            int ToLength = To.Length;
            bool IsChanged = false;

            do
            {
                // FROM
                Match matchFrom = FindNextMatch(From, sourceText, NextIndex, parameters);

                if (matchFrom.Success)
                    LastFromIndex = matchFrom.Index;
                else
                    break;

                // TO
                Match matchTo = FindNextMatch(To, sourceText, LastFromIndex + FromLength, parameters);

                if (matchTo.Success)
                    LastToIndex = matchTo.Index;
                else
                    break;

                // Is need to include parameters to replace
                if (parameters.IncludeParameters == true)
                {
                    sourceText = ReplaceSubstring(sourceText, parameters.TextToAppend, LastFromIndex, LastToIndex + ToLength);
                    NextIndex = LastFromIndex + parameters.TextToAppend.Length;
                }
                else
                {
                    sourceText = ReplaceSubstring(sourceText, parameters.TextToAppend, LastFromIndex + FromLength, LastToIndex);
                    NextIndex = LastFromIndex + parameters.TextToAppend.Length + FromLength + ToLength;
                }
                IsChanged = true;
                _loopsCounter++;

                if (_loopsCounter > 1000000 && !IsChanged)
                {
                    throw new SimpleEditException((string)App.Current.FindResource("TextNotFoundError"));
                }

            } while (true);

            if (IsChanged == false)
                throw new SimpleEditException((string)App.Current.FindResource("TextNotFoundError"));

            return sourceText;
        }
Пример #3
0
        protected void OkButton_Click(object sender, EventArgs e)
        {
            string refreshCommand = Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetRefreshCommand(this.Page);
            string paramString = String.Empty;

            if (!String.IsNullOrEmpty(refreshCommand))
            {
                CommandParameters cp = new CommandParameters(refreshCommand);
                cp.CommandArguments = new Dictionary<string, string>();
                cp.AddCommandArgument("DeleteType", DeleteTypeList.SelectedValue);

                if (ObjectId != PrimaryKeyId.Empty)
                {
                    cp.AddCommandArgument("ObjectId", ObjectId.ToString());
                    paramString = cp.ToString();
                }
                else if (Request.QueryString["GridId"] != null)
                {
                    cp.AddCommandArgument("GridId", Request.QueryString["GridId"]);
                    paramString = cp.ToString();
                }
                else
                {
                    paramString = String.Empty;
                }
            }
            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, paramString);
        }
Пример #4
0
        public void Invoke(object sender, object element)
        {
            if (element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)element;
                //if (!cp.CommandArguments.ContainsKey("ControlId"))
                //    throw new ArgumentNullException("CommandParameters.ControlId @ GoogleGadgetRefresh");

                //string _cid = cp.CommandArguments["ControlId"];
                if (HttpContext.Current.Session["ControlId"] == null)
                    throw new ArgumentNullException("Session.ControlId @ GoogleGadgetRefresh");

                string _cid = HttpContext.Current.Session["ControlId"].ToString();
                string id = MetaViewGroupUtil.GetIdFromUniqueKey(cp.CommandArguments["primaryKeyId"]);
                HttpRequest request = HttpContext.Current.Request;

                if (request != null)
                {
                    GoogleGadgetEntity gge = (GoogleGadgetEntity)BusinessManager.Load("GoogleGadget", PrimaryKeyId.Parse(id));
                    ControlProperties.Provider.SaveValue(_cid, "PageSource", id);

                    if (gge != null)
                        ControlProperties.Provider.SaveValue(_cid, ControlProperties._titleKey, CHelper.GetResFileString(gge.Title));

                    CommandParameters cp2 = new CommandParameters("MC_GG_SelectItem");
                    Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(((CommandManager)sender).Page, cp2.ToString());
                    //((CommandManager)sender).Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "", true);

                }
            }
        }
Пример #5
0
 void btnCancel_Click(object sender, EventArgs e)
 {
     CommandParameters cp = new CommandParameters(Request["CommandName"]);
     cp.CommandArguments = new Dictionary<string, string>();
     cp.AddCommandArgument("Uid", "null");
     CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
 }
Пример #6
0
        protected void SaveButton_ServerClick(object sender, EventArgs e)
        {
            AssignmentEntity assignment = (AssignmentEntity)BusinessManager.Load(AssignmentEntity.ClassName, AssignmentId);
            if (assignment != null)
            {
                assignment.Subject = SubjectText.Text;
                if (DueDatePicker.SelectedDate != DateTime.MinValue)
                    assignment.PlanFinishDate = DueDatePicker.SelectedDate;
                else
                    assignment.PlanFinishDate = null;
                BusinessManager.Update(assignment);
            }

            // Close popup
            if (!String.IsNullOrEmpty(Request["closeFramePopup"]))
            {
                CommandParameters cp = new CommandParameters();
                if (Request["ReturnCommand"] != null)
                    cp.CommandName = Request["ReturnCommand"];
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, string.Empty, true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                    "<script language='javascript'>" +
                    "try {window.opener.location.href=window.opener.location.href;}" +
                    "catch (e){} window.close();</script>");
            }
        }
Пример #7
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(ClassName))
            {
                MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName);

                HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc);
                historyInfo.SelectedFields.Add(FieldList.SelectedValue);
                HistoryManager.SetInfo(mc, historyInfo);

                ListViewProfile[] mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
                if (mas.Length == 0)
                {
                    CHelper.GetHistorySystemListViewProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
                    mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
                }
                if (!mas[0].FieldSet.Contains(FieldList.SelectedValue))
                {
                    mas[0].FieldSet.Add(FieldList.SelectedValue);
                    mas[0].ColumnsUI.Add(new ColumnProperties(FieldList.SelectedValue, "150px", String.Empty));
                    ListViewProfile.SaveSystemProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList", Mediachase.IBN.Business.Security.CurrentUser.UserID, mas[0]);
                }

                CommandParameters cp = new CommandParameters(CommandName);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
                //CHelper.UpdateModalPopupContainer(this, ContainerId);
                //CHelper.RequireDataBind();
            }
        }
        public override string Execute(string sourceText, CommandParameters parameters)
        {
            //create regular expression object from Text
            string resultText = string.Empty;

            if (parameters.TextToAppend != string.Empty && parameters.FirstBorder != string.Empty)
            {
                //escape from special symbols
                string TextToReplace = Regex.Escape(parameters.FirstBorder);

                Regex regText;
                // Case check
                if (parameters.IsCaseSensitive == false)
                    regText = new Regex(TextToReplace, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                else
                    regText = new Regex(TextToReplace, RegexOptions.Multiline);

                resultText = regText.Replace(sourceText, parameters.TextToAppend);

                if(sourceText.CompareTo(resultText) == 0)
                    throw new SimpleEditException((string)App.Current.FindResource("TextNotFoundError"));
            }
            else
                throw new SimpleEditException((string)App.Current.FindResource("ErrorCommandParametersEmpty"));

            return resultText;
        }
Пример #9
0
        public void Execute(MessageSender source, IrcMessage message, CommandParameters parameters)
        {
            if (parameters.Count == 0 || parameters.Count > 1)
                throw new ParameterException();

            bot.PartChannel(parameters[0]);
        }
Пример #10
0
 void btnOnlyThis_Click(object sender, EventArgs e)
 {
     PrimaryKeyId pKey = PrimaryKeyId.Parse(Request["ObjectId"]);
     CommandParameters cp = new CommandParameters(Request["CommandName"]);
     cp.CommandArguments = new Dictionary<string, string>();
     cp.AddCommandArgument("Uid", pKey.ToString());
     CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
 }
Пример #11
0
        private string GetPassword(CommandParameters parameters)
        {
            var password = "";
            if (parameters.Count > 1)
                password = parameters[1];

            return password;
        }
Пример #12
0
 protected void AddButton_Click(object sender, EventArgs e)
 {
     if (Process())
     {
         CommandParameters cp = new CommandParameters("MC_TimeTracking_QuickAddManagerFrame");
         Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterRefreshParentFromFrameScript(this.Page, cp.ToString());
     }
 }
Пример #13
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     CommandParameters cp = new CommandParameters(_refreshCommand);
     cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
     cp.AddCommandArgument("Type", _type);
     cp.AddCommandArgument("Variant", rbList.SelectedValue);
     Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
 }
Пример #14
0
        public void Execute(MessageSender executor, IrcMessage message, CommandParameters parameters)
        {
            if (parameters.Count == 0)
                return;

            var sendToServerMessage = GetParametersInOneSentence(parameters);

            bot.SendToServer(sendToServerMessage);
        }
Пример #15
0
        protected void Add_Click(object sender, System.EventArgs e)
        {
            int RelProjectId = int.Parse(hdnProjectId.Value);
            if (ProjectId > 0 && ProjectId != RelProjectId)
                Project2.AddRelation(ProjectId, RelProjectId);

            CommandParameters cp = new CommandParameters("MC_PM_Redirect");
            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Пример #16
0
        public void Execute(MessageSender source, IrcMessage message, CommandParameters parameters)
        {
            if (parameters == null || parameters.Count == 0)
                return;

            var sayToMessage = GetMessageFromParameters(parameters);

            bot.SayTo(source.Channel, sayToMessage);
        }
Пример #17
0
        public void Execute(MessageSender executor, IrcMessage message, CommandParameters parameters)
        {
            var commands = bot.GetAllCommands();

            foreach (var command in commands)
            {
                bot.SayTo(executor.Channel, command.GetKeyWord());
            }
        }
Пример #18
0
        void btnSave_ServerClick(object sender, EventArgs e)
        {
            Mediachase.IBN.Business.PortalConfig.MdsDeliveryTimeout = int.Parse(txtDeliveryTimeout.Text) * 24 * 60;
            Mediachase.IBN.Business.PortalConfig.MdsMaxDeliveryAttempts = int.Parse(txtAttempts.Text);
            Mediachase.IBN.Business.PortalConfig.MdsDeleteOlderMoreThan = int.Parse(txtLogPeriod.Text) * 24 * 60;

            CommandParameters cp = new CommandParameters("MC_MUI_ChangeSettings");
            CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Пример #19
0
        public static void CommandMain(CommandParameters parameters, ICommandExecutor executor)
        {
            var targets = from Character c in executor.Server.Characters where c.Name == parameters.Get<string>(0) select c;
            if (targets.Count() == 0)
                throw new Exception("Target not found");
            Character target = targets.First<Character>();

            String title = parameters.Get<String>(1, "");
            target.Title = title;
        }
Пример #20
0
 private string GetParametersInOneSentence(CommandParameters parameters)
 {
     var sendToServerMessage = new StringBuilder();
     foreach (var parameter in parameters)
     {
         sendToServerMessage.Append(parameter);
         sendToServerMessage.Append(" ");
     }
     return sendToServerMessage.ToString().TrimEnd();
 }
Пример #21
0
        public void Execute(Command command, MessageSender executor, IrcMessage message, CommandParameters parameters)
        {
            var isExecutionAllowed = securityLevelChecker.IsCommandExecutionAllowed(command, bot, executor.HostMask);
            if (!isExecutionAllowed)
            {
                bot.SayTo(executor.Channel, "You don't have required permission for this command");
                return;
            }

            command.Execute(executor, message, parameters);
        }
Пример #22
0
        protected void btnSave_ServerClick(object sender, System.EventArgs e)
        {
            if (ddGroups.SelectedItem != null)
            {
                int PTodoID = int.Parse(ddGroups.SelectedValue);

                Mediachase.IBN.Business.ToDo.CreateToDoLink(ToDoID, PTodoID);
            }
            CommandParameters cp = new CommandParameters("MC_PM_ToDoRedirect");
            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Пример #23
0
        private string GetMessageFromParameters(CommandParameters parameters)
        {
            var sayToMessage = new StringBuilder();

            for (int i = 0; i < parameters.Count; i++)
            {
                sayToMessage.AppendFormat("{0} ", parameters[i]);
            }

            return sayToMessage.ToString().TrimEnd();
        }
Пример #24
0
 private void BindToolbar()
 {
     secHeader.AddText(LocRM.GetString("ProjectTeam"));
     if (_isManager)
     {
         CommandManager cm = CommandManager.GetCurrent(this.Page);
         CommandParameters cp = new CommandParameters("MC_PM_TeamEdit");
         string cmd = cm.AddCommand("Project", "", "ProjectView", cp);
         cmd = cmd.Replace("\"", "&quot;");
         secHeader.AddRightLink("<img alt='' src='../Layouts/Images/icons/newgroup.gif'/> " + LocRM.GetString("Modify"), "javascript:" + cmd); //"javascript:ShowWizard('TeamEditor.aspx?ProjectId=" + ProjectId + "', 650, 350);");
     }
 }
 /// <summary>
 /// Executes a command
 /// </summary>
 /// <param name="command">Command to execute</param>
 /// <param name="parameters">Command parameters</param>
 public void Execute( Command command, CommandParameters parameters )
 {
     m_Log.InfoFormat( "Executing command \"{0}\"", command );
     foreach ( ICommandExecutor executor in m_CommandExecutors.Executors )
     {
         if ( executor.Execute( this, command, parameters ) == CommandExecutionResult.StopExecutingCommand )
         {
             m_Log.InfoFormat( "Executing of command \"{0}\" was stopped by executor \"{1}\"", command, executor );
             return;
         }
     }
 }
        public override string Execute(string sourceText, CommandParameters parameters)
        {
            //create regular expression object from Text
            string resultText = string.Empty;

            if (parameters.TextToAppend != string.Empty)
                resultText = sourceText.Insert(0, parameters.TextToAppend);
            else
                throw new SimpleEditException((string)App.Current.FindResource("ErrorCommandParametersEmpty"));

            return resultText;
        }
Пример #27
0
        public static void CommandMain(CommandParameters parameters, ICommandExecutor executor)
        {
            var targets = from Character c in executor.Server.Characters where c.Name == parameters.Get<String>(0) select c;
            if (targets.Count() == 0)
                throw new Exception("Target not found");
            Character target = targets.First<Character>();

            AdminLevel level = (AdminLevel)parameters.Get<int>(1);
            if (!Enum.IsDefined(typeof(AdminLevel), level))
                throw new Exception(String.Format("Admin level out of range ({0})", (int)level));
            target.Admin = level;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="search"></param>
 /// <param name="source"></param>
 /// <param name="start"></param>
 /// <returns></returns>
 private Match FindNextMatch(string search, string source, int start, CommandParameters parameters)
 {
     string Text = Regex.Escape(search);
     Regex regToText;
     // Case check
     if (parameters.IsCaseSensitive == false)
         regToText = new Regex(Text, RegexOptions.Multiline | RegexOptions.IgnoreCase);
     else
         regToText = new Regex(Text, RegexOptions.Multiline);
     // Find first occurrence of To in sourceText.
     Match match = regToText.Match(source, start);
     return match;
 }
Пример #29
0
        /// <summary>
        /// Handles the Click event of the TransitionButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void TransitionButton_Click(object sender, EventArgs e)
        {
            if (BlockId > 0 && TransitionList.Items.Count > 0 && TransitionList.SelectedItem != null)
            {
                string selectedTransition = TransitionList.SelectedValue;
                TimeTrackingManager.MakeTransitionWithComment(BlockId, new Guid(selectedTransition), TTBlockComment.Value);

                string cmd = String.Empty;
                if (Request["cmd"] != null)
                    cmd = Request["cmd"];
                CommandParameters cp = new CommandParameters(cmd);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
        }
Пример #30
0
        public void Execute(MessageSender executor, IrcMessage message, CommandParameters parameters)
        {
            if (parameters.Count == 0 || parameters.Count > 2)
            {
                var invalidParametersMessage = string.Format("Invalid amount of parameters. Usage: {0} {1} [{2}]",
                                                             GetKeyWord(), "#channel", "password");
                bot.SayTo(executor.Channel, invalidParametersMessage);
                return;
            }

            var channel = parameters[0];
            var password = GetPassword(parameters);

            bot.JoinChannel(channel, password);
        }
Пример #31
0
        public void btnDoImport_Click(object sender, EventArgs e)
        {
            CommandParameters           cp  = new CommandParameters("cmdDoImport");
            Dictionary <string, string> dic = new Dictionary <string, string>();

            if (rbExistingSite.Checked)
            {
                dic["SiteId"] = ddlExistingSite.SelectedValue;
            }
            else
            {
                dic["SiteId"] = Guid.Empty.ToString();
            }

            cp.CommandArguments = dic;

            CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
        public void Ctor_OutputPathExists_DoesNotCreatesOutputPath()
        {
            using (ShimsContext.Create())
            {
                int directoryCreates = 0;

                ShimDirectory.ExistsString          = (_) => true;
                ShimDirectory.CreateDirectoryString = (_) =>
                {
                    directoryCreates++;
                    return(new ShimDirectoryInfo());
                };

                CommandParameters parameters = BuildParameters();
                new LocationHelper(parameters);
                Assert.AreEqual(0, directoryCreates);
            }
        }
        protected override async Task Invoke(MapDocument document, CommandParameters parameters)
        {
            var tl = document.Map.Data.GetOne <DisplayFlags>() ?? new DisplayFlags();

            tl.HideNullTextures = !tl.HideNullTextures;

            var tc = await document.Environment.GetTextureCollection();

            await MapDocumentOperation.Perform(document,
                                               new TrivialOperation(
                                                   x => x.Map.Data.Replace(tl),
                                                   x =>
            {
                x.Update(tl);
                x.UpdateRange(x.Document.Map.Root.Find(s => s is Solid).Where(s => s.Data.Get <Face>().Any(f => tc.IsNullTexture(f.Texture.Name))));
            })
                                               );
        }
Пример #34
0
 public Query CreateQuery(string sql, CommandParameters values)
 {
     throw new NotSupportedException();
     //var query = Connection.createQuery(sql, values, cb);
     //query = new Query(parser, writer, sql, values);
     //query.typeCast = config.typeCast;
     //query.Start(socket, handshake.protocol41, config);
     //if (socket == null)
     //{
     //    CreateNewSocket();
     //}
     //var query = new Query(this, sql, values);
     //if (MAX_ALLOWED_PACKET > 0)
     //{
     //    query.SetMaxSend(MAX_ALLOWED_PACKET);
     //}
     //return query;
 }
Пример #35
0
        public CommandParameters CreateParametersFromMessage(string completeMessage)
        {
            var words = completeMessage.Split(' ');

            if (words.Length <= 1)
            {
                return(new CommandParameters());
            }

            var parameters = new CommandParameters();

            for (var i = 1; i < words.Length; i++)
            {
                parameters.AddParameter(words[i]);
            }

            return(parameters);
        }
Пример #36
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                DefaultDataBind();
                if (String.IsNullOrEmpty(_uid))
                {
                    hfValue.Value = "Panel3";
                }
                else
                {
                    hfValue.Value = "Panel1";
                }
                if (!String.IsNullOrEmpty(_uid))
                {
                    BindSavedValues();
                }
            }
            ApplyLocalization();

            if (!_showFilters)
            {
                tab2Gap.Visible = false;
                tdTab2.Visible  = false;
                panel2.Visible  = false;
            }
            if (!_showGrouping)
            {
                tab4Gap.Visible = false;
                tdTab4.Visible  = false;
                panel4.Visible  = false;
            }
            if (_isSystem)
            {
                cbIsPublic.Checked = true;
                cbIsPublic.Visible = false;
            }
            btnClose.OnClientClick = Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, String.Empty, false, true);

            //add command for filters
            CommandParameters cp = new CommandParameters("MC_MUI_EntityDDSmall");

            CommandManager.GetCurrent(this.Page).AddCommand(string.Empty, string.Empty, string.Empty, cp);
        }
Пример #37
0
        private void BindToolbar()
        {
            secHeader.AddText(LocRM.GetString("tRelProjects"));

            if (Project.CanUpdate(ProjectId))
            {
                ComponentArt.Web.UI.MenuItem topMenuItem = new ComponentArt.Web.UI.MenuItem();
                topMenuItem.Text                = /*"<img border='0' src='../Layouts/Images/downbtn.gif' width='9px' height='5px' align='absmiddle'/>&nbsp;" + */ LocRM2.GetString("Actions");
                topMenuItem.Look.LeftIconUrl    = ResolveUrl("~/Layouts/Images/downbtn1.gif");
                topMenuItem.Look.LeftIconHeight = Unit.Pixel(5);
                topMenuItem.Look.LeftIconWidth  = Unit.Pixel(16);
                topMenuItem.LookId              = "TopItemLook";

                ComponentArt.Web.UI.MenuItem subItem;

                CommandManager    cm  = CommandManager.GetCurrent(this.Page);
                CommandParameters cp  = new CommandParameters();
                string            cmd = String.Empty;

                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/xp-paste.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp  = new CommandParameters("MC_PM_RelatedPrjClipboard");
                cmd = cm.AddCommand("Project", "", "ProjectView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM2.GetString("tPastePrjFromClipboard");
                topMenuItem.Items.Add(subItem);

                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/relprojects.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp  = new CommandParameters("MC_PM_RelatedPrj");
                cmd = cm.AddCommand("Project", "", "ProjectView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM2.GetString("AddRelated");
                topMenuItem.Items.Add(subItem);

                secHeader.ActionsMenu.Items.Add(topMenuItem);
            }
        }
Пример #38
0
        public bool IsEnable(object Sender, object Element)
        {
            bool retval = false;

            if (HttpContext.Current.Items.Contains("OwnerTypeId") && HttpContext.Current.Items.Contains("OwnerId"))
            {
                int ownerTypeId = (int)HttpContext.Current.Items["OwnerTypeId"];
                int ownerId     = (int)HttpContext.Current.Items["OwnerId"];

                bool canUpdate = false;
                if (ownerTypeId == (int)ObjectTypes.Document)
                {
                    canUpdate = Document.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.Task)
                {
                    canUpdate = Task.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.ToDo)
                {
                    canUpdate = ToDo.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.Issue)
                {
                    canUpdate = Incident.CanUpdate(ownerId);
                }

                if (canUpdate && Element is CommandParameters)
                {
                    CommandParameters cp = (CommandParameters)Element;

                    if (cp.CommandArguments["primaryKeyId"] == null)
                    {
                        throw new ArgumentException("PrimaryKeyId is null for WFInstanceStartEnableHandler");
                    }

                    PrimaryKeyId           pk     = PrimaryKeyId.Parse(cp.CommandArguments["primaryKeyId"]);
                    WorkflowInstanceEntity entity = (WorkflowInstanceEntity)BusinessManager.Load(WorkflowInstanceEntity.ClassName, pk);
                    retval = (entity.State == (int)BusinessProcessState.Pending);
                }
            }

            return(retval);
        }
Пример #39
0
        public override string Execute(string sourceText, CommandParameters parameters)
        {
            if (string.IsNullOrEmpty(parameters.TextToAppend) || string.IsNullOrEmpty(parameters.FirstBorder))
            {
                throw new SimpleEditException((string)App.Current.FindResource("ErrorCommandParametersEmpty"));
            }

            // Escape from special symbols.
            string TextToReplace = Regex.Escape(parameters.FirstBorder);
            Regex  regText;

            // Case check
            if (parameters.IsCaseSensitive == false)
            {
                regText = new Regex(TextToReplace, RegexOptions.Multiline | RegexOptions.IgnoreCase);
            }
            else
            {
                regText = new Regex(TextToReplace, RegexOptions.Multiline);
            }
            // Generate Match collection: find all occurrences of TextToReplase in sourceText.
            MatchCollection mc = regText.Matches(sourceText);

            if (mc.Count > 0)
            {
                string TextToAppend = parameters.TextToAppend;
                int    AppendLength = TextToAppend.Length;
                // Replace text in all occurrences.
                int Index    = 0;
                int IndexAdd = 0; //every time we add text, indexes changes
                foreach (Match match in mc)
                {
                    Index      = match.Index + IndexAdd;
                    sourceText = sourceText.Insert(Index, TextToAppend);
                    IndexAdd  += AppendLength;
                }
            }
            else
            {
                throw new SimpleEditException((string)App.Current.FindResource("TextNotFoundError"));
            }

            return(sourceText);
        }
Пример #40
0
        private void BindMenu(ComponentArt.Web.UI.Menu menu, string link1, string link2)
        {
            ComponentArt.Web.UI.MenuItem topMenuItem = new ComponentArt.Web.UI.MenuItem();
            topMenuItem.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:tActions}");
            topMenuItem.DefaultSubGroupExpandDirection = ComponentArt.Web.UI.GroupExpandDirection.BelowRight;
            topMenuItem.Look.LeftIconUrl    = "~/Layouts/Images/downbtn1.gif";
            topMenuItem.Look.LeftIconHeight = Unit.Pixel(5);
            topMenuItem.Look.LeftIconWidth  = Unit.Pixel(16);
            topMenuItem.LookId = "TopItemLook";

            ComponentArt.Web.UI.MenuItem subItem;

            subItem = new ComponentArt.Web.UI.MenuItem();
            subItem.Look.LeftIconUrl    = "~/Layouts/Images/nfolder.gif";
            subItem.Look.LeftIconWidth  = Unit.Pixel(16);
            subItem.Look.LeftIconHeight = Unit.Pixel(16);
            subItem.NavigateUrl         = link1;
            subItem.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:tAddFolder}");
            topMenuItem.Items.Add(subItem);

            subItem = new ComponentArt.Web.UI.MenuItem();
            subItem.Look.LeftIconUrl    = "~/Layouts/Images/listsnew.gif";
            subItem.Look.LeftIconWidth  = Unit.Pixel(16);
            subItem.Look.LeftIconHeight = Unit.Pixel(16);
            subItem.NavigateUrl         = link2;
            subItem.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:tAddList}");
            topMenuItem.Items.Add(subItem);

            subItem = new ComponentArt.Web.UI.MenuItem();
            subItem.Look.LeftIconUrl    = "~/Layouts/Images/import.gif";
            subItem.Look.LeftIconWidth  = Unit.Pixel(16);
            subItem.Look.LeftIconHeight = Unit.Pixel(16);
            CommandManager    cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("MC_ListApp_ImportWizard");

            cp.CommandArguments = new Dictionary <string, string>();
            cp.AddCommandArgument("ListFolderId", _folderId.ToString());
            subItem.ClientSideCommand = cm.AddCommand("", "", "ListInfoList", cp);
            subItem.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:ImportListMenu}");
            topMenuItem.Items.Add(subItem);

            menu.Items.Add(topMenuItem);
        }
Пример #41
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="search"></param>
        /// <param name="source"></param>
        /// <param name="start"></param>
        /// <returns></returns>
        private Match FindNextMatch(string search, string source, int start, CommandParameters parameters)
        {
            string Text = Regex.Escape(search);
            Regex  regToText;

            // Case check
            if (parameters.IsCaseSensitive == false)
            {
                regToText = new Regex(Text, RegexOptions.Multiline | RegexOptions.IgnoreCase);
            }
            else
            {
                regToText = new Regex(Text, RegexOptions.Multiline);
            }
            // Find first occurrence of To in sourceText.
            Match match = regToText.Match(source, start);

            return(match);
        }
        internal void SendReportNow(List <ADComputer> targetComputers, string login, string password)
        {
            Logger.EnteringMethod("On : " + targetComputers.Count + " computers. With Login " + login);
            CommandParameters parameters = new CommandParameters();

            parameters.TargetComputers = targetComputers;
            parameters.CommandLine     = @"WuAuClt /ReportNow";
            parameters.Login           = login;
            parameters.Password        = password;
            success = 0;
            failed  = 0;

            prgBarSendCommand.Value   = 1;
            prgBarSendCommand.Maximum = targetComputers.Count + 1;
            prgBarSendCommand.Refresh();

            System.Threading.Thread commandThread = new System.Threading.Thread(SendCommand);
            commandThread.Start(parameters);
        }
Пример #43
0
        static Command CommandFromParameters(CommandParameters parameters, MaybeManagedConnection conn)
        {
            var cmd = new SqlCommand(parameters.CommandText, conn.Open().Connection);

            if (cmd.CommandText.StartsWith("[") || IndexOfNonWhitespace(cmd.CommandText) == -1)
            {
                cmd.CommandType = CommandType.StoredProcedure;
            }

            if (parameters.Parameters != null)
            {
                foreach (var p in parameters.Parameters)
                {
                    cmd.Parameters.Add(p);
                }
            }

            return(new Sql_Command(cmd));
        }
Пример #44
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;
                if (cp.CommandArguments == null)
                {
                    return;
                }
                DateTime dtStart = DateTime.Parse(cp.CommandArguments["primaryKeyId"], CultureInfo.InvariantCulture);

                MetaView             currentView = DataContext.Current.MetaModel.MetaViews["TT_MyGroupByWeekProject"];
                McMetaViewPreference pref        = CHelper.GetMetaViewPreference(currentView);
                pref.SetAttribute <DateTime>("TTFilter_DTCWeek", "TTFilter_DTCWeek", dtStart);
                Mediachase.Ibn.Core.UserMetaViewPreference.Save(Mediachase.IBN.Business.Security.CurrentUser.UserID, pref);

                ((System.Web.UI.Control)(Sender)).Page.Response.Redirect("~/Apps/TimeTracking/Pages/Public/ListTimeTrackingNew.aspx?ViewName=TT_MyGroupByWeekProject", true);
            }
        }
Пример #45
0
        /// <summary>
        /// Invokes the specified sender.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="element">The element.</param>
        public void Invoke(object sender, object element)
        {
            if (!ProfileContext.Current.CheckPermission("content:site:mng:delete"))
            {
                throw new UnauthorizedAccessException("Current user does not have enough rights to access the requested operation.");
            }

            if (element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)element;

                string   gridId = cp.CommandArguments["GridId"];
                string[] items  = EcfListView.GetCheckedCollection(((Control)sender).Page, gridId);

                if (items != null)
                {
                    int    error        = 0;
                    string errorMessage = String.Empty;
                    try
                    {
                        ProcessDeleteCommand(items);

                        ManagementHelper.SetBindGridFlag(gridId);
                    }
                    catch (Exception ex)
                    {
                        error++;
                        errorMessage = ex.Message;
                    }

                    if (error > 0)
                    {
                        errorMessage = errorMessage.Replace("'", "\\'").Replace(Environment.NewLine, "\\n");
                        ClientScript.RegisterStartupScript(((Control)sender).Page, ((Control)sender).Page.GetType(), Guid.NewGuid().ToString("N"),
                                                           String.Format("alert('{0}{1}');", "Failed to delete item(s). Error: ", errorMessage), true);
                    }
                }
                else
                {
                    return;
                }
            }
        }
Пример #46
0
        public void Invoke(object Sender, object Element)
        {
            CommandParameters cp = (CommandParameters)Element;

            string[] selectedElements = EntityGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);

            if (selectedElements != null && selectedElements.Length > 0)
            {
                int errorCount = 0;
                using (TransactionScope tran = DataContext.Current.BeginTransaction())
                {
                    foreach (string elem in selectedElements)
                    {
                        string[]     parts = elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                        string       id    = parts[0];
                        PrimaryKeyId key   = PrimaryKeyId.Parse(id);

                        try
                        {
                            DocumentContentVersionEntity dcve = (DocumentContentVersionEntity)BusinessManager.Load(DocumentContentVersionEntity.GetAssignedMetaClassName(), key);
                            dcve.State = (int)DocumentContentVersionState.Draft;
                            UpdateStateRequest usr = new UpdateStateRequest(dcve);
                            BusinessManager.Execute(usr);
                        }
                        catch (Exception ex)
                        {
                            CHelper.GenerateErrorReport(ex);
                            errorCount++;
                        }
                    }

                    tran.Commit();
                }

                if (errorCount > 0)
                {
                    ((CommandManager)Sender).InfoMessage = CHelper.GetResFileString("{IbnFramework.Common:NotAllSelectedItemsWereProcessed}");
                }

                CHelper.RequireBindGrid();
            }
        }
Пример #47
0
        /// <summary>
        /// Invokes the specified sender.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="element">The element.</param>
        public void Invoke(object sender, object element)
        {
            if (element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)element;

                string   gridId = cp.CommandArguments["GridId"];
                string[] items  = EcfListView.GetCheckedCollection(((Control)sender).Page, gridId);

                if (items != null)
                {
                    int    error        = 0;
                    string errorMessage = String.Empty;
                    try
                    {
                        ProcessDeleteCommand(items,
                                             ManagementHelper.GetIntFromQueryString("catalogid"),
                                             ManagementHelper.GetIntFromQueryString("catalognodeid"));

                        ManagementHelper.SetBindGridFlag(gridId);
                    }
                    catch (Exception ex)
                    {
                        error++;
                        errorMessage = ex.Message;
                    }

                    if (error > 0)
                    {
                        errorMessage = errorMessage.Replace("'", "\\'").Replace(Environment.NewLine, "\\n");
                        ClientScript.RegisterStartupScript(((Control)sender).Page, ((Control)sender).Page.GetType(), Guid.NewGuid().ToString("N"),
                                                           String.Format("alert('{0}{1}');", "Failed to delete item(s). Error: ", errorMessage), true);
                    }
                }
                else
                {
                    return;
                }

                //NameValueCollection qs = ((Control)sender).Page.Request.QueryString;
            }
        }
Пример #48
0
        protected override async Task Invoke(MapDocument document, CommandParameters parameters)
        {
            var grid = document.Map.Data.GetOne <GridData>();

            if (grid == null)
            {
                return;
            }

            var tl = document.Map.Data.GetOne <TransformationFlags>() ?? new TransformationFlags();

            var transaction = new Transaction();

            foreach (var mo in document.Selection.GetSelectedParents().ToList())
            {
                var box = mo.BoundingBox;

                var start   = box.Start;
                var snapped = grid.Grid.Snap(start);
                var trans   = snapped - start;
                if (trans == Vector3.Zero)
                {
                    continue;
                }

                var tform = Matrix4x4.CreateTranslation(trans);

                var transformOperation = new BspEditor.Modification.Operations.Mutation.Transform(tform, mo);
                transaction.Add(transformOperation);

                // Check for texture transform
                if (tl.TextureLock)
                {
                    transaction.Add(new TransformTexturesUniform(tform, mo.FindAll()));
                }
            }

            if (!transaction.IsEmpty)
            {
                await MapDocumentOperation.Perform(document, transaction);
            }
        }
Пример #49
0
        public bool IsEnable(object Sender, object Element)
        {
            if (Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
            {
                return(false);
            }

            if (Element is CommandParameters)
            {
                CommandParameters cp  = (CommandParameters)Element;
                string            sid = cp.CommandArguments["primaryKeyId"];

                string[] elem = sid.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                //type, id, _containerName, _containerKey
                if (elem.Length != 4)
                {
                    return(false);
                }

                int id = -1;
                int.TryParse(elem[0], out id);

                FileStorage fs = FileStorage.Create(elem[2], elem[3]);
                if (id == 1)
                {
                    DirectoryInfo di = fs.GetDirectory(int.Parse(elem[1]));
                    if (fs.CanUserWrite(di.Parent))
                    {
                        return(true);
                    }
                }
                if (id == 2)
                {
                    FileInfo fi = fs.GetFile(int.Parse(elem[1]));
                    if (fs.CanUserWrite(fi.ParentDirectory))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        public bool IsEnable(object Sender, object Element)
        {
            bool retval = true;

            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

                if (cp.CommandArguments["primaryKeyId"] == null)
                {
                    throw new ArgumentException("PrimaryKeyId is null for SetDefaultOrgAddressEnableHandler");
                }

                PrimaryKeyId pk     = PrimaryKeyId.Parse(cp.CommandArguments["primaryKeyId"]);
                EntityObject entity = BusinessManager.Load(AddressEntity.GetAssignedMetaClassName(), pk);
                retval = !(bool)entity.Properties["IsDefaultOrganizationElement"].Value;
            }

            return(retval);
        }
Пример #51
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Control divContainer = CommandManager.GetCurrent(this.Page).Parent.FindControl(CommandManager.GetCurrent(this.Page).ContainerId);

            if (divContainer != null)
            {
                cpManagerExtender.ContainerId = divContainer.ClientID;
            }

            CommandParameters           cp  = new CommandParameters("MC_Workspace_PropertyPage");
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("controlUid", "%controlUid%");
            cp.CommandArguments = dic;

            cpManagerExtender.PropertyPageCommand = CommandManager.GetCurrent(this.Page).AddCommand(string.Empty, string.Empty, "Workspace", cp);
            cpManagerExtender.DeleteMessage       = CHelper.GetResFileString("{IbnFramework.Global:_mc_RemoveBlock}");

            LoadScripts();
        }
Пример #52
0
 public bool IsEnable(object Sender, object Element)
 {
     if (Element is CommandParameters)
     {
         CommandParameters cp   = (CommandParameters)Element;
         string            uid  = ((Control)Sender).Page.Request["ObjectId"];
         PrimaryKeyId      pKey = PrimaryKeyId.Parse(uid);
         EntityObject      eo   = BusinessManager.Load(CalendarEventEntity.ClassName, pKey);
         if (eo != null)
         {
             CalendarEventEntity ceo = eo as CalendarEventEntity;
             if (ceo.CalendarEventExceptionId.HasValue)
             {
                 return(false);
             }
         }
         return(((VirtualEventId)pKey).IsRecurrence);
     }
     return(false);
 }
Пример #53
0
        public bool IsEnable(object Sender, object Element)
        {
            bool retval = true;

            if (Element is CommandParameters)
            {
                CommandParameters cp        = (CommandParameters)Element;
                DateTime          startDate = DateTime.Parse(cp.CommandArguments["primaryKeyId"], CultureInfo.InvariantCulture);
                WeekItemInfo[]    mas       = Mediachase.IBN.Business.TimeTracking.GetWeekItemsForCurrentUser(startDate, startDate.AddDays(6));
                if (mas.Length > 0)
                {
                    WeekItemInfo wii = mas[0];
                    if (wii.Status == WeekItemStatus.NotCompleted)
                    {
                        return(false);
                    }
                }
            }
            return(retval);
        }
Пример #54
0
        public async Task Invoke(IContext context, CommandParameters parameters)
        {
            var filter = _loaders.Select(x => x.Value).Select(x => x.FileTypeDescription + "|" + String.Join(";", x.SupportedFileExtensions.SelectMany(e => e.Extensions).Select(e => "*" + e))).ToList();

            filter.Add("All files|*.*");
            using (var ofd = new OpenFileDialog {
                Filter = String.Join("|", filter)
            })
            {
                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                await Oy.Publish("Command:Run", new CommandMessage("Internal:OpenDocument", new
                {
                    Path = ofd.FileName
                }));
            }
        }
Пример #55
0
 private void BindToolbar()
 {
     if (dgMembers.Items.Count == 0)
     {
         this.Visible = false;
     }
     else
     {
         secHeader.AddText(LocRM.GetString("tbDocumentRes"));
         if (Document.CanModifyResources(DocumentID))
         {
             CommandManager    cm  = CommandManager.GetCurrent(this.Page);
             CommandParameters cp  = new CommandParameters("MC_DM_DocRes");
             string            cmd = cm.AddCommand("Document", "", "DocumentView", cp);
             cmd = cmd.Replace("\"", "&quot;");
             secHeader.AddRightLink("<img alt='' src='../Layouts/Images/icons/editgroup.gif'/> " + LocRM.GetString("Modify"), "javascript:" + cmd);
             //secHeader.AddRightLink("<img alt='' src='../Layouts/Images/icons/editgroup.gif'/> " + LocRM.GetString("Modify"), "javascript:ModifyResources(" + DocumentID + ")");
         }
     }
 }
Пример #56
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Control divContainer = CommandManager.GetCurrent(this.Page).Parent.FindControl(CommandManager.GetCurrent(this.Page).ContainerId);

            if (divContainer != null)
            {
                cpManagerExtender.ContainerId = divContainer.ClientID;
            }

            CommandParameters           cp  = new CommandParameters("cmdCoreLayoutPropertyPage");
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("controlUid", "%controlUid%");
            cp.CommandArguments = dic;

            cpManagerExtender.PropertyPageCommand = CommandManager.GetCurrent(this.Page).AddCommand(string.Empty, "Core", "LayoutManage", cp);
            cpManagerExtender.DeleteMessage       = "Are you sure you want to remove the block?";

            BindScripts();
        }
Пример #57
0
        private void lbCopyFile_Click(object sender, EventArgs e)
        {
            int FileId = int.Parse(hdnFileId.Value);

            try
            {
                fs.CopyFile(FileId, FolderId);
            }
            catch { }

            if (Request["New"] != null)
            {
                CommandParameters cp = new CommandParameters("FL_Clipboard_Paste");
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
            {
                CHelper.CloseItAndRefresh(Response);
            }
        }
        public override String Execute(string sourceText, CommandParameters parameters)
        {
            if (parameters.FirstBorder == string.Empty)
            {
                throw new SimpleEditException((string)App.Current.FindResource("ErrorCommandParametersEmpty"));
            }
            int RemoveLength = 0;

            try
            {
                // Get count of symbols to remove.
                RemoveLength = Convert.ToInt32(parameters.FirstBorder);
                sourceText   = sourceText.Remove(sourceText.Length - RemoveLength, RemoveLength);
            }
            catch (Exception)
            {
                throw new SimpleEditException((string)App.Current.FindResource("ErrorNumericParameter"));
            }
            return(sourceText);
        }
        public void Ctor_ValuesInDictionary_HasCaseInsensitiveMatchingProperties_UsedConfigFileIsFalse()
        {
            Dictionary <string, string> input = new Dictionary <string, string>
            {
                { Key1, StringValue },
                { Key2, LongAsString },
                { Key3, BoolAsString }
            };

            CommandParameters parameters = new CommandParameters(input, string.Empty);

            Assert.IsFalse(parameters.UsedConfigFile);
            Assert.AreEqual(input.Count, parameters.ConfigCopy.Count);
            Assert.IsTrue(parameters.TryGetString(Key1.ToUpper(), out string value));
            Assert.AreEqual(StringValue, value);
            Assert.IsTrue(parameters.TryGetString(Key2.ToLower(), out value));
            Assert.AreEqual(LongAsString, value);
            Assert.IsTrue(parameters.TryGetString(Key3, out value));
            Assert.AreEqual(BoolAsString, value);
        }
Пример #60
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.Page.Validate();
            if (!this.Page.IsValid)
            {
                return;
            }

            if (ObjectId != PrimaryKeyId.Empty)
            {
                _bindObject = MetaObjectActivator.CreateInstance <BusinessObject>(MetaDataWrapper.ResolveMetaClassByNameOrCardName(ClassName), ObjectId);
            }
            else
            {
                _bindObject = MetaObjectActivator.CreateInstance <BusinessObject>(MetaDataWrapper.ResolveMetaClassByNameOrCardName(ClassName));
            }

            if (_bindObject != null)
            {
                ProcessCollection(this.Page.Controls, (BusinessObject)_bindObject);

                ((BusinessObject)_bindObject).Save();

                PrimaryKeyId objectId = ((BusinessObject)_bindObject).PrimaryKeyId.Value;

                if (Mode.ToLower() == "popup")
                {
                    string param = "";
                    if (!String.IsNullOrEmpty(CommandName))
                    {
                        CommandParameters cp = new CommandParameters(CommandName);
                        param = cp.ToString();
                    }
                    Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, param);
                }
                else
                {
                    Response.Redirect(CHelper.GetLinkObjectView_Edit(ClassName, objectId.ToString()));
                }
            }
        }