Esempio n. 1
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);
        }
Esempio n. 2
0
        private string GetCurrentLink(int iFolderId)
        {
            CommandManager    cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("FL_ChangeFolder");

            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("ContainerKey", _containerKey);
            cp.AddCommandArgument("FolderId", iFolderId.ToString());
            string retVal = "javascript:" + cm.AddCommand(_className, _viewName, _placeName, cp);

            retVal = retVal.Replace("\"", "&quot;");
            return(retVal);

            //string sPath = HttpContext.Current.Request.Url.LocalPath;
            //if (Request["ProjectId"] != null)
            //    sPath += String.Format("?ProjectId={0}&FolderId={1}&SubTab=0", Request["ProjectId"], iFolderId);
            //else if (Request["IncidentId"] != null)
            //    sPath += String.Format("?IncidentId={0}&FolderId={1}&SubTab=0", Request["IncidentId"], iFolderId);
            //else if (Request["TaskId"] != null)
            //    sPath += String.Format("?TaskId={0}&FolderId={1}&SubTab=0", Request["TaskId"], iFolderId);
            //else if (Request["ToDoId"] != null)
            //    sPath += String.Format("?ToDoId={0}&FolderId={1}&SubTab=0", Request["ToDoId"], iFolderId);
            //else if (Request["EventId"] != null)
            //    sPath += String.Format("?EventId={0}&FolderId={1}&SubTab=0", Request["EventId"], iFolderId);
            //else if (Request["DocumentId"] != null)
            //    sPath += String.Format("?DocumentId={0}&FolderId={1}&SubTab=0", Request["DocumentId"], iFolderId);
            //else
            //    sPath += String.Format("?FolderId={0}&Tab=0", iFolderId);
            //return sPath;
        }
Esempio n. 3
0
        /// <summary>
        /// Binds from value.
        /// </summary>
        private void BindFromValue(string metaClassName)
        {
            CommandParameters cp = new CommandParameters("MC_MUI_EntityDDSmall");

            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            if (!String.IsNullOrEmpty(metaClassName))
            {
                cp.AddCommandArgument("Classes", metaClassName);
            }
            cp.AddCommandArgument("Refresh", String.Format("Refresh{0}", this.ID));
            //Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());

            string scriptToExecute = CommandManager.GetCurrent(this.Page).AddCommand(metaClassName, string.Empty, string.Empty, cp);

            if (this.Value == null)
            {
                lblValue.Text = CHelper.GetResFileString("{IbnFramework.Common:tFilterSelectObject}");
            }
            else
            {
                PrimaryKeyId id  = PrimaryKeyId.Parse(this.Value.ToString());
                EntityObject obj = BusinessManager.Load(metaClassName, id);
                MetaClass    mc  = MetaDataWrapper.GetMetaClassByName(obj.MetaClassName);
                lblValue.Text = obj.Properties[mc.TitleFieldName].Value.ToString();
            }

            lblValue.Attributes.Add("onclick", scriptToExecute);
        }
Esempio n. 4
0
        private void btnMove_ServerClick(object sender, EventArgs e)
        {
            int iDestFolder = -1;

            try
            {
                iDestFolder = ctrlDirTree.FolderId;
            }
            catch { }
            if (iDestFolder == -1)
            {
                lblNotValid.Visible = true;
                return;
            }

            CommandParameters cp = new CommandParameters("FL_Selected_Move");

            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("DestFolderId", iDestFolder.ToString());
            cp.AddCommandArgument("ContainerKey", ContainerKey);
            cp.AddCommandArgument("ContainerName", ContainerName);

            if (Request["GridId"] != null)
            {
                cp.CommandName = "FL_Selected_MoveToFolder";
                cp.AddCommandArgument("GridId", Request["GridId"]);
            }
            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 5
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);
        }
Esempio n. 6
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());
 }
Esempio n. 7
0
        private void BindGrid()
        {
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add("Id", typeof(string));
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("EditLink", typeof(string));
            dt.Columns.Add("CanDelete", typeof(bool));
            dt.Columns.Add("CanReset", typeof(bool));

            CommandManager    cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp;

            ListViewProfile[] list = ListViewProfile.GetSystemProfiles(mc.Name, PlaceName);
            foreach (ListViewProfile lvp in list)
            {
                DataRow dr = dt.NewRow();
                dr["Id"]            = lvp.Id;
                dr["Name"]          = CHelper.GetResFileString(lvp.Name);
                cp                  = new CommandParameters(CommandEditName);
                cp.CommandArguments = new Dictionary <string, string>();
                cp.AddCommandArgument("ClassName", mc.Name);
                cp.AddCommandArgument("uid", lvp.Id);
                string cmd = cm.AddCommand(mc.Name, ViewName, PlaceName, cp);
                dr["EditLink"] = String.Format("javascript:{{{0}}};", cmd);
                if (ListManager.MetaClassIsList(mc.Name))
                {
                    dr["CanDelete"] = list.Length > 1 && !lvp.ReadOnly;
                }
                else
                {
                    dr["CanDelete"] = !lvp.ReadOnly;
                }
                dr["CanReset"] = false;
                dt.Rows.Add(dr);
            }

            grdMain.DataSource = dt;
            grdMain.DataBind();

            foreach (DataGridItem row in grdMain.Items)
            {
                ImageButton ib;
                ib = (ImageButton)row.FindControl("ibDelete");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Delete").ToString() + "?')");
                }

                ib = (ImageButton)row.FindControl("ibReset");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "ResetToDefault").ToString() + "?')");
                }
            }
        }
Esempio n. 8
0
        void lbDelete_Click(object sender, EventArgs e)
        {
            CommandParameters cp = new CommandParameters(Request["CommandName"]);

            cp.CommandArguments = new Dictionary <string, string>();
            cp.AddCommandArgument("action", "delete");
            cp.AddCommandArgument("Uid", Request["ObjectId"]);
            CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 9
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            CommandParameters cp = new CommandParameters(_refreshCommand);

            cp.CommandArguments = new Dictionary <string, string>();
            cp.AddCommandArgument("Type", _type);
            cp.AddCommandArgument("Variant", rbList.SelectedValue);
            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                ListViewProfile profile;
                if (!String.IsNullOrEmpty(_uid))
                {
                    profile = ListViewProfile.Load(_className, _uid, _placeName);
                }
                else
                {
                    profile = new ListViewProfile();
                }
                //fields
                List <string> fields             = new List <string>();
                ColumnPropertiesCollection coll  = new ColumnPropertiesCollection();
                List <ListItem>            items = ListSelector.GetSelectedItems();
                foreach (ListItem item in items)
                {
                    fields.Add(item.Value);
                    coll.Add(new ColumnProperties(item.Value, "150", String.Empty));
                }
                profile.FieldSet  = fields;
                profile.ColumnsUI = coll;

                string uid = (!String.IsNullOrEmpty(_uid)) ? _uid : Guid.NewGuid().ToString();
                profile.Id = uid;

                profile.Name     = txtTitle.Text;
                profile.ReadOnly = false;

                int currentUserId = Mediachase.Ibn.Data.Services.Security.CurrentUserId;

                if (_isSystem)
                {
                    profile.IsSystem = true;
                    profile.IsPublic = true;
                    ListViewProfile.SaveSystemProfile(_className, _placeName, currentUserId, profile);
                }
                else
                {
                    profile.IsSystem = false;
                    profile.IsPublic = cbIsPublic.Checked;
                    ListViewProfile.SaveCustomProfile(_className, _placeName, currentUserId, profile);
                }
                SaveFilters(uid);

                CommandParameters cp = new CommandParameters(_commandName);
                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("ViewUid", uid);
                cp.AddCommandArgument("ClassName", _className);
                cp.AddCommandArgument("PlaceName", _placeName);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
        }
Esempio n. 11
0
        void lbEditSeries_Click(object sender, EventArgs e)
        {
            CommandParameters cp = new CommandParameters(Request["CommandName"]);

            cp.CommandArguments = new Dictionary <string, string>();
            cp.AddCommandArgument("action", "edit");
            PrimaryKeyId pKey = PrimaryKeyId.Parse(Request["ObjectId"]);

            pKey = ((VirtualEventId)pKey).RealEventId;
            cp.AddCommandArgument("Uid", pKey.ToString());
            CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 12
0
        void btnMark_Click(object sender, EventArgs e)
        {
            CommandParameters cp = new CommandParameters(Request["ReturnCommand"]);

            cp.CommandArguments = new Dictionary <string, string>();
            if (Request["GridId"] != null)
            {
                cp.AddCommandArgument("GridId", Request["GridId"]);
            }
            cp.AddCommandArgument("action", rbAction.SelectedValue);
            CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 13
0
        private void BindBlockHeader()
        {
            // Check, that there are fields left
            MetaClass            mc             = MetaDataWrapper.GetMetaClassByName(ClassName);
            HistoryMetaClassInfo historyInfo    = HistoryManager.GetInfo(mc);
            Collection <string>  selectedFields = historyInfo.SelectedFields;
            bool fieldsExist = false;

            foreach (MetaField mf in mc.Fields)
            {
                if (HistoryManager.IsSupportedField(mf) && !selectedFields.Contains(mf.Name))
                {
                    fieldsExist = true;
                    break;
                }
            }

            CommandManager    cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp;

            if (fieldsExist)
            {
                string            id  = String.Empty;
                ListViewProfile[] mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
                if (mas.Length == 0)
                {
                    id = CHelper.GetHistorySystemListViewProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
                }
                else
                {
                    id = mas[0].Id;
                }

                cp = new CommandParameters("MC_ListApp_HistoryProfileEdit");
                cp.CommandArguments = new Dictionary <string, string>();
                cp.AddCommandArgument("ClassName", HistoryManager.GetHistoryMetaClassName(ClassName));
                cp.AddCommandArgument("uid", id);
                string cmd = cm.AddCommand("", "", "ListInfoView", cp);
                MainBlockHeader.AddRightLink(
                    GetGlobalResourceObject("IbnFramework.ListInfo", "HistoryView").ToString(),
                    String.Format("javascript:{{{0}}};", cmd));

                cp = new CommandParameters("MC_ListApp_AddHistoryFieldFrame", new Dictionary <string, string>());
                cp.AddCommandArgument("ClassName", ClassName);
                string command = cm.AddCommand("", "", "ListInfoView", cp);

                MainBlockHeader.AddRightLink(
                    GetGlobalResourceObject("IbnFramework.ListInfo", "AddField").ToString(),
                    String.Format("javascript:{{{0}}};", command));
            }
        }
Esempio n. 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GetCurrentFolder();
            CHelper.AddToContext(_folderIdKey, _folderId.ToString());
            CHelper.AddToContext(_containerKeyKey, _containerKey);
            CHelper.AddToContext(_containerNameKey, _containerName);

            if (!Page.IsPostBack)
            {
                BindBlockHeader();

                if (_pc["fs_ViewStyle"] == null)
                {
                    _pc["fs_ViewStyle"] = "ListView";
                }
            }
            _viewName = _pc["fs_ViewStyle"];

            grdMain.ClassName = _className;
            grdMain.ViewName  = _viewName;
            grdMain.PlaceName = _placeName;

            MainMetaToolbar.ClassName = _className;
            MainMetaToolbar.ViewName  = _viewName;
            MainMetaToolbar.PlaceName = _placeName;

            CommandManager cm = CommandManager.GetCurrent(this.Page);

            CommandParameters cp = new CommandParameters("FL_ChangeFolderTree");

            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("ContainerKey", _containerKey);
            cp.AddCommandArgument("FolderId", _rootId.ToString());
            string cmd = cm.AddCommand(_className, _viewName, _placeName, cp);

            cmd = cmd.Replace("\"", "&quot;");

            jsTreeExt.FolderId        = _folderId.ToString();
            jsTreeExt.IconUrl         = ResolveClientUrl("~/layouts/images/folder.gif");
            jsTreeExt.RootHrefCommand = String.Format("javascript:{0}", cmd);
            jsTreeExt.RootId          = _rootId.ToString();
            jsTreeExt.RootNodeText    = LocRM.GetString("tRoot");
            jsTreeExt.TreeSourceUrl   = ResolveClientUrl("~/Apps/FileLibrary/Pages/FileLibraryTreeSource.aspx?ContainerName=" + _containerName + "&ContainerKey=" + _containerKey + "&FolderId=" + _folderId);

            BindDataGrid(!Page.IsPostBack);

            cm.AddCommand(_className, _viewName, _placeName, "FL_Selected_MoveToFolder");
        }
Esempio n. 15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ListViewProfile profile;

            if (!String.IsNullOrEmpty(_uid))
            {
                profile = ListViewProfile.Load(_className, _uid, String.Empty);
            }
            else
            {
                profile = new ListViewProfile();
            }
            profile.FieldSetName     = ddFieldSets.SelectedValue;
            profile.GroupByFieldName = (ddGroupField.SelectedValue == Project.AvailableGroupField.NotSet.ToString()) ? "" : ddGroupField.SelectedValue;
            profile.Filters          = GetFilters();
            string uid = (!String.IsNullOrEmpty(_uid)) ? _uid : Guid.NewGuid().ToString();

            profile.Id       = uid;
            profile.IsPublic = cbIsPublic.Checked;
            profile.IsSystem = false;
            profile.Name     = txtTitle.Text;
            ListViewProfile.SaveCustomProfile(_className, String.Empty, Mediachase.IBN.Business.Security.CurrentUser.UserID, profile);

            CommandParameters cp = new CommandParameters("MC_PM_NewViewCreated");

            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("ViewUid", uid);
            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 16
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            DataTable dt           = (DataTable)ViewState["Resources"];
            string    sResponsible = "";

            foreach (DataRow dr in dt.Rows)
            {
                sResponsible += dr["UserId"].ToString() + "_";
            }

            if (Request["Command"] != null)
            {
                CommandParameters cp = new CommandParameters(Request["Command"]);
                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("Key", sResponsible);

                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                        String.Format("try{{window.opener.{0};}} catch (e){{}} window.close();", RefreshButton.Replace("xxx", sResponsible)),
                                                        true);
            }
        }
		protected void AssignmentGrid_RowDataBound(object sender, GridViewRowEventArgs e)
		{
			CommandManager cm = CommandManager.GetCurrent(this.Page);
			ImageButton reassignButton = (ImageButton)e.Row.FindControl("ReassignButton");
			if (reassignButton != null)
			{
				CommandParameters cp = new CommandParameters("MC_WF_SelectUser");
				cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
				cp.AddCommandArgument("AssignmentId", ((EntityObject)(e.Row.DataItem)).PrimaryKeyId.ToString());
				string cmd = cm.AddCommand("User", String.Empty, "ActiveAssignments", cp);
				cmd = cmd.Replace("\"", "&quot;");

				reassignButton.Attributes.Add("onclick", String.Concat(cmd, "return false;"));
			}

			ImageButton editButton = (ImageButton)e.Row.FindControl("EditButton");
			if (editButton != null)
			{
				CommandParameters cp = new CommandParameters("MC_WF_EditAssignment");
				cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
				cp.AddCommandArgument("AssignmentId", ((EntityObject)(e.Row.DataItem)).PrimaryKeyId.ToString());
				string cmd = cm.AddCommand("User", String.Empty, "ActiveAssignments", cp);
				cmd = cmd.Replace("\"", "&quot;");

				editButton.Attributes.Add("onclick", String.Concat(cmd, "return false;"));
			}
		}
Esempio n. 18
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());
 }
Esempio n. 19
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            #region Register Commands
            CommandManager    cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("MC_Art_NewEvent");
            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("EventStartDate", "%%START%%");
            cp.AddCommandArgument("EventEndDate", "%%END%%");
            string cmd = cm.AddCommand("", "", "Calendar", cp);
            sCreate = cmd.Replace("\"", "&quot;");

            cp = new CommandParameters("MC_Art_UpdateEvent");
            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("Uid", "%%UID%%");
            cmd     = cm.AddCommand("", "", "Calendar", cp);
            sUpdate = cmd.Replace("\"", "&quot;");

            cp = new CommandParameters("MC_Art_UpdateEventConfirm");
            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("Uid", "%%UID%%");
            cp.AddCommandArgument("args", "%%args%%");
            cmd            = cm.AddCommand("", "", "Calendar", cp);
            sUpdateConfirm = cmd.Replace("\"", "&quot;");

            cp = new CommandParameters("MC_Art_DeleteEvent");
            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("Uid", "%%UID%%");
            cmd     = cm.AddCommand("", "", "Calendar", cp);
            sDelete = cmd.Replace("\"", "&quot;");

            cp = new CommandParameters("MC_Calendar_EditEvent");
            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("Uid", "%%UID%%");
            cmd   = cm.AddCommand("", "", "Calendar", cp);
            sEdit = cmd.Replace("\"", "&quot;");
            #endregion

            dtcWeek.SelectedDate       = CalendarCtrl.SelectedDate;
            this.CalendarCtrl.ViewMode = (ViewModeType)Enum.Parse(typeof(ViewModeType), this.ViewMode);

            if (this.ViewType != null)
            {
                this.CalendarCtrl.ViewType = (CalendarViewType)Enum.Parse(typeof(CalendarViewType), this.ViewType);
            }

            this.CalendarCtrl.Refresh();
        }
Esempio n. 20
0
        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            this.Page.Validate();
            if (!this.Page.IsValid)
            {
                btnSave.Attributes.Remove("onclick");
                btnCancel.Attributes.Remove("onclick");
                return;
            }

            EntityObject _bindObject = BusinessManager.InitializeEntity(ddFilter.SelectedValue);

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

                // Save container id
                if (!String.IsNullOrEmpty(ContainerFieldName) &&
                    ((EntityObject)_bindObject).Properties[ContainerFieldName] != null &&
                    ContainerId != PrimaryKeyId.Empty)
                {
                    ((EntityObject)_bindObject)[ContainerFieldName] = ContainerId;
                }

                PrimaryKeyId objectId = BusinessManager.Create(_bindObject);

                CommandParameters cp = new CommandParameters("MC_MUI_EntityDD");

                if (Request["ReturnCommand"] != null)
                {
                    cp.CommandName = Request["ReturnCommand"];
                }

                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("ClassName", ddFilter.SelectedValue);
                if (Request["ObjectId"] != null)
                {
                    cp.AddCommandArgument("ObjectId", Request["ObjectId"]);
                }
                if (Request["GridId"] != null)
                {
                    cp.AddCommandArgument("GridId", Request["GridId"]);
                }
                cp.AddCommandArgument("SelectedValue", objectId.ToString());
                cp.AddCommandArgument("SelectObjectId", objectId.ToString());
                cp.AddCommandArgument("SelectObjectType", ddFilter.SelectedValue);
                cp.AddCommandArgument("Html", CHelper.GetEntityTitleHtml(ddFilter.SelectedValue, objectId));

                if (!String.IsNullOrEmpty(Request["SelectCtrlId"]))
                {
                    cp.AddCommandArgument("SelectCtrlId", Request["SelectCtrlId"]);
                }

                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
        }
Esempio n. 21
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());
 }
Esempio n. 22
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());
        }
Esempio n. 23
0
        private void BindResponsible(GeneralIncidentBoxBlock gibb)
        {
            //			ddResponsible.Visible = false;
            //			lblResponsible.Visible = true;
            //			lblChangeButton.Visible = true;
            //			lblResponsible.Text = "";
            //			lblChangeButton.Text = "";
            lblForResp.Text = LocRM.GetString("tPool") + ":";
            string    sResps = "";
            string    sUsers = "";
            DataTable dt     = new DataTable();

            dt.Columns.Add(new DataColumn("PureName", typeof(string)));
            dt.Columns.Add(new DataColumn("UserName", typeof(string)));
            DataRow dr;

            if (gibb.ResponsiblePool != null)
            {
                foreach (int iUserId in gibb.ResponsiblePool)
                {
                    sUsers        += iUserId + "_";
                    dr             = dt.NewRow();
                    dr["PureName"] = Util.CommonHelper.GetUserStatusPureName(iUserId);
                    dr["UserName"] = Util.CommonHelper.GetUserStatus(iUserId);
                    dt.Rows.Add(dr);
                }
            }
            DataView dv = dt.DefaultView;

            dv.Sort = "PureName";
            foreach (DataRowView drv in dv)
            {
                sResps += drv["UserName"].ToString() + "<br />";
            }

            if (sResps.Length == 0)
            {
                sResps = "&nbsp;";
            }
            lblResponsible.Text = String.Format("<span class='text' style='width:180px;'>{0}</span>&nbsp;&nbsp;",
                                                sResps);

            CommandManager    cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("MC_HDM_AdminResponsiblePool");

            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("sUsersKey", sUsers);
            string cmd = cm.AddCommand("Incident", "", "IncidentView", cp);

            cmd = cmd.Replace("\"", "&quot;");

            lblChangeButton.Text = String.Format("<a href=\"javascript:{{{2}}}\"><img align='absmiddle' border='0' src='{0}' />&nbsp;{1}</a>",
                                                 ResolveClientUrl("~/layouts/images/icons/regular.gif"),
                                                 LocRM.GetString("tChange"), cmd);
        }
Esempio n. 24
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            btnSave.Disabled   = true;
            btnCancel.Disabled = true;

            CommandParameters cp = new CommandParameters("MC_MUI_EntityDD");

            if (Request["ReturnCommand"] != null)
            {
                cp.CommandName = Request["ReturnCommand"];
            }

            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("ClassName", ddFilter.SelectedValue);
            if (Request["ObjectId"] != null)
            {
                cp.AddCommandArgument("ObjectId", Request["ObjectId"]);
            }
            if (Request["GridId"] != null)
            {
                cp.AddCommandArgument("GridId", Request["GridId"]);
            }
            if (TreeServiceTargetObjectId != PrimaryKeyId.Empty)
            {
                cp.AddCommandArgument("TreeServiceTargetObjectId", TreeServiceTargetObjectId.ToString());
            }
            cp.AddCommandArgument("SelectedValue", hdnValue.Value);

            if (!String.IsNullOrEmpty(Request["SelectCtrlId"]))
            {
                string[] mas = hdnValue.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                if (mas.Length > 0)
                {
                    string uid = MetaViewGroupUtil.GetIdFromUniqueKey(mas[0]);
                    if (uid != "null")
                    {
                        cp.AddCommandArgument("SelectObjectId", uid);
                        cp.AddCommandArgument("SelectCtrlId", Request["SelectCtrlId"]);
                        cp.AddCommandArgument("SelectObjectType", ddFilter.SelectedValue);
                        cp.AddCommandArgument("Html", CHelper.GetEntityTitleHtml(ddFilter.SelectedValue, PrimaryKeyId.Parse(uid)));
                    }
                }
            }
            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 25
0
        public override void DataBind()
        {
            if (mc != null)
            {
                lnkNew.Text = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "AddSystemView").ToString();
                CommandManager    cm = CommandManager.GetCurrent(this.Page);
                CommandParameters cp = new CommandParameters(CommandNewName);
                cp.CommandArguments = new Dictionary <string, string>();
                cp.AddCommandArgument("ClassName", mc.Name);
                string cmd = cm.AddCommand(mc.Name, ViewName, PlaceName, cp);
                lnkNew.NavigateUrl = String.Format("javascript:{{{0}}};", cmd);

                BindGrid();
            }
        }
Esempio n. 26
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);
        }
Esempio n. 27
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            DataTable dt = (DataTable)ViewState["Resources"];
            string sResponsible = "";
            foreach (DataRow dr in dt.Rows)
                sResponsible += dr["UserId"].ToString() + "_";

            if (Request["Command"] != null)
            {
                CommandParameters cp = new CommandParameters(Request["Command"]);
                cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                cp.AddCommandArgument("Key", sResponsible);

                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                        String.Format("try{{window.opener.{0};}} catch (e){{}} window.close();", RefreshButton.Replace("xxx", sResponsible)),
                    true);
        }
        void btnSave_ServerClick(object sender, EventArgs e)
        {
            SaveValues();
            if (Request["IncidentId"] != null)
            {
                CommandManager    cm = CommandManager.GetCurrent(this.Page);
                CommandParameters cp = new CommandParameters("MC_HDM_PrintIssue");
                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("IncidentId", Request["IncidentId"]);
                string cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                ClientScript.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString("N"),
                                                   String.Format(@"function closeWin()
									{{ 
										try{{
											window.parent.{1}();
										}}
										catch(ex){{;}} 
									}} 
									function openWin()
									{{
										try{{
											{0}; 
											setTimeout('closeWin()', 500);
										}}
										catch(ex){{
											setTimeout('openWin()', 500);
										}}
									}} 
									setTimeout('openWin()', 1000);"                                    ,

                                                                 cmd, Request["closeFramePopup"]), true);
            }
            else
            {
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, String.Empty);
            }
        }
Esempio n. 29
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            #region Register Commands
            CommandManager cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("MC_Art_NewEvent");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("EventStartDate", "%%START%%");
            cp.AddCommandArgument("EventEndDate", "%%END%%");
            string cmd = cm.AddCommand("", "", "Calendar", cp);
            sCreate = cmd.Replace("\"", "&quot;");

            cp = new CommandParameters("MC_Art_UpdateEvent");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("Uid", "%%UID%%");
            cmd = cm.AddCommand("", "", "Calendar", cp);
            sUpdate = cmd.Replace("\"", "&quot;");

            cp = new CommandParameters("MC_Art_UpdateEventConfirm");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("Uid", "%%UID%%");
            cp.AddCommandArgument("args", "%%args%%");
            cmd = cm.AddCommand("", "", "Calendar", cp);
            sUpdateConfirm = cmd.Replace("\"", "&quot;");

            cp = new CommandParameters("MC_Art_DeleteEvent");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("Uid", "%%UID%%");
            cmd = cm.AddCommand("", "", "Calendar", cp);
            sDelete = cmd.Replace("\"", "&quot;");

            cp = new CommandParameters("MC_Calendar_EditEvent");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("Uid", "%%UID%%");
            cmd = cm.AddCommand("", "", "Calendar", cp);
            sEdit = cmd.Replace("\"", "&quot;");
            #endregion

            dtcWeek.SelectedDate = CalendarCtrl.SelectedDate;
            this.CalendarCtrl.ViewMode = (ViewModeType)Enum.Parse(typeof(ViewModeType), this.ViewMode);

            if (this.ViewType != null)
                this.CalendarCtrl.ViewType = (CalendarViewType)Enum.Parse(typeof(CalendarViewType), this.ViewType);

            this.CalendarCtrl.Refresh();
        }
Esempio n. 30
0
        void btnSave_ServerClick(object sender, EventArgs e)
        {
            SaveValues();
            if (Request["IncidentId"] != null)
            {
                CommandManager cm = CommandManager.GetCurrent(this.Page);
                CommandParameters cp = new CommandParameters("MC_HDM_PrintIssue");
                cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                cp.AddCommandArgument("IncidentId", Request["IncidentId"]);
                string cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                ClientScript.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString("N"),
                    String.Format(@"function closeWin()
                                    {{
                                        try{{
                                            window.parent.{1}();
                                        }}
                                        catch(ex){{;}}
                                    }}
                                    function openWin()
                                    {{
                                        try{{
                                            {0};
                                            setTimeout('closeWin()', 500);
                                        }}
                                        catch(ex){{
                                            setTimeout('openWin()', 500);
                                        }}
                                    }}
                                    setTimeout('openWin()', 1000);",

                            cmd, Request["closeFramePopup"]), true);
            }
            else
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, String.Empty);
        }
Esempio n. 31
0
        private void BindList()
        {
            tableDD.Rows.Clear();
            HtmlTableRow tr = null;
            HtmlTableCell tc = null;

            tr = new HtmlTableRow();
            tc = new HtmlTableCell();
            tc.Attributes.Add("class", "cellclass IconAndText");
            tc.Attributes.Add("onmouseover", "TdOver(this)");
            tc.Attributes.Add("onmouseout", "TdOut(this)");
            tc.Attributes.Add("onclick",
                String.Format("MC_EDD['{0}'].SelectThis(this, '', '{1}');",
                    this.ClientID,
                    PrimaryKeyId.Empty.ToString()
                )
            );
            tc.InnerHtml = String.Format("<span><img alt='' src='{0}'/></span> <span>{1}</span>",
                Page.ResolveUrl("~/Layouts/Images/not_set.png"),
                LocRM.GetString("tObjectNotSet"));
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            /// HistoryId, ClassName, ObjectId, ObjectTitle, Dt, IsView
            DataTable dt = Mediachase.IBN.Business.Common.GetListEntityHistoryFull();
            DataView dv = dt.DefaultView;
            //Make filter
            string[] mas = ObjectTypes.Split(',');
            string filter = String.Empty;
            for (int i = 0; i < mas.Length; i++)
            {
                if (!String.IsNullOrEmpty(mas[i]))
                {
                    filter += "ClassName='" + mas[i] + "' OR ";
                }
            }
            if (filter.EndsWith(" OR "))
                filter = filter.Substring(0, filter.Length - 4);
            //apply filter
            dv.RowFilter = filter;

            //top ItemCount
            DataTable dtClone = dt.Clone();
            DataRow dr;
            int count = 0;
            foreach (DataRowView drv in dv)
            {
                bool fl = true;
                if (!String.IsNullOrEmpty(FilterName))
                {
                    fl = false;
                    #region Filter
                    string className = drv.Row["ClassName"].ToString();
                    PrimaryKeyId objId = PrimaryKeyId.Parse(drv.Row["ObjectId"].ToString());
                    EntityObject eo = BusinessManager.Load(className, objId);
                    if (!String.IsNullOrEmpty(FilterValue))
                    {
                        if (eo.Properties[FilterName].Value == null ||
                            eo.Properties[FilterName].Value.ToString() == FilterValue)
                            fl = true;
                    }
                    else
                    {
                        if (eo.Properties[FilterName].Value == null)
                            fl = true;
                    }
                    #endregion
                }
                if (fl)
                {
                    count++;
                    dr = dtClone.NewRow();
                    dr.ItemArray = drv.Row.ItemArray;
                    dtClone.Rows.Add(dr);
                }
                if (count >= ItemCount)
                    break;
            }

            dv = dtClone.DefaultView;
            dv.Sort = "ObjectTitle";
            foreach (DataRowView drv in dv)
            {
                tr = new HtmlTableRow();
                tc = new HtmlTableCell();
                try
                {
                    tc.InnerHtml = CommonHelper.GetEntityTitle(drv.Row["ClassName"].ToString(), PrimaryKeyId.Parse(drv.Row["ObjectId"].ToString()));
                    tc.Attributes.Add("class", "cellclass");
                    tc.Attributes.Add("onmouseover", "TdOver(this)");
                    tc.Attributes.Add("onmouseout", "TdOut(this)");
                    tc.Attributes.Add("onclick",
                        String.Format("MC_EDD['{0}'].SelectThis(this, '{1}', '{2}');",
                            this.ClientID, drv.Row["ClassName"].ToString(),
                            drv.Row["ObjectId"].ToString()
                        )
                    );
                    tr.Cells.Add(tc);
                    tableDD.Rows.Add(tr);
                }
                catch
                {
                }
            }

            tr = new HtmlTableRow();
            tc = new HtmlTableCell();
            tc.InnerHtml = String.Format("<b>{0}</b>", LocRM.GetString("tRespMore"));
            tc.Attributes.Add("class", "cellclass");
            tc.Attributes.Add("onmouseover", "TdOver(this)");
            tc.Attributes.Add("onmouseout", "TdOut(this)");

            CommandManager cm = CommandManager.GetCurrent(this.Page);
            if (cm != null)
            {
                CommandParameters cp = new CommandParameters(CommandName);
                cp.CommandArguments = new Dictionary<string, string>();
                cp.AddCommandArgument("SelectCtrlId", this.ClientID);
                cp.AddCommandArgument("Classes", this.ObjectTypes);
                cp.AddCommandArgument("FilterName", this.FilterName);
                cp.AddCommandArgument("FilterValue", this.FilterValue);
                string cmd = cm.AddCommand(ClassName, ViewName, PlaceName, cp);
                tc.Attributes.Add("onclick", "javascript:entityCloseAll();" + cmd);
                tr.Cells.Add(tc);
                tableDD.Rows.Add(tr);
            }
        }
Esempio n. 32
0
        private void BindList()
        {
            tableDD.Rows.Clear();
            HtmlTableRow tr = null;
            HtmlTableCell tc = null;

            tr = new HtmlTableRow();
            tc = new HtmlTableCell();
            if (String.IsNullOrEmpty(this.NotSetText))
                tc.InnerHtml = String.Format("<span><img alt='' src='{0}'/></span> <span>{1}</span>",
                    Page.ResolveUrl("~/Layouts/Images/not_set.png"),
                    LocRM.GetString("tObjectNotSet"));
            else
                tc.InnerHtml = this.NotSetText;

            tc.Attributes.Add("class", "cellclass");
            tc.Attributes.Add("onmouseover", "TdOver(this)");
            tc.Attributes.Add("onmouseout", "TdOut(this)");
            tc.Attributes.Add("onclick",
              String.Format("MC_ODD['{0}'].SelectThis(this, -1, -1);",
                this.ClientID)
            );
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            /// HistoryId, ObjectTypeId, ObjectId, ObjectTitle, Dt, IsView
            DataTable dt = Mediachase.IBN.Business.Common.GetListHistoryFull();
            DataView dv = dt.DefaultView;
            //Make filter
            string[] mas = ObjectTypes.Split(',');
            string filter = "";
            for (int i = 0; i < mas.Length; i++)
            {
                if (mas[i] != "")
                    filter += "ObjectTypeId=" + mas[i] + " OR ";
            }
            if (filter.EndsWith(" OR "))
                filter = filter.Substring(0, filter.Length - 4);
            //apply filter
            dv.RowFilter = filter;

            //top ItemCount
            DataTable dtClone = dt.Clone();
            DataRow dr;
            int count = 0;
            foreach (DataRowView drv in dv)
            {
                if (ObjectTypes == "3")	// Project
                {
                    int projectId = (int)drv.Row["ObjectId"];
                    //check access
                    if (!Project.CanRead(projectId))
                        continue;
                    // skip inactive projects
                    using (IDataReader reader = Project.GetProject(projectId, false))
                    {
                        if (reader.Read())
                        {
                            int statusId = (int)reader["StatusId"];
                            if (statusId == (int)Project.ProjectStatus.OnHold
                                || statusId == (int)Project.ProjectStatus.Completed
                                || statusId == (int)Project.ProjectStatus.Cancelled)
                                continue;
                        }
                    }
                }

                count++;
                dr = dtClone.NewRow();
                dr.ItemArray = drv.Row.ItemArray;
                dtClone.Rows.Add(dr);
                if (count >= ItemCount)
                    break;
            }

            dv = dtClone.DefaultView;
            dv.Sort = "ObjectTitle";
            foreach (DataRowView drv in dv)
            {
                tr = new HtmlTableRow();
                tc = new HtmlTableCell();
                tc.InnerHtml = Util.CommonHelper.GetObjectHTMLTitle((int)drv.Row["ObjectTypeId"], (int)drv.Row["ObjectId"]);
                tc.Attributes.Add("class", "cellclass");
                tc.Attributes.Add("onmouseover", "TdOver(this)");
                tc.Attributes.Add("onmouseout", "TdOut(this)");
                tc.Attributes.Add("onclick",
                  String.Format("MC_ODD['{0}'].SelectThis(this, {1}, {2});",
                    this.ClientID, drv.Row["ObjectTypeId"].ToString(),
                    drv.Row["ObjectId"].ToString())
                );
                tr.Cells.Add(tc);
                tableDD.Rows.Add(tr);
            }

            if (ObjectTypes == "3")		// Project
            {
                tr = new HtmlTableRow();
                tc = new HtmlTableCell();
                tc.InnerHtml = String.Format("<b>{0}</b>", LocRM.GetString("tRespMore"));
                tc.Attributes.Add("class", "cellclass");
                tc.Attributes.Add("onmouseover", "TdOver(this)");
                tc.Attributes.Add("onmouseout", "TdOut(this)");
                CommandManager cm = CommandManager.GetCurrent(this.Page);
                CommandParameters cp = new CommandParameters(CommandName);
                cp.CommandArguments = new Dictionary<string, string>();
                cp.AddCommandArgument("SelectCtrlId", this.ClientID);
                string cmd = cm.AddCommand(ClassName, ViewName, PlaceName, cp);
                tc.Attributes.Add("onclick", "javascript:closeAll();" + cmd);
                tr.Cells.Add(tc);
                tableDD.Rows.Add(tr);
            }

            if (ObjectTypes == "1")		// User
            {
                tr = new HtmlTableRow();
                tc = new HtmlTableCell();
                tc.InnerHtml = String.Format("<b>{0}</b>", LocRM.GetString("tRespMore"));
                tc.Attributes.Add("class", "cellclass");
                tc.Attributes.Add("onmouseover", "TdOver(this)");
                tc.Attributes.Add("onmouseout", "TdOut(this)");
                CommandManager cm = CommandManager.GetCurrent(this.Page);
                CommandParameters cp = new CommandParameters(CommandName);
                cp.CommandArguments = new Dictionary<string, string>();
                cp.AddCommandArgument("SelectCtrlId", this.ClientID);
                string cmd = cm.AddCommand(ClassName, ViewName, PlaceName, cp);
                tc.Attributes.Add("onclick", "javascript:closeAll();" + cmd);
                tr.Cells.Add(tc);
                tableDD.Rows.Add(tr);
            }
        }
Esempio n. 33
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                ListViewProfile profile;
                if (!String.IsNullOrEmpty(_uid))
                    profile = ListViewProfile.Load(_className, _uid, _placeName);
                else
                    profile = new ListViewProfile();
                //fields
                List<string> fields = new List<string>();
                ColumnPropertiesCollection coll = new ColumnPropertiesCollection();
                List<ListItem> items = ListSelector.GetSelectedItems();
                foreach (ListItem item in items)
                {
                    fields.Add(item.Value);
                    coll.Add(new ColumnProperties(item.Value, "150", String.Empty));
                }
                profile.FieldSet = fields;
                profile.ColumnsUI = coll;

                string uid = (!String.IsNullOrEmpty(_uid)) ? _uid : Guid.NewGuid().ToString();
                profile.Id = uid;

                profile.Name = txtTitle.Text;
                profile.ReadOnly = false;

                int currentUserId = Mediachase.Ibn.Data.Services.Security.CurrentUserId;

                if (_isSystem)
                {
                    profile.IsSystem = true;
                    profile.IsPublic = true;
                    ListViewProfile.SaveSystemProfile(_className, _placeName, currentUserId, profile);
                }
                else
                {
                    profile.IsSystem = false;
                    profile.IsPublic = cbIsPublic.Checked;
                    ListViewProfile.SaveCustomProfile(_className, _placeName, currentUserId, profile);
                }
                SaveFilters(uid);

                CommandParameters cp = new CommandParameters(_commandName);
                cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                cp.AddCommandArgument("ViewUid", uid);
                cp.AddCommandArgument("ClassName", _className);
                cp.AddCommandArgument("PlaceName", _placeName);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
        }
Esempio n. 34
0
        private void BindToolbar()
        {
            secHeader.Title = LocRM.GetString("tbView");

            bool canUpdate       = Incident.CanUpdate(IncidentId);
            bool canAddToDoBox   = Incident.CanAddToDo(IncidentId);
            bool canAddResBox    = Incident.CanModifyResources(IncidentId);
            bool canViewFinances = Incident.CanViewFinances(IncidentId);
            bool canDelete       = Incident.CanDelete(IncidentId);
            bool isExternal      = Security.CurrentUser.IsExternal;

            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 = null;

            if (!Security.CurrentUser.IsExternal)
            {
                cm = CommandManager.GetCurrent(this.Page);
            }
            CommandParameters cp  = new CommandParameters();
            string            cmd = String.Empty;

            #region Create ToDo
            if (canAddToDoBox && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/task_create.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = "~/ToDo/ToDoEdit.aspx?IncidentId=" + IncidentId;
                subItem.Text = LocRM.GetString("tbAdd");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Edit: Incident, GeneralInfo, ResolutionInfo, Status
            if (canUpdate)
            {
                ComponentArt.Web.UI.MenuItem editItem = new ComponentArt.Web.UI.MenuItem();
                editItem.Text = LocRM.GetString("tbViewEdit");
                editItem.Look.RightIconUrl      = "../Layouts/Images/arrow_right.gif";
                editItem.Look.HoverRightIconUrl = "../Layouts/Images/arrow_right_hover.gif";
                editItem.Look.RightIconWidth    = Unit.Pixel(15);
                editItem.Look.RightIconHeight   = Unit.Pixel(10);

                #region Edit Incident
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/incident_edit.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = "../Incidents/IncidentEdit.aspx?IncidentId=" + IncidentId + "&Back=incident";
                subItem.Text = LocRM.GetString("EditIssue");
                editItem.Items.Add(subItem);
                #endregion

                #region Edit General Info
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.ClientSideCommand = "javascript:ShowWizard('EditGeneralInfo.aspx?IncidentId=" + IncidentId + "', 500, 400);";
                subItem.Text = LocRM2.GetString("EditGeneralInfo");
                editItem.Items.Add(subItem);
                #endregion

                #region Edit Categories
                if (PortalConfig.CommonIncidentAllowEditGeneralCategoriesField ||
                    PortalConfig.IncidentAllowEditIncidentCategoriesField)
                {
                    subItem = new ComponentArt.Web.UI.MenuItem();
                    subItem.ClientSideCommand = "javascript:ShowWizard('EditCategories.aspx?IncidentId=" + IncidentId + "', 300, 350);";
                    subItem.Text = LocRM2.GetString("EditCategories");
                    editItem.Items.Add(subItem);
                }
                #endregion

                /*
                 #region Edit State Info
                 * subItem = new ComponentArt.Web.UI.MenuItem();
                 * subItem.ClientSideCommand = "javascript:ShowWizard('EditStateInfo.aspx?ProjectId=" + ProjectId + "', 350, 250);";
                 * subItem.Text = LocRM.GetString("EditStateInfo");
                 * editItem.Items.Add(subItem);
                 #endregion
                 *
                 */
                topMenuItem.Items.Add(editItem);
            }
            #endregion

            #region Modyfy Recipients
            if (!isExternal && Mediachase.IBN.Business.Incident.CanUpdateExternalRecipients(IncidentId))
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/editgroup.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp  = new CommandParameters("MC_HDM_RecipEdit");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = "javascript:ShowWizard('RecipientsEditor.aspx?IncidentId=" + IncidentId + "', 450, 350);";
                subItem.Text = LocRM.GetString("AddRecipients");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Modyfy Resources
            if (canAddResBox && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/editgroup.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp  = new CommandParameters("MC_HDM_ResEdit");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = "javascript:ShowWizard('ResourcesEditor.aspx?IncidentId=" + IncidentId + "', 650, 350);";
                subItem.Text = LocRM.GetString("AddResources");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Delete
            if (canDelete)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/incident_delete.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand   = "javascript:DeleteIncident()";
                subItem.Text = LocRM.GetString("Delete");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region MarkAsSpam
            if (canDelete)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/red_denied.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp  = new CommandParameters("MC_HDM_MarkAsSpam");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = GetGlobalResourceObject("IbnFramework.Incident", "MarkAsSpam").ToString();
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region --- Seperator ---
            if (topMenuItem.Items.Count > 0)
            {
                subItem        = new ComponentArt.Web.UI.MenuItem();
                subItem.LookId = "BreakItem";
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Copy to Clipboard
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/xp-copy.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand   = "javascript:try{_XMLReqForClip('AddClip=Issue&IncidentId=" + IncidentId.ToString() + "', '" + LocRM2.GetString("tXMLError") + "')}catch(e){}";
                subItem.Text = LocRM.GetString("tCopyToClipboard");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Add from Clipboard
            if (canUpdate && !isExternal)
            {
                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_HDM_RelatedIssClip");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM.GetString("tPasteFromClipboard");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Clear Clipboard
            if (canUpdate && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/clearbuffer.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand   = "javascript:try{_XMLReqForClip('ClearClip=Issue', '" + LocRM2.GetString("tXMLError") + "')}catch(e){}";
                subItem.Text = LocRM2.GetString("tClearClipboard");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region --- Seperator ---
            if (topMenuItem.Items.Count > 0)
            {
                subItem        = new ComponentArt.Web.UI.MenuItem();
                subItem.LookId = "BreakItem";
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Add Related Issue
            if (canUpdate && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/relincidents.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);

                cp  = new CommandParameters("MC_HDM_RelatedIss");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = String.Format("javascript:OpenPopUpNoScrollWindow(\"../Common/SelectIncident.aspx?btn={0}&exclude={1}\", 640, 480);",
                //    Page.ClientScript.GetPostBackEventReference(btnAddRelatedIss, "xxxtypeid;xxxid"), IncidentId.ToString());
                subItem.Text = LocRM.GetString("tAdd");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Timesheet
            // OR [2007-08-23]: We should use IbnNext TimeTracking

            /*
             * if (Configuration.ProjectManagementEnabled)
             * {
             *      subItem = new ComponentArt.Web.UI.MenuItem();
             *      subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/timesheet.gif";
             *      subItem.Look.LeftIconWidth = Unit.Pixel(16);
             *      subItem.Look.LeftIconHeight = Unit.Pixel(16);
             *      string sPath = (Security.CurrentUser.IsExternal) ? "../External/ExternalTimeTracking.aspx" : "../TimeTracking/TimeTrackingWeek.aspx";
             *      subItem.ClientSideCommand = String.Format("javascript:ShowWizard('{0}?IncidentId={1}', {2});",
             *        sPath, IncidentId, (Security.CurrentUser.IsExternal) ? "800,600" : "450, 200");
             *      subItem.Text = LocRM.GetString("tbAddTimeSheet");
             *      topMenuItem.Items.Add(subItem);
             * }
             */
            #endregion

            #region UpdateHistory
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.ClientSideCommand = String.Format("javascript:ShowWizard('../Common/SystemEventsByObject.aspx?ObjectId={0}&ObjectTypeId={1}', 750, 466);", IncidentId, (int)ObjectTypes.Issue);
                subItem.Text = LocRM3.GetString("UpdateHistory");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Latest Visitors
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.ClientSideCommand = String.Format("javascript:ShowWizard('../Common/LatestVisitors.aspx?ObjectId={0}&ObjectTypeId={1}', 450, 266);", IncidentId, (int)ObjectTypes.Issue);
                subItem.Text = LocRM3.GetString("LatestVisitors");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region System Notifications
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/accept_1.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = String.Format("../Directory/SystemNotificationForObject.aspx?ObjectId={0}&ObjectTypeId={1}", IncidentId, ((int)ObjectTypes.Issue).ToString());
                subItem.Text = LocRM2.GetString("SystemNotifications");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Favorites
            if (!Incident.CheckFavorites(IncidentId) && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/Favorites.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand   = "javascript:" + Page.ClientScript.GetPostBackEventReference(btnAddToFavorites, "");
                subItem.Text = LocRM.GetString("AddToFavorites");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region PrintPreviewSettings
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/printPreviewButton.png";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp = new CommandParameters("MC_HDM_PrintPreviewSettings");
                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("IncidentId", IncidentId.ToString());
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM.GetString("PrintSettings");
                topMenuItem.Items.Add(subItem);

                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/print.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp = new CommandParameters("MC_HDM_PrintIssue");
                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("IncidentId", IncidentId.ToString());
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM.GetString("PrintIssue");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            if (topMenuItem.Items.Count > 0)
            {
                secHeader.ActionsMenu.Items.Add(topMenuItem);
            }
        }
Esempio n. 35
0
        private void BindList()
        {
            DataTable dt = null;

            if (ViewState["ResponsiblePool"] != null)
            {
                dt = ((DataTable)ViewState["ResponsiblePool"]).Copy();
            }
            string sUsers = "";

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if ((bool)dr["ResponsePending"])
                    {
                        sUsers += dr["PrincipalId"].ToString() + "*1_";
                    }
                    else
                    {
                        sUsers += dr["PrincipalId"].ToString() + "*0_";
                    }
                }
            }
            tableDD.Rows.Clear();
            HtmlTableRow  tr = null;
            HtmlTableCell tc = null;

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

            //NotChange
            tr           = new HtmlTableRow();
            tc           = CreateDDCell("SelectThis(this, -3)");
            tc.InnerHtml = "&nbsp;";
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            //NotSet
            tr           = new HtmlTableRow();
            tc           = CreateDDCell("SelectThis(this, -2)");
            tc.InnerHtml = BuildIconAndText("not_set.png", "tRespNotSet");
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            //Group Resp
            tr = new HtmlTableRow();
            tc = CreateDDCell("SelectThis(this, -1)");

            if (IsAllDenied())
            {
                if (!Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    cp = new CommandParameters("MC_HDM_GroupResponsibilityInFrame");
                    cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                    cp.AddCommandArgument("sUsersKey", sUsers);
                    cp.AddCommandArgument("NotChangeKey", "0");
                    cmd          = cm.AddCommand("Incident", "", "IncidentView", cp);
                    tc.InnerHtml = BuildLinkWithIconAndText("red_denied.gif", "tRespGroup", cmd);
                }
                else
                {
                    tc.InnerHtml = BuildIconAndText("red_denied.gif", "tRespGroup");
                }
            }
            else
            {
                if (!Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    cp = new CommandParameters("MC_HDM_GroupResponsibilityInFrame");
                    cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                    cp.AddCommandArgument("sUsersKey", sUsers);
                    cp.AddCommandArgument("NotChangeKey", "0");
                    cmd          = cm.AddCommand("Incident", "", "IncidentView", cp);
                    tc.InnerHtml = BuildLinkWithIconAndText("waiting.gif", "tRespGroup", cmd);
                }
                else
                {
                    tc.InnerHtml = BuildIconAndText("waiting.gif", "tRespGroup");
                }
            }

            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            //User
            tr           = new HtmlTableRow();
            tc           = CreateDDCell("SelectThis(this, " + Mediachase.IBN.Business.Security.CurrentUser.UserID + ")");
            tc.InnerHtml = Mediachase.UI.Web.Util.CommonHelper.GetUserStatusUL(Mediachase.IBN.Business.Security.CurrentUser.UserID);
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            //MORE
            cp  = new CommandParameters("MC_HDM_SelectResourceInFrame");
            cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
            cmd = "closeMenu();" + cmd;

            tr           = new HtmlTableRow();
            tc           = CreateDDCell(cmd);
            tc.InnerHtml = String.Format("<b>{0}</b>", LocRM.GetString("tRespMore"));
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);
        }
Esempio n. 36
0
        private void BindList()
        {
            tableDD.Rows.Clear();
            HtmlTableRow  tr = null;
            HtmlTableCell tc = null;

            tr = new HtmlTableRow();
            tc = new HtmlTableCell();
            tc.Attributes.Add("class", "cellclass IconAndText");
            tc.Attributes.Add("onmouseover", "TdOver(this)");
            tc.Attributes.Add("onmouseout", "TdOut(this)");
            tc.Attributes.Add("onclick",
                              String.Format("MC_EDD['{0}'].SelectThis(this, '', '{1}');",
                                            this.ClientID,
                                            PrimaryKeyId.Empty.ToString()
                                            )
                              );
            tc.InnerHtml = String.Format("<span><img alt='' src='{0}'/></span> <span>{1}</span>",
                                         Page.ResolveUrl("~/Layouts/Images/not_set.png"),
                                         LocRM.GetString("tObjectNotSet"));
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            /// HistoryId, ClassName, ObjectId, ObjectTitle, Dt, IsView
            DataTable dt = Mediachase.IBN.Business.Common.GetListEntityHistoryFull();
            DataView  dv = dt.DefaultView;

            //Make filter
            string[] mas    = ObjectTypes.Split(',');
            string   filter = String.Empty;

            for (int i = 0; i < mas.Length; i++)
            {
                if (!String.IsNullOrEmpty(mas[i]))
                {
                    filter += "ClassName='" + mas[i] + "' OR ";
                }
            }
            if (filter.EndsWith(" OR "))
            {
                filter = filter.Substring(0, filter.Length - 4);
            }
            //apply filter
            dv.RowFilter = filter;

            //top ItemCount
            DataTable dtClone = dt.Clone();
            DataRow   dr;
            int       count = 0;

            foreach (DataRowView drv in dv)
            {
                bool fl = true;
                if (!String.IsNullOrEmpty(FilterName))
                {
                    fl = false;
                    #region Filter
                    string       className = drv.Row["ClassName"].ToString();
                    PrimaryKeyId objId     = PrimaryKeyId.Parse(drv.Row["ObjectId"].ToString());
                    EntityObject eo        = BusinessManager.Load(className, objId);
                    if (!String.IsNullOrEmpty(FilterValue))
                    {
                        if (eo.Properties[FilterName].Value == null ||
                            eo.Properties[FilterName].Value.ToString() == FilterValue)
                        {
                            fl = true;
                        }
                    }
                    else
                    {
                        if (eo.Properties[FilterName].Value == null)
                        {
                            fl = true;
                        }
                    }
                    #endregion
                }
                if (fl)
                {
                    count++;
                    dr           = dtClone.NewRow();
                    dr.ItemArray = drv.Row.ItemArray;
                    dtClone.Rows.Add(dr);
                }
                if (count >= ItemCount)
                {
                    break;
                }
            }

            dv      = dtClone.DefaultView;
            dv.Sort = "ObjectTitle";
            foreach (DataRowView drv in dv)
            {
                tr = new HtmlTableRow();
                tc = new HtmlTableCell();
                try
                {
                    tc.InnerHtml = CommonHelper.GetEntityTitle(drv.Row["ClassName"].ToString(), PrimaryKeyId.Parse(drv.Row["ObjectId"].ToString()));
                    tc.Attributes.Add("class", "cellclass");
                    tc.Attributes.Add("onmouseover", "TdOver(this)");
                    tc.Attributes.Add("onmouseout", "TdOut(this)");
                    tc.Attributes.Add("onclick",
                                      String.Format("MC_EDD['{0}'].SelectThis(this, '{1}', '{2}');",
                                                    this.ClientID, drv.Row["ClassName"].ToString(),
                                                    drv.Row["ObjectId"].ToString()
                                                    )
                                      );
                    tr.Cells.Add(tc);
                    tableDD.Rows.Add(tr);
                }
                catch
                {
                }
            }

            tr           = new HtmlTableRow();
            tc           = new HtmlTableCell();
            tc.InnerHtml = String.Format("<b>{0}</b>", LocRM.GetString("tRespMore"));
            tc.Attributes.Add("class", "cellclass");
            tc.Attributes.Add("onmouseover", "TdOver(this)");
            tc.Attributes.Add("onmouseout", "TdOut(this)");

            CommandManager cm = CommandManager.GetCurrent(this.Page);
            if (cm != null)
            {
                CommandParameters cp = new CommandParameters(CommandName);
                cp.CommandArguments = new Dictionary <string, string>();
                cp.AddCommandArgument("SelectCtrlId", this.ClientID);
                cp.AddCommandArgument("Classes", this.ObjectTypes);
                cp.AddCommandArgument("FilterName", this.FilterName);
                cp.AddCommandArgument("FilterValue", this.FilterValue);
                string cmd = cm.AddCommand(ClassName, ViewName, PlaceName, cp);
                tc.Attributes.Add("onclick", "javascript:entityCloseAll();" + cmd);
                tr.Cells.Add(tc);
                tableDD.Rows.Add(tr);
            }
        }
Esempio n. 37
0
        public override void DataBind()
        {
            if (mc != null)
            {
                lnkNew.Text = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "AddSystemView").ToString();
                CommandManager cm = CommandManager.GetCurrent(this.Page);
                CommandParameters cp = new CommandParameters(CommandNewName);
                cp.CommandArguments = new Dictionary<string, string>();
                cp.AddCommandArgument("ClassName", mc.Name);
                string cmd = cm.AddCommand(mc.Name, ViewName, PlaceName, cp);
                lnkNew.NavigateUrl = String.Format("javascript:{{{0}}};", cmd);

                BindGrid();
            }
        }
Esempio n. 38
0
        private string GetCurrentLink(int iFolderId)
        {
            CommandManager cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("FL_ChangeFolder");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("ContainerKey", _containerKey);
            cp.AddCommandArgument("FolderId", iFolderId.ToString());
            string retVal = "javascript:" + cm.AddCommand(_className, _viewName, _placeName, cp);
            retVal = retVal.Replace("\"", "&quot;");
            return retVal;

            //string sPath = HttpContext.Current.Request.Url.LocalPath;
            //if (Request["ProjectId"] != null)
            //    sPath += String.Format("?ProjectId={0}&FolderId={1}&SubTab=0", Request["ProjectId"], iFolderId);
            //else if (Request["IncidentId"] != null)
            //    sPath += String.Format("?IncidentId={0}&FolderId={1}&SubTab=0", Request["IncidentId"], iFolderId);
            //else if (Request["TaskId"] != null)
            //    sPath += String.Format("?TaskId={0}&FolderId={1}&SubTab=0", Request["TaskId"], iFolderId);
            //else if (Request["ToDoId"] != null)
            //    sPath += String.Format("?ToDoId={0}&FolderId={1}&SubTab=0", Request["ToDoId"], iFolderId);
            //else if (Request["EventId"] != null)
            //    sPath += String.Format("?EventId={0}&FolderId={1}&SubTab=0", Request["EventId"], iFolderId);
            //else if (Request["DocumentId"] != null)
            //    sPath += String.Format("?DocumentId={0}&FolderId={1}&SubTab=0", Request["DocumentId"], iFolderId);
            //else
            //    sPath += String.Format("?FolderId={0}&Tab=0", iFolderId);
            //return sPath;
        }
Esempio n. 39
0
        private void BindToolbar()
        {
            secHeader.Title = LocRM.GetString("tbView");

            bool canUpdate = Incident.CanUpdate(IncidentId);
            bool canAddToDoBox = Incident.CanAddToDo(IncidentId);
            bool canAddResBox = Incident.CanModifyResources(IncidentId);
            bool canViewFinances = Incident.CanViewFinances(IncidentId);
            bool canDelete = Incident.CanDelete(IncidentId);
            bool isExternal = Security.CurrentUser.IsExternal;

            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 = null;
            if(!Security.CurrentUser.IsExternal)
                cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters();
            string cmd = String.Empty;

            #region Create ToDo
            if (canAddToDoBox && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/task_create.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl = "~/ToDo/ToDoEdit.aspx?IncidentId=" + IncidentId;
                subItem.Text = LocRM.GetString("tbAdd");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Edit: Incident, GeneralInfo, ResolutionInfo, Status
            if (canUpdate)
            {
                ComponentArt.Web.UI.MenuItem editItem = new ComponentArt.Web.UI.MenuItem();
                editItem.Text = LocRM.GetString("tbViewEdit");
                editItem.Look.RightIconUrl = "../Layouts/Images/arrow_right.gif";
                editItem.Look.HoverRightIconUrl = "../Layouts/Images/arrow_right_hover.gif";
                editItem.Look.RightIconWidth = Unit.Pixel(15);
                editItem.Look.RightIconHeight = Unit.Pixel(10);

                #region Edit Incident
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/incident_edit.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl = "../Incidents/IncidentEdit.aspx?IncidentId=" + IncidentId + "&Back=incident";
                subItem.Text = LocRM.GetString("EditIssue");
                editItem.Items.Add(subItem);
                #endregion

                #region Edit General Info
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.ClientSideCommand = "javascript:ShowWizard('EditGeneralInfo.aspx?IncidentId=" + IncidentId + "', 500, 400);";
                subItem.Text = LocRM2.GetString("EditGeneralInfo");
                editItem.Items.Add(subItem);
                #endregion

                #region Edit Categories
                if (PortalConfig.CommonIncidentAllowEditGeneralCategoriesField ||
                    PortalConfig.IncidentAllowEditIncidentCategoriesField)
                {
                    subItem = new ComponentArt.Web.UI.MenuItem();
                    subItem.ClientSideCommand = "javascript:ShowWizard('EditCategories.aspx?IncidentId=" + IncidentId + "', 300, 350);";
                    subItem.Text = LocRM2.GetString("EditCategories");
                    editItem.Items.Add(subItem);
                }
                #endregion
                /*
                #region Edit State Info
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.ClientSideCommand = "javascript:ShowWizard('EditStateInfo.aspx?ProjectId=" + ProjectId + "', 350, 250);";
                subItem.Text = LocRM.GetString("EditStateInfo");
                editItem.Items.Add(subItem);
                #endregion

            */
                topMenuItem.Items.Add(editItem);
            }
            #endregion

            #region Modyfy Recipients
            if (!isExternal && Mediachase.IBN.Business.Incident.CanUpdateExternalRecipients(IncidentId))
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/editgroup.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp = new CommandParameters("MC_HDM_RecipEdit");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = "javascript:ShowWizard('RecipientsEditor.aspx?IncidentId=" + IncidentId + "', 450, 350);";
                subItem.Text = LocRM.GetString("AddRecipients");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Modyfy Resources
            if (canAddResBox && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/editgroup.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp = new CommandParameters("MC_HDM_ResEdit");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = "javascript:ShowWizard('ResourcesEditor.aspx?IncidentId=" + IncidentId + "', 650, 350);";
                subItem.Text = LocRM.GetString("AddResources");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Delete
            if (canDelete)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/incident_delete.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand = "javascript:DeleteIncident()";
                subItem.Text = LocRM.GetString("Delete");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region MarkAsSpam
            if (canDelete)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/red_denied.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp = new CommandParameters("MC_HDM_MarkAsSpam");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = GetGlobalResourceObject("IbnFramework.Incident", "MarkAsSpam").ToString();
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region --- Seperator ---
            if (topMenuItem.Items.Count > 0)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.LookId = "BreakItem";
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Copy to Clipboard
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/xp-copy.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand = "javascript:try{_XMLReqForClip('AddClip=Issue&IncidentId=" + IncidentId.ToString() + "', '" + LocRM2.GetString("tXMLError") + "')}catch(e){}";
                subItem.Text = LocRM.GetString("tCopyToClipboard");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Add from Clipboard
            if (canUpdate && !isExternal)
            {
                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_HDM_RelatedIssClip");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM.GetString("tPasteFromClipboard");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Clear Clipboard
            if (canUpdate && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/clearbuffer.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand = "javascript:try{_XMLReqForClip('ClearClip=Issue', '" + LocRM2.GetString("tXMLError") + "')}catch(e){}";
                subItem.Text = LocRM2.GetString("tClearClipboard");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region --- Seperator ---
            if (topMenuItem.Items.Count > 0)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.LookId = "BreakItem";
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Add Related Issue
            if (canUpdate && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/relincidents.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);

                cp = new CommandParameters("MC_HDM_RelatedIss");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = String.Format("javascript:OpenPopUpNoScrollWindow(\"../Common/SelectIncident.aspx?btn={0}&exclude={1}\", 640, 480);",
                //    Page.ClientScript.GetPostBackEventReference(btnAddRelatedIss, "xxxtypeid;xxxid"), IncidentId.ToString());
                subItem.Text = LocRM.GetString("tAdd");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Timesheet
            // OR [2007-08-23]: We should use IbnNext TimeTracking
            /*
            if (Configuration.ProjectManagementEnabled)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/timesheet.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                string sPath = (Security.CurrentUser.IsExternal) ? "../External/ExternalTimeTracking.aspx" : "../TimeTracking/TimeTrackingWeek.aspx";
                subItem.ClientSideCommand = String.Format("javascript:ShowWizard('{0}?IncidentId={1}', {2});",
                  sPath, IncidentId, (Security.CurrentUser.IsExternal) ? "800,600" : "450, 200");
                subItem.Text = LocRM.GetString("tbAddTimeSheet");
                topMenuItem.Items.Add(subItem);
            }
             */
            #endregion

            #region UpdateHistory
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.ClientSideCommand = String.Format("javascript:ShowWizard('../Common/SystemEventsByObject.aspx?ObjectId={0}&ObjectTypeId={1}', 750, 466);", IncidentId, (int)ObjectTypes.Issue);
                subItem.Text = LocRM3.GetString("UpdateHistory");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Latest Visitors
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.ClientSideCommand = String.Format("javascript:ShowWizard('../Common/LatestVisitors.aspx?ObjectId={0}&ObjectTypeId={1}', 450, 266);", IncidentId, (int)ObjectTypes.Issue);
                subItem.Text = LocRM3.GetString("LatestVisitors");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region System Notifications
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/accept_1.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl = String.Format("../Directory/SystemNotificationForObject.aspx?ObjectId={0}&ObjectTypeId={1}", IncidentId, ((int)ObjectTypes.Issue).ToString());
                subItem.Text = LocRM2.GetString("SystemNotifications");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Favorites
            if (!Incident.CheckFavorites(IncidentId) && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/Favorites.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand = "javascript:" + Page.ClientScript.GetPostBackEventReference(btnAddToFavorites, "");
                subItem.Text = LocRM.GetString("AddToFavorites");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region PrintPreviewSettings
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/printPreviewButton.png";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp = new CommandParameters("MC_HDM_PrintPreviewSettings");
                cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                cp.AddCommandArgument("IncidentId", IncidentId.ToString());
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM.GetString("PrintSettings");
                topMenuItem.Items.Add(subItem);

                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl = "~/Layouts/Images/print.gif";
                subItem.Look.LeftIconWidth = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp = new CommandParameters("MC_HDM_PrintIssue");
                cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                cp.AddCommandArgument("IncidentId", IncidentId.ToString());
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM.GetString("PrintIssue");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            if (topMenuItem.Items.Count > 0)
                secHeader.ActionsMenu.Items.Add(topMenuItem);
        }
Esempio n. 40
0
        private void OnSelectMethod(string values)
        {
            CommandParameters cp = new CommandParameters();

            switch (_className)
            {
            case "Incident":
                cp.CommandName = "MC_HDM_RelatedIss";
                break;

            case "Project":
                cp.CommandName = "MC_PM_RelatedPrj";
                break;

            default:
                break;
            }

            if (Request["ReturnCommand"] != null)
            {
                cp.CommandName = Request["ReturnCommand"];
            }
            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            cp.AddCommandArgument("ClassName", _className);
            if (Request["ObjectId"] != null)
            {
                cp.AddCommandArgument("ObjectId", Request["ObjectId"]);
            }
            if (Request["GridId"] != null)
            {
                cp.AddCommandArgument("GridId", Request["GridId"]);
            }
            cp.AddCommandArgument("SelectedValue", values);

            if (_className == "User")
            {
                cp.AddCommandArgument("SelectedHtml", Mediachase.UI.Web.Util.CommonHelper.GetUserStatusUL(int.Parse(values)));
            }

            if (!String.IsNullOrEmpty(Request["SelectCtrlId"]))
            {
                string[] mas = values.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                if (mas.Length > 0)
                {
                    cp.AddCommandArgument("SelectObjectId", mas[0]);
                    cp.AddCommandArgument("SelectCtrlId", Request["SelectCtrlId"]);
                    switch (_className)
                    {
                    case "Project":
                        cp.AddCommandArgument("SelectObjectTypeId", "3");
                        cp.AddCommandArgument("Html", CommonHelper.GetObjectHTMLTitle(3, int.Parse(mas[0])));
                        break;

                    case "User":
                        cp.AddCommandArgument("SelectObjectTypeId", "1");
                        cp.AddCommandArgument("Html", CommonHelper.GetObjectHTMLTitle(1, int.Parse(mas[0])));
                        break;

                    default:
                        break;
                    }
                }
            }

            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 41
0
        private void Page_PreRender(object sender, EventArgs e)
        {
            //if ((Security.IsUserInGroup(InternalSecureGroups.PowerProjectManager) || Security.IsUserInGroup(InternalSecureGroups.ExecutiveManager)) && _projectId < 0)
            //    trManager.Visible = true;
            //else
            //    trManager.Visible = false;

            //if (_projectId > 0)
            //{
            //    trProject.Visible = false;
            //    trGroup.Visible = false;
            //}

            //FilterTable.Visible = false;// (_pc["MV_ShowFilter"] != null && bool.Parse(_pc["MV_ShowFilter"]));
            //tblFilterInfo.Visible = !FilterTable.Visible;

            //if (_pc["MV_ShowFilter"] == null || !bool.Parse(_pc["MV_ShowFilter"]))
            //{
            //lbShowFilter.Text = "<img align='absmiddle' border='0' title='" + LocRM.GetString("tShowFilter") + "' src='../Layouts/Images/scrolldown_hover.GIF' />";
            CommandManager cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("MC_ResUtil_FilterEdit");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("ProjectId", _projectId.ToString());
            cp.AddCommandArgument("Objs", Request["Objs"] != null ? Request["Objs"] : String.Empty);
            string cmd = cm.AddCommand("Project", "", "ProjectView", cp);
            cmd = cmd.Replace("\"", "&quot;");
            //lblShowFilter.Text = String.Format("<a href=\"javascript:{{{0}}}\"><img align='absmiddle' border='0' title='{1}' src='{2}' /></a>",
            //    cmd, LocRM.GetString("tShowFilter"), Page.ResolveUrl("~/Layouts/Images/scrolldown_hover.GIF"));
            lblShowFilter.Text = String.Format("<a href=\"javascript:{{{0}}}\">{1}</a>",
                cmd, LocRM.GetString("tShowFilter"));
            //}
            //else
            //    lbHideFilter.Text = "<img align='absmiddle' border='0' title='" + LocRM.GetString("tHideFilter") + "' src='../Layouts/Images/scrollup_hover.GIF' />";

            //if (_shared)
            //{
            //    trUser.Visible = false;
            //    if (_sType != "All")
            //        tdObjs.Visible = false;
            //}

            //if (_projectId <= 0)
            //    trProject.Visible = Configuration.ProjectManagementEnabled;
            if (Mediachase.Ibn.Web.UI.CHelper.NeedToBindGrid())
                BindDataGrid();
            BindToolbar();
        }
Esempio n. 42
0
        protected override void OnPreRender(EventArgs e)
        {
            _pc["MCGrid_ProjectList_" + _viewName + "_PageIndex"] = grdMain.PageIndex.ToString();

            //кнопка очистить фильтр у key-textbox
            btnClear.Visible = !String.IsNullOrEmpty(txtSearch.Text);

            //поле поиска при группировке по клиенту
            divLeftSearchContainer.Visible = (_groupFieldName == Project.AvailableGroupField.Client.ToString());
            if (divLeftSearchContainer.Visible)
            {
                ibGroupClear.Visible = !String.IsNullOrEmpty(txtGroupSearch.Text.Trim());
                txtGroupSearch.Width = (String.IsNullOrEmpty(txtGroupSearch.Text.Trim())) ? Unit.Pixel(160) : Unit.Pixel(140);
            }

            //стиль key-textbox
            txtSearch.BorderWidth = 1;
            txtSearch.BorderStyle = BorderStyle.Solid;
            txtSearch.Style.Add(HtmlTextWriterStyle.Padding, "2px");
            txtSearch.BorderColor = Color.FromArgb(127, 157, 185);
            txtSearch.BackColor = (!String.IsNullOrEmpty(txtSearch.Text)) ? Color.FromArgb(255, 240, 144) : Color.White;

            //если необходимо перебиндить датагрид
            if (CHelper.NeedToBindGrid())
            {
                //если кто-то где-то изменил значение quickfilter с ролью - надо перезагрузить вид
                if (String.Compare(_viewName, ddFilters.SelectedValue, true) != 0)
                {
                    this.Page.Response.Redirect(this.Page.Request.RawUrl, true);
                    return;
                }
                //биндим датагрид
                BindDataGrid(true);
                //обновляем UpdatePanel грида
                grdMainPanel.Update();
            }

            //собираем текст FilterView
            string sText = String.Empty;
            if (!String.IsNullOrEmpty(_filterText))
            {
                sText = _filterText;
            }
            else
            {
                if (_isFilterSet)
                {
                    sText = GetGlobalResourceObject("IbnFramework.Global", "FilterIsSet").ToString();
                }
                else
                {
                    sText = GetGlobalResourceObject("IbnFramework.Global", "FilterIsNotSet").ToString();
                }
            }
            FilterIsSet.ForeColor = Color.FromArgb(0x90, 0x90, 0x90);
            FilterIsSet.Text = sText;

            //в случае, если отображаемый набор фильтров создан текущим пользователем - он может его удалить
            //генерируем imagebutton справа от набора фильтров
            ibDeleteInfo.ToolTip = GetGlobalResourceObject("IbnFramework.Project", "_mc_DeleteView").ToString();
            ibDeleteInfo.Attributes.Add("onclick", String.Format("return confirm('{0}');", GetGlobalResourceObject("IbnFramework.Project", "_mc_DeleteViewWarning").ToString()));
            ibDeleteInfo.Visible = Mediachase.Ibn.Core.ListViewProfile.CanDelete(_className, ddFilters.SelectedValue, String.Empty, Mediachase.IBN.Business.Security.CurrentUser.UserID);

            ibEditInfo.ToolTip = GetGlobalResourceObject("IbnFramework.Common", "Edit").ToString();
            CommandManager cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("MC_PM_FiltersEdit");
            cp.CommandArguments = new Dictionary<string, string>();
            cp.AddCommandArgument("uid", ddFilters.SelectedValue);
            string scriptEdit = cm.AddCommand(_className, _viewName, _placeName, cp);
            ibEditInfo.Attributes.Add("onclick", String.Format("javascript:{{{0};return false;}}", scriptEdit));
            ibEditInfo.Visible = Mediachase.Ibn.Core.ListViewProfile.CanDelete(_className, ddFilters.SelectedValue, String.Empty, Mediachase.IBN.Business.Security.CurrentUser.UserID);

            cp = new CommandParameters("MC_PM_FiltersNew");
            scriptEdit = cm.AddCommand(_className, _fieldSetName, _placeName, cp);
            scriptEdit = scriptEdit.Replace("\"", "&quot;");
            AddNewViewScript = scriptEdit;

            hfFilterValue.Value = ddFilters.SelectedValue;

            base.OnPreRender(e);
        }
Esempio n. 43
0
        /// <summary>
        /// Binds from value.
        /// </summary>
        private void BindFromValue(string metaClassName)
        {
            CommandParameters cp = new CommandParameters("MC_MUI_EntityDDSmall");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            if (!String.IsNullOrEmpty(metaClassName))
                cp.AddCommandArgument("Classes", metaClassName);
            cp.AddCommandArgument("Refresh", String.Format("Refresh{0}", this.ID));
            //Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());

            string scriptToExecute = CommandManager.GetCurrent(this.Page).AddCommand(metaClassName, string.Empty, string.Empty, cp);

            if (this.Value == null)
            {
                lblValue.Text = CHelper.GetResFileString("{IbnFramework.Common:tFilterSelectObject}");
            }
            else
            {
                PrimaryKeyId id = PrimaryKeyId.Parse(this.Value.ToString());
                EntityObject obj = BusinessManager.Load(metaClassName, id);
                MetaClass mc = MetaDataWrapper.GetMetaClassByName(obj.MetaClassName);
                lblValue.Text = obj.Properties[mc.TitleFieldName].Value.ToString();
            }

            lblValue.Attributes.Add("onclick", scriptToExecute);
        }
Esempio n. 44
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GetCurrentFolder();
            CHelper.AddToContext(_folderIdKey, _folderId.ToString());
            CHelper.AddToContext(_containerKeyKey, _containerKey);
            CHelper.AddToContext(_containerNameKey, _containerName);

            if (!Page.IsPostBack)
            {
                BindBlockHeader();

                if (_pc["fs_ViewStyle"] == null)
                    _pc["fs_ViewStyle"] = "ListView";
            }
            _viewName = _pc["fs_ViewStyle"];

            grdMain.ClassName = _className;
            grdMain.ViewName = _viewName;
            grdMain.PlaceName = _placeName;

            MainMetaToolbar.ClassName = _className;
            MainMetaToolbar.ViewName = _viewName;
            MainMetaToolbar.PlaceName = _placeName;

            CommandManager cm = CommandManager.GetCurrent(this.Page);

            CommandParameters cp = new CommandParameters("FL_ChangeFolderTree");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("ContainerKey", _containerKey);
            cp.AddCommandArgument("FolderId", _rootId.ToString());
            string cmd = cm.AddCommand(_className, _viewName, _placeName, cp);
            cmd = cmd.Replace("\"", "&quot;");

            jsTreeExt.FolderId = _folderId.ToString();
            jsTreeExt.IconUrl = ResolveClientUrl("~/layouts/images/folder.gif");
            jsTreeExt.RootHrefCommand = String.Format("javascript:{0}", cmd);
            jsTreeExt.RootId = _rootId.ToString();
            jsTreeExt.RootNodeText = LocRM.GetString("tRoot");
            jsTreeExt.TreeSourceUrl = ResolveClientUrl("~/Apps/FileLibrary/Pages/FileLibraryTreeSource.aspx?ContainerName=" + _containerName + "&ContainerKey=" + _containerKey + "&FolderId=" + _folderId);

            BindDataGrid(!Page.IsPostBack);

            cm.AddCommand(_className, _viewName, _placeName, "FL_Selected_MoveToFolder");
        }
Esempio n. 45
0
        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            this.Page.Validate();
            if (!this.Page.IsValid)
            {
                btnSave.Attributes.Remove("onclick");
                btnCancel.Attributes.Remove("onclick");
                return;
            }

            EntityObject _bindObject = BusinessManager.InitializeEntity(ddFilter.SelectedValue);

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

                // Save container id
                if (!String.IsNullOrEmpty(ContainerFieldName)
                    && ((EntityObject)_bindObject).Properties[ContainerFieldName] != null
                    && ContainerId != PrimaryKeyId.Empty)
                {
                    ((EntityObject)_bindObject)[ContainerFieldName] = ContainerId;
                }

                PrimaryKeyId objectId = BusinessManager.Create(_bindObject);

                CommandParameters cp = new CommandParameters("MC_MUI_EntityDD");

                if (Request["ReturnCommand"] != null)
                    cp.CommandName = Request["ReturnCommand"];

                cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                cp.AddCommandArgument("ClassName", ddFilter.SelectedValue);
                if (Request["ObjectId"] != null)
                    cp.AddCommandArgument("ObjectId", Request["ObjectId"]);
                if (Request["GridId"] != null)
                    cp.AddCommandArgument("GridId", Request["GridId"]);
                cp.AddCommandArgument("SelectedValue", objectId.ToString());
                cp.AddCommandArgument("SelectObjectId", objectId.ToString());
                cp.AddCommandArgument("SelectObjectType", ddFilter.SelectedValue);
                cp.AddCommandArgument("Html", CHelper.GetEntityTitleHtml(ddFilter.SelectedValue, objectId));

                if (!String.IsNullOrEmpty(Request["SelectCtrlId"]))
                    cp.AddCommandArgument("SelectCtrlId", Request["SelectCtrlId"]);

                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
        }
Esempio n. 46
0
        private void btnMove_ServerClick(object sender, EventArgs e)
        {
            int iDestFolder = -1;
            try
            {
                iDestFolder = ctrlDirTree.FolderId;
            }
            catch { }
            if (iDestFolder == -1)
            {
                lblNotValid.Visible = true;
                return;
            }

            CommandParameters cp = new CommandParameters("FL_Selected_Move");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("DestFolderId", iDestFolder.ToString());
            cp.AddCommandArgument("ContainerKey", ContainerKey);
            cp.AddCommandArgument("ContainerName", ContainerName);

            if (Request["GridId"] != null)
            {
                cp.CommandName = "FL_Selected_MoveToFolder";
                cp.AddCommandArgument("GridId", Request["GridId"]);
            }
            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 47
0
        private void BindBlockHeader()
        {
            // Check, that there are fields left
            MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName);
            HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc);
            Collection<string> selectedFields = historyInfo.SelectedFields;
            bool fieldsExist = false;
            foreach (MetaField mf in mc.Fields)
            {
                if (HistoryManager.IsSupportedField(mf) && !selectedFields.Contains(mf.Name))
                {
                    fieldsExist = true;
                    break;
                }
            }

            CommandManager cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp;

            if (fieldsExist)
            {
                string id = String.Empty;
                ListViewProfile[] mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
                if (mas.Length == 0)
                    id = CHelper.GetHistorySystemListViewProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
                else
                    id = mas[0].Id;

                cp = new CommandParameters("MC_ListApp_HistoryProfileEdit");
                cp.CommandArguments = new Dictionary<string, string>();
                cp.AddCommandArgument("ClassName", HistoryManager.GetHistoryMetaClassName(ClassName));
                cp.AddCommandArgument("uid", id);
                string cmd = cm.AddCommand("", "", "ListInfoView", cp);
                MainBlockHeader.AddRightLink(
                    GetGlobalResourceObject("IbnFramework.ListInfo", "HistoryView").ToString(),
                    String.Format("javascript:{{{0}}};", cmd));

                cp = new CommandParameters("MC_ListApp_AddHistoryFieldFrame", new Dictionary<string, string>());
                cp.AddCommandArgument("ClassName", ClassName);
                string command = cm.AddCommand("", "", "ListInfoView", cp);

                MainBlockHeader.AddRightLink(
                    GetGlobalResourceObject("IbnFramework.ListInfo", "AddField").ToString(),
                    String.Format("javascript:{{{0}}};", command));
            }
        }
Esempio n. 48
0
        void btnRefresh_Click(object sender, EventArgs e)
        {
            string arg = Request["__EVENTARGUMENT"];

            string[]  values  = arg.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
            DataTable dt      = null;
            ArrayList alUsers = new ArrayList();

            if (ViewState["ResponsiblePool"] != null)
            {
                dt = ((DataTable)ViewState["ResponsiblePool"]).Copy();
            }
            try
            {
                for (int i = 0; i < values.Length; i++)
                {
                    string sUser   = values[i].Substring(0, values[i].IndexOf("*"));
                    string temp    = values[i].Substring(values[i].IndexOf("*") + 1);
                    string sStatus = temp.Substring(0, temp.IndexOf("*"));
                    string sIsNew  = temp.Substring(temp.IndexOf("*") + 1);
                    alUsers.Add(int.Parse(sUser, CultureInfo.InvariantCulture));
                    DataRow[] dr_mas = dt.Select("PrincipalId=" + sUser);
                    if (dr_mas.Length > 0)
                    {
                        dr_mas[0]["ResponsePending"] = (sStatus == "1");
                        if (sIsNew == "1")
                        {
                            dr_mas[0]["IsNew"] = true;
                        }
                    }
                    else
                    {
                        DataRow newRow = dt.NewRow();
                        newRow["PrincipalId"]     = int.Parse(sUser, CultureInfo.InvariantCulture);
                        newRow["IsGroup"]         = false;
                        newRow["ResponsePending"] = (sStatus == "1");
                        newRow["IsNew"]           = true;
                        dt.Rows.Add(newRow);
                    }
                }
            }
            catch
            {
            }
            ArrayList alDeleted = new ArrayList();

            foreach (DataRow dr in dt.Rows)
            {
                if (!alUsers.Contains((int)dr["PrincipalId"]))
                {
                    alDeleted.Add((int)dr["PrincipalId"]);
                }
            }
            foreach (int iDel in alDeleted)
            {
                DataRow[] dr_mas = dt.Select("PrincipalId = " + iDel);
                if (dr_mas.Length > 0)
                {
                    dt.Rows.Remove(dr_mas[0]);
                }
            }

            ViewState["ResponsiblePool"] = dt.Copy();

            CommandManager cm = CommandManager.GetCurrent(this.Page);

            if (IsAllDenied())
            {
                if (!Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    CommandParameters cp = new CommandParameters("MC_HDM_GroupResponsibilityInFrame");
                    cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                    cp.AddCommandArgument("sUsersKey", arg);
                    cp.AddCommandArgument("NotChangeKey", "0");
                    string cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                    lblClient.Text = BuildLinkWithIconAndText("red_denied.gif", "tRespGroup", cmd);
                }
                else
                {
                    lblClient.Text = BuildIconAndText("red_denied.gif", "tRespGroup");
                }
            }
            else
            {
                if (!Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    CommandParameters cp = new CommandParameters("MC_HDM_GroupResponsibilityInFrame");
                    cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                    cp.AddCommandArgument("sUsersKey", arg);
                    cp.AddCommandArgument("NotChangeKey", "0");
                    string cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                    lblClient.Text = BuildLinkWithIconAndText("waiting.gif", "tRespGroup", cmd);
                }
                else
                {
                    lblClient.Text = BuildIconAndText("waiting.gif", "tRespGroup");
                }
            }
        }
Esempio n. 49
0
        private void BindResponsible(GeneralIncidentBoxBlock gibb)
        {
            //			ddResponsible.Visible = false;
            //			lblResponsible.Visible = true;
            //			lblChangeButton.Visible = true;
            //			lblResponsible.Text = "";
            //			lblChangeButton.Text = "";
            lblForResp.Text = LocRM.GetString("tPool") + ":";
            string sResps = "";
            string sUsers = "";
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("PureName", typeof(string)));
            dt.Columns.Add(new DataColumn("UserName", typeof(string)));
            DataRow dr;
            if (gibb.ResponsiblePool != null)
                foreach (int iUserId in gibb.ResponsiblePool)
                {
                    sUsers += iUserId + "_";
                    dr = dt.NewRow();
                    dr["PureName"] = Util.CommonHelper.GetUserStatusPureName(iUserId);
                    dr["UserName"] = Util.CommonHelper.GetUserStatus(iUserId);
                    dt.Rows.Add(dr);
                }
            DataView dv = dt.DefaultView;
            dv.Sort = "PureName";
            foreach (DataRowView drv in dv)
                sResps += drv["UserName"].ToString() + "<br />";

            if (sResps.Length == 0)
                sResps = "&nbsp;";
            lblResponsible.Text = String.Format("<span class='text' style='width:180px;'>{0}</span>&nbsp;&nbsp;",
                sResps);

            CommandManager cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("MC_HDM_AdminResponsiblePool");
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("sUsersKey", sUsers);
            string cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
            cmd = cmd.Replace("\"", "&quot;");

            lblChangeButton.Text = String.Format("<a href=\"javascript:{{{2}}}\"><img align='absmiddle' border='0' src='{0}' />&nbsp;{1}</a>",
                ResolveClientUrl("~/layouts/images/icons/regular.gif"),
                LocRM.GetString("tChange"), cmd);
        }
        protected void AssignmentGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            CommandManager cm = CommandManager.GetCurrent(this.Page);
            ImageButton reassignButton = (ImageButton)e.Row.FindControl("ReassignButton");
            if (reassignButton != null)
            {
                CommandParameters cp = new CommandParameters("MC_WF_SelectUser");
                cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                cp.AddCommandArgument("AssignmentId", ((EntityObject)(e.Row.DataItem)).PrimaryKeyId.ToString());
                string cmd = cm.AddCommand("User", String.Empty, "ActiveAssignments", cp);
                cmd = cmd.Replace("\"", "&quot;");

                reassignButton.Attributes.Add("onclick", String.Concat(cmd, "return false;"));
            }

            ImageButton editButton = (ImageButton)e.Row.FindControl("EditButton");
            if (editButton != null)
            {
                CommandParameters cp = new CommandParameters("MC_WF_EditAssignment");
                cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                cp.AddCommandArgument("AssignmentId", ((EntityObject)(e.Row.DataItem)).PrimaryKeyId.ToString());
                string cmd = cm.AddCommand("User", String.Empty, "ActiveAssignments", cp);
                cmd = cmd.Replace("\"", "&quot;");

                editButton.Attributes.Add("onclick", String.Concat(cmd, "return false;"));
            }
        }
Esempio n. 51
0
        private void OnSelectMethod(string values)
        {
            CommandParameters cp = new CommandParameters();
            switch (_className)
            {
                case "Incident":
                    cp.CommandName = "MC_HDM_RelatedIss";
                    break;
                case "Project":
                    cp.CommandName = "MC_PM_RelatedPrj";
                    break;
                default:
                    break;
            }

            if (Request["ReturnCommand"] != null)
                cp.CommandName = Request["ReturnCommand"];
            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("ClassName", _className);
            if (Request["ObjectId"] != null)
                cp.AddCommandArgument("ObjectId", Request["ObjectId"]);
            if (Request["GridId"] != null)
                cp.AddCommandArgument("GridId", Request["GridId"]);
            cp.AddCommandArgument("SelectedValue", values);

            if (_className == "User")
                cp.AddCommandArgument("SelectedHtml", Mediachase.UI.Web.Util.CommonHelper.GetUserStatusUL(int.Parse(values)));

            if (!String.IsNullOrEmpty(Request["SelectCtrlId"]))
            {
                string[] mas = values.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                if (mas.Length > 0)
                {
                    cp.AddCommandArgument("SelectObjectId", mas[0]);
                    cp.AddCommandArgument("SelectCtrlId", Request["SelectCtrlId"]);
                    switch (_className)
                    {
                        case "Project":
                            cp.AddCommandArgument("SelectObjectTypeId", "3");
                            cp.AddCommandArgument("Html", CommonHelper.GetObjectHTMLTitle(3, int.Parse(mas[0])));
                            break;
                        case "User":
                            cp.AddCommandArgument("SelectObjectTypeId", "1");
                            cp.AddCommandArgument("Html", CommonHelper.GetObjectHTMLTitle(1, int.Parse(mas[0])));
                            break;
                        default:
                            break;
                    }

                }
            }

            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 52
0
        private void BindList()
        {
            tableDD.Rows.Clear();
            HtmlTableRow  tr = null;
            HtmlTableCell tc = null;

            tr = new HtmlTableRow();
            tc = new HtmlTableCell();
            if (String.IsNullOrEmpty(this.NotSetText))
            {
                tc.InnerHtml = String.Format("<span><img alt='' src='{0}'/></span> <span>{1}</span>",
                                             Page.ResolveUrl("~/Layouts/Images/not_set.png"),
                                             LocRM.GetString("tObjectNotSet"));
            }
            else
            {
                tc.InnerHtml = this.NotSetText;
            }

            tc.Attributes.Add("class", "cellclass");
            tc.Attributes.Add("onmouseover", "TdOver(this)");
            tc.Attributes.Add("onmouseout", "TdOut(this)");
            tc.Attributes.Add("onclick",
                              String.Format("MC_ODD['{0}'].SelectThis(this, -1, -1);",
                                            this.ClientID)
                              );
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            /// HistoryId, ObjectTypeId, ObjectId, ObjectTitle, Dt, IsView
            DataTable dt = Mediachase.IBN.Business.Common.GetListHistoryFull();
            DataView  dv = dt.DefaultView;

            //Make filter
            string[] mas    = ObjectTypes.Split(',');
            string   filter = "";

            for (int i = 0; i < mas.Length; i++)
            {
                if (mas[i] != "")
                {
                    filter += "ObjectTypeId=" + mas[i] + " OR ";
                }
            }
            if (filter.EndsWith(" OR "))
            {
                filter = filter.Substring(0, filter.Length - 4);
            }
            //apply filter
            dv.RowFilter = filter;

            //top ItemCount
            DataTable dtClone = dt.Clone();
            DataRow   dr;
            int       count = 0;

            foreach (DataRowView drv in dv)
            {
                if (ObjectTypes == "3")                 // Project
                {
                    int projectId = (int)drv.Row["ObjectId"];
                    //check access
                    if (!Project.CanRead(projectId))
                    {
                        continue;
                    }
                    // skip inactive projects
                    using (IDataReader reader = Project.GetProject(projectId, false))
                    {
                        if (reader.Read())
                        {
                            int statusId = (int)reader["StatusId"];
                            if (statusId == (int)Project.ProjectStatus.OnHold ||
                                statusId == (int)Project.ProjectStatus.Completed ||
                                statusId == (int)Project.ProjectStatus.Cancelled)
                            {
                                continue;
                            }
                        }
                    }
                }

                count++;
                dr           = dtClone.NewRow();
                dr.ItemArray = drv.Row.ItemArray;
                dtClone.Rows.Add(dr);
                if (count >= ItemCount)
                {
                    break;
                }
            }

            dv      = dtClone.DefaultView;
            dv.Sort = "ObjectTitle";
            foreach (DataRowView drv in dv)
            {
                tr           = new HtmlTableRow();
                tc           = new HtmlTableCell();
                tc.InnerHtml = Util.CommonHelper.GetObjectHTMLTitle((int)drv.Row["ObjectTypeId"], (int)drv.Row["ObjectId"]);
                tc.Attributes.Add("class", "cellclass");
                tc.Attributes.Add("onmouseover", "TdOver(this)");
                tc.Attributes.Add("onmouseout", "TdOut(this)");
                tc.Attributes.Add("onclick",
                                  String.Format("MC_ODD['{0}'].SelectThis(this, {1}, {2});",
                                                this.ClientID, drv.Row["ObjectTypeId"].ToString(),
                                                drv.Row["ObjectId"].ToString())
                                  );
                tr.Cells.Add(tc);
                tableDD.Rows.Add(tr);
            }

            if (ObjectTypes == "3")                     // Project
            {
                tr           = new HtmlTableRow();
                tc           = new HtmlTableCell();
                tc.InnerHtml = String.Format("<b>{0}</b>", LocRM.GetString("tRespMore"));
                tc.Attributes.Add("class", "cellclass");
                tc.Attributes.Add("onmouseover", "TdOver(this)");
                tc.Attributes.Add("onmouseout", "TdOut(this)");
                CommandManager    cm = CommandManager.GetCurrent(this.Page);
                CommandParameters cp = new CommandParameters(CommandName);
                cp.CommandArguments = new Dictionary <string, string>();
                cp.AddCommandArgument("SelectCtrlId", this.ClientID);
                string cmd = cm.AddCommand(ClassName, ViewName, PlaceName, cp);
                tc.Attributes.Add("onclick", "javascript:closeAll();" + cmd);
                tr.Cells.Add(tc);
                tableDD.Rows.Add(tr);
            }

            if (ObjectTypes == "1")                     // User
            {
                tr           = new HtmlTableRow();
                tc           = new HtmlTableCell();
                tc.InnerHtml = String.Format("<b>{0}</b>", LocRM.GetString("tRespMore"));
                tc.Attributes.Add("class", "cellclass");
                tc.Attributes.Add("onmouseover", "TdOver(this)");
                tc.Attributes.Add("onmouseout", "TdOut(this)");
                CommandManager    cm = CommandManager.GetCurrent(this.Page);
                CommandParameters cp = new CommandParameters(CommandName);
                cp.CommandArguments = new Dictionary <string, string>();
                cp.AddCommandArgument("SelectCtrlId", this.ClientID);
                string cmd = cm.AddCommand(ClassName, ViewName, PlaceName, cp);
                tc.Attributes.Add("onclick", "javascript:closeAll();" + cmd);
                tr.Cells.Add(tc);
                tableDD.Rows.Add(tr);
            }
        }
Esempio n. 53
0
        void btnRefresh_Click(object sender, EventArgs e)
        {
            string arg = Request["__EVENTARGUMENT"];
            string[] values = arg.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
            DataTable dt = null;
            ArrayList alUsers = new ArrayList();
            if (ViewState["ResponsiblePool"] != null)
                dt = ((DataTable)ViewState["ResponsiblePool"]).Copy();
            try
            {
                for (int i = 0; i < values.Length; i++)
                {
                    string sUser = values[i].Substring(0, values[i].IndexOf("*"));
                    string temp = values[i].Substring(values[i].IndexOf("*") + 1);
                    string sStatus = temp.Substring(0, temp.IndexOf("*"));
                    string sIsNew = temp.Substring(temp.IndexOf("*") + 1);
                    alUsers.Add(int.Parse(sUser, CultureInfo.InvariantCulture));
                    DataRow[] dr_mas = dt.Select("PrincipalId=" + sUser);
                    if (dr_mas.Length > 0)
                    {
                        dr_mas[0]["ResponsePending"] = (sStatus == "1");
                        if (sIsNew == "1")
                            dr_mas[0]["IsNew"] = true;
                    }
                    else
                    {
                        DataRow newRow = dt.NewRow();
                        newRow["PrincipalId"] = int.Parse(sUser, CultureInfo.InvariantCulture);
                        newRow["IsGroup"] = false;
                        newRow["ResponsePending"] = (sStatus == "1");
                        newRow["IsNew"] = true;
                        dt.Rows.Add(newRow);
                    }
                }
            }
            catch
            {
            }
            ArrayList alDeleted = new ArrayList();
            foreach (DataRow dr in dt.Rows)
                if (!alUsers.Contains((int)dr["PrincipalId"]))
                    alDeleted.Add((int)dr["PrincipalId"]);
            foreach (int iDel in alDeleted)
            {
                DataRow[] dr_mas = dt.Select("PrincipalId = " + iDel);
                if (dr_mas.Length > 0)
                    dt.Rows.Remove(dr_mas[0]);
            }

            ViewState["ResponsiblePool"] = dt.Copy();

            CommandManager cm = CommandManager.GetCurrent(this.Page);

            if (IsAllDenied())
            {
                if (!Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    CommandParameters cp = new CommandParameters("MC_HDM_GroupResponsibilityInFrame");
                    cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                    cp.AddCommandArgument("sUsersKey", arg);
                    cp.AddCommandArgument("NotChangeKey", "0");
                    string cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                    lblClient.Text = BuildLinkWithIconAndText("red_denied.gif", "tRespGroup", cmd);
                }
                else
                    lblClient.Text = BuildIconAndText("red_denied.gif", "tRespGroup");
            }
            else
            {
                if (!Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    CommandParameters cp = new CommandParameters("MC_HDM_GroupResponsibilityInFrame");
                    cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                    cp.AddCommandArgument("sUsersKey", arg);
                    cp.AddCommandArgument("NotChangeKey", "0");
                    string cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                    lblClient.Text = BuildLinkWithIconAndText("waiting.gif", "tRespGroup", cmd);
                }
                else
                    lblClient.Text = BuildIconAndText("waiting.gif", "tRespGroup");
            }
        }
Esempio n. 54
0
        private void BindGrid()
        {
            DataTable dt = new DataTable();
            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add("Id", typeof(string));
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("EditLink", typeof(string));
            dt.Columns.Add("CanDelete", typeof(bool));
            dt.Columns.Add("CanReset", typeof(bool));

            CommandManager cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp;
            ListViewProfile[] list = ListViewProfile.GetSystemProfiles(mc.Name, PlaceName);
            foreach (ListViewProfile lvp in list)
            {
                DataRow dr = dt.NewRow();
                dr["Id"] = lvp.Id;
                dr["Name"] = CHelper.GetResFileString(lvp.Name);
                cp = new CommandParameters(CommandEditName);
                cp.CommandArguments = new Dictionary<string, string>();
                cp.AddCommandArgument("ClassName", mc.Name);
                cp.AddCommandArgument("uid", lvp.Id);
                string cmd = cm.AddCommand(mc.Name, ViewName, PlaceName, cp);
                dr["EditLink"] = String.Format("javascript:{{{0}}};", cmd);
                if (ListManager.MetaClassIsList(mc.Name))
                    dr["CanDelete"] = list.Length > 1 && !lvp.ReadOnly;
                else
                    dr["CanDelete"] = !lvp.ReadOnly;
                dr["CanReset"] = false;
                dt.Rows.Add(dr);
            }

            grdMain.DataSource = dt;
            grdMain.DataBind();

            foreach (DataGridItem row in grdMain.Items)
            {
                ImageButton ib;
                ib = (ImageButton)row.FindControl("ibDelete");
                if (ib != null)
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Delete").ToString() + "?')");

                ib = (ImageButton)row.FindControl("ibReset");
                if (ib != null)
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "ResetToDefault").ToString() + "?')");
            }
        }
Esempio n. 55
0
        private void BindList()
        {
            DataTable dt = null;
            if (ViewState["ResponsiblePool"] != null)
                dt = ((DataTable)ViewState["ResponsiblePool"]).Copy();
            string sUsers = "";
            if (dt != null)
                foreach (DataRow dr in dt.Rows)
                {
                    if ((bool)dr["ResponsePending"])
                        sUsers += dr["PrincipalId"].ToString() + "*1_";
                    else
                        sUsers += dr["PrincipalId"].ToString() + "*0_";
                }
            tableDD.Rows.Clear();
            HtmlTableRow tr = null;
            HtmlTableCell tc = null;

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

            //NotChange
            tr = new HtmlTableRow();
            tc = CreateDDCell("SelectThis(this, -3)");
            tc.InnerHtml = "&nbsp;";
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            //NotSet
            tr = new HtmlTableRow();
            tc = CreateDDCell("SelectThis(this, -2)");
            tc.InnerHtml = BuildIconAndText("not_set.png", "tRespNotSet");
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            //Group Resp
            tr = new HtmlTableRow();
            tc = CreateDDCell("SelectThis(this, -1)");

            if (IsAllDenied())
            {
                if (!Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    cp = new CommandParameters("MC_HDM_GroupResponsibilityInFrame");
                    cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                    cp.AddCommandArgument("sUsersKey", sUsers);
                    cp.AddCommandArgument("NotChangeKey", "0");
                    cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                    tc.InnerHtml = BuildLinkWithIconAndText("red_denied.gif", "tRespGroup", cmd);
                }
                else
                    tc.InnerHtml = BuildIconAndText("red_denied.gif", "tRespGroup");
            }
            else
            {
                if (!Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    cp = new CommandParameters("MC_HDM_GroupResponsibilityInFrame");
                    cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                    cp.AddCommandArgument("sUsersKey", sUsers);
                    cp.AddCommandArgument("NotChangeKey", "0");
                    cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                    tc.InnerHtml = BuildLinkWithIconAndText("waiting.gif", "tRespGroup", cmd);
                }
                else
                    tc.InnerHtml = BuildIconAndText("waiting.gif", "tRespGroup");
            }

            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            //User
            tr = new HtmlTableRow();
            tc = CreateDDCell("SelectThis(this, " + Mediachase.IBN.Business.Security.CurrentUser.UserID + ")");
            tc.InnerHtml = Mediachase.UI.Web.Util.CommonHelper.GetUserStatusUL(Mediachase.IBN.Business.Security.CurrentUser.UserID);
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);

            //MORE
            cp = new CommandParameters("MC_HDM_SelectResourceInFrame");
            cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
            cmd = "closeMenu();" + cmd;

            tr = new HtmlTableRow();
            tc = CreateDDCell(cmd);
            tc.InnerHtml = String.Format("<b>{0}</b>", LocRM.GetString("tRespMore"));
            tr.Cells.Add(tc);
            tableDD.Rows.Add(tr);
        }
Esempio n. 56
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            btnSave.Disabled = true;
            btnCancel.Disabled = true;

            CommandParameters cp = new CommandParameters("MC_MUI_EntityDD");

            if (Request["ReturnCommand"] != null)
                cp.CommandName = Request["ReturnCommand"];

            cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
            cp.AddCommandArgument("ClassName", ddFilter.SelectedValue);
            if (Request["ObjectId"] != null)
                cp.AddCommandArgument("ObjectId", Request["ObjectId"]);
            if (Request["GridId"] != null)
                cp.AddCommandArgument("GridId", Request["GridId"]);
            if (TreeServiceTargetObjectId != PrimaryKeyId.Empty)
                cp.AddCommandArgument("TreeServiceTargetObjectId", TreeServiceTargetObjectId.ToString());
            cp.AddCommandArgument("SelectedValue", hdnValue.Value);

            if (!String.IsNullOrEmpty(Request["SelectCtrlId"]))
            {
                string[] mas = hdnValue.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                if (mas.Length > 0)
                {
                    string uid = MetaViewGroupUtil.GetIdFromUniqueKey(mas[0]);
                    if (uid != "null")
                    {
                        cp.AddCommandArgument("SelectObjectId", uid);
                        cp.AddCommandArgument("SelectCtrlId", Request["SelectCtrlId"]);
                        cp.AddCommandArgument("SelectObjectType", ddFilter.SelectedValue);
                        cp.AddCommandArgument("Html", CHelper.GetEntityTitleHtml(ddFilter.SelectedValue, PrimaryKeyId.Parse(uid)));
                    }
                }
            }
            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Esempio n. 57
0
        protected override void OnPreRender(EventArgs e)
        {
            _pc["EntityList_" + ClassName + "_" + _profileName + "_PageIndex"] = grdMain.PageIndex.ToString();

            //кнопка очистить фильтр у key-textbox
            btnClear.Visible = !String.IsNullOrEmpty(txtSearch.Text);

            //стиль key-textbox
            txtSearch.BorderWidth = 1;
            txtSearch.BorderStyle = BorderStyle.Solid;
            txtSearch.Style.Add(HtmlTextWriterStyle.Padding, "2px");
            txtSearch.BorderColor = Color.FromArgb(127, 157, 185);
            txtSearch.BackColor   = (!String.IsNullOrEmpty(txtSearch.Text)) ? Color.FromArgb(255, 240, 144) : Color.White;

            //если необходимо перебиндить датагрид
            if (CHelper.NeedToBindGrid())
            {
                //если кто-то где-то изменил значение quickfilter с ролью - надо перезагрузить вид
                if (String.Compare(_profileName, ddProfiles.SelectedValue, true) != 0)
                {
                    this.Page.Response.Redirect(this.Page.Request.RawUrl, true);
                    return;
                }
                //биндим датагрид
                BindDataGrid(true);
                //обновляем UpdatePanel грида
                grdMainPanel.Update();
            }

            //собираем текст FilterView
            string sText = String.Empty;

            if (!String.IsNullOrEmpty(_filterText))
            {
                sText = _filterText;
            }
            else
            {
                if (_isFilterSet)
                {
                    sText = GetGlobalResourceObject("IbnFramework.Global", "FilterIsSet").ToString();
                }
                else
                {
                    sText = GetGlobalResourceObject("IbnFramework.Global", "FilterIsNotSet").ToString();
                }
            }
            FilterIsSet.ForeColor = Color.FromArgb(0x90, 0x90, 0x90);
            FilterIsSet.Text      = sText;

            int currentUserId = Mediachase.Ibn.Data.Services.Security.CurrentUserId;

            //в случае, если отображаемый набор фильтров создан текущим пользователем - он может его удалить
            //генерируем imagebutton справа от набора фильтров
            ibDeleteInfo.ToolTip = GetGlobalResourceObject("IbnFramework.Incident", "_mc_DeleteView").ToString();
            ibDeleteInfo.Attributes.Add("onclick", String.Format("return confirm('{0}');", GetGlobalResourceObject("IbnFramework.Incident", "_mc_DeleteViewWarning").ToString()));
            ibDeleteInfo.Visible = Mediachase.Ibn.Core.ListViewProfile.CanDelete(ClassName, ddProfiles.SelectedValue, _placeName, currentUserId);

            ibEditInfo.ToolTip = GetGlobalResourceObject("IbnFramework.Common", "Edit").ToString();
            CommandManager    cm = CommandManager.GetCurrent(this.Page);
            CommandParameters cp = new CommandParameters("MC_MUI_ProfileEdit");

            cp.CommandArguments = new Dictionary <string, string>();
            cp.AddCommandArgument("ClassName", ClassName);
            cp.AddCommandArgument("uid", ddProfiles.SelectedValue);
            string scriptEdit = cm.AddCommand(ClassName, ViewName, _placeName, cp);

            ibEditInfo.Attributes.Add("onclick", String.Format("javascript:{{{0};return false;}}", scriptEdit));
            ibEditInfo.Visible = Mediachase.Ibn.Core.ListViewProfile.CanDelete(ClassName, ddProfiles.SelectedValue, _placeName, currentUserId);


            cp = new CommandParameters("MC_MUI_ProfileNew");
            cp.CommandArguments = new Dictionary <string, string>();
            cp.AddCommandArgument("ClassName", ClassName);
            scriptEdit       = cm.AddCommand(ClassName, ViewName, _placeName, cp);
            scriptEdit       = scriptEdit.Replace("\"", "&quot;");
            AddNewViewScript = scriptEdit;

            hfFilterValue.Value = ddProfiles.SelectedValue;

            // Printer Varsion
            if (CHelper.GetFromContext(CHelper.PrinterVersionKey) != null &&
                (bool)CHelper.GetFromContext(CHelper.PrinterVersionKey))
            {
                CHelper.PrintControl(PrepareExportGrid(), CHelper.GetResFileString(mc.PluralName), this.Page);
                dgExport.Visible = false;
            }

            base.OnPreRender(e);
        }