コード例 #1
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

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

                foreach (string elem in checkedElems)
                {
                    string[] elemMas = elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                    //type, id, _containerName, _containerKey
                    if (elemMas.Length != 4)
                    {
                        continue;
                    }

                    int         id = Convert.ToInt32(elemMas[1], CultureInfo.InvariantCulture);
                    FileStorage fs = FileStorage.Create(elemMas[2], elemMas[3]);
                    if (elemMas[0] == "1")
                    {
                        fs.DeleteFolder(id);
                    }
                    else if (elemMas[0] == "2")
                    {
                        fs.DeleteFile(id);
                    }
                }

                CHelper.RequireBindGrid();
            }
        }
コード例 #2
0
ファイル: MoveToFolderHandler.cs プロジェクト: alex765022/IBN
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

                int destFolderId = int.Parse(cp.CommandArguments["DestFolderId"]);

                if (cp.CommandArguments.ContainsKey("GridId"))
                {
                    string[] checkedElems = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);

                    foreach (string elem in checkedElems)
                    {
                        string[]    elemMas = elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                        int         id      = Convert.ToInt32(elemMas[1], CultureInfo.InvariantCulture);
                        FileStorage fs      = FileStorage.Create(elemMas[2], elemMas[3]);
                        if (elemMas[0] == "1")
                        {
                            if (id != destFolderId)
                            {
                                fs.MoveDirectory(id, destFolderId);
                            }
                        }
                        else if (elemMas[0] == "2")
                        {
                            fs.MoveFile(id, destFolderId);
                        }
                    }
                }

                CHelper.RequireBindGrid();
            }
        }
コード例 #3
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp            = (CommandParameters)Element;
                string[]          elemsToDelete = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);

                using (DbTransaction tran = DbTransaction.Begin())
                {
                    foreach (string elem in elemsToDelete)
                    {
                        int id = Convert.ToInt32(elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture);
                        if (id > 0)
                        {
                            if (Incident.CanUpdate(id))
                            {
                                Issue2.UpPriority(id, false);
                            }
                        }
                    }
                    tran.Commit();
                }

                CHelper.RequireBindGrid();
            }
        }
コード例 #4
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp            = (CommandParameters)Element;
                string[]          elemsToDelete = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);
                if (elemsToDelete.Length > 1)
                {
                    using (DbTransaction tran = DbTransaction.Begin())
                    {
                        for (int i = 0; i < elemsToDelete.Length - 1; i++)
                        {
                            for (int j = i + 1; j < elemsToDelete.Length; j++)
                            {
                                int id1 = Convert.ToInt32(elemsToDelete[i].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture);
                                int id2 = Convert.ToInt32(elemsToDelete[j].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture);
                                if (id1 > 0 && id2 > 0)
                                {
                                    Project2.AddRelation(id1, id2);
                                }
                            }
                        }

                        tran.Commit();
                    }

                    CHelper.RequireBindGrid();
                }
            }
        }
コード例 #5
0
        protected void lbAdd_Click(object sender, EventArgs e)
        {
            SyncDT();
            DataTable dt = ((DataTable)ViewState["Resources"]).Copy();

            string[] mas = MCGrid.GetCheckedCollection(this.Page, grdMain.ID);
            if (mas.Length == 0)
            {
                mas = hdnValue.Value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            }
            foreach (string s in mas)
            {
                DataRow dr = dt.NewRow();
                dr["UserId"]          = int.Parse(s);
                dr["MustBeConfirmed"] = cbMustBeConfirmed.Checked;
                dr["ResponsePending"] = true;
                if (_objectTypeId == (int)ObjectTypes.Task)
                {
                    dr["CanManage"] = cbCanManage.Checked;
                }
                dt.Rows.Add(dr);
            }
            ViewState["Resources"] = dt;

            grdMainSelectedPanel.Update();
            CommonEventPart();
            hdnValue.Value = String.Empty;
        }
コード例 #6
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

                int issueId = int.Parse(cp.CommandArguments["SelectedValue"]);

                if (cp.CommandArguments.ContainsKey("GridId"))
                {
                    string[] checkedElems = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);

                    ArrayList alIds = new ArrayList();
                    foreach (string elem in checkedElems)
                    {
                        int id = Convert.ToInt32(elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture);
                        if (id > 0)
                        {
                            alIds.Add(id);
                        }
                    }

                    EMailMessage.CopyToIncident(alIds, issueId);
                }
                else if (cp.CommandArguments.ContainsKey("ObjectId"))
                {
                    int emailMessageId = int.Parse(cp.CommandArguments["ObjectId"]);

                    EMailMessage.CopyToIncident(emailMessageId, issueId);
                }

                CHelper.RequireBindGrid();
            }
        }
コード例 #7
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp            = (CommandParameters)Element;
                string[]          elemsToDelete = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);

                int error = 0;
                using (DbTransaction tran = DbTransaction.Begin())
                {
                    foreach (string elem in elemsToDelete)
                    {
                        int id = Convert.ToInt32(elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture);
                        if (id > 0)
                        {
                            Document.Delete(id);
                        }
                    }
                    tran.Commit();
                }
                if (error > 0)
                {
                    ClientScript.RegisterStartupScript(((Control)Sender).Page, ((Control)Sender).Page.GetType(), Guid.NewGuid().ToString("N"),
                                                       String.Format("alert('{0}');", CHelper.GetResFileString("{IbnFramework.ListInfo:RefItemException}")), true);
                }

                CHelper.RequireBindGrid();
            }
        }
コード例 #8
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

                string[]  checkedElems = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);
                ArrayList alMas        = new ArrayList();
                foreach (string elem in checkedElems)
                {
                    string[] elemMas = elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                    //type, id, _containerName, _containerKey
                    if (elemMas.Length != 4)
                    {
                        continue;
                    }
                    if (elemMas[0] == "2")
                    {
                        int id = Convert.ToInt32(elemMas[1], CultureInfo.InvariantCulture);
                        alMas.Add(id);
                    }

                    UserLightPropertyCollection      pc    = Mediachase.IBN.Business.Security.CurrentUser.Properties;
                    System.Resources.ResourceManager LocRM = new System.Resources.ResourceManager("Mediachase.UI.Web.App_GlobalResources.Modules.Resources.strTemplate", typeof(CopySelectedHandler).Assembly);
                    int iCount = 10;
                    if (pc["ClipboardItemsCount"] != null)
                    {
                        iCount = int.Parse(pc["ClipboardItemsCount"].ToString());
                    }
                    string ss = String.Empty;
                    try
                    {
                        foreach (int iFileId in alMas)
                        {
                            string sNewFileClip = "";
                            if (pc["ClipboardFiles"] != null)
                            {
                                sNewFileClip = pc["ClipboardFiles"].ToString();
                            }
                            sNewFileClip         = WorkWithClipboard(iCount, iFileId.ToString() + "|" + sNewFileClip);
                            pc["ClipboardFiles"] = sNewFileClip;
                        }
                        ss = String.Format(LocRM.GetString("tFilesAdded"), alMas.Count.ToString());
                    }
                    catch
                    {
                        ss = LocRM.GetString("tFilesNotAdded");
                    }
                    CommandManager cm = Sender as CommandManager;
                    if (cm != null && !String.IsNullOrEmpty(ss))
                    {
                        cm.InfoMessage = ss;
                    }
                }
            }
        }
コード例 #9
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;
                bool fl = false;
                if (cp.CommandArguments["action"] == "delete")
                {
                    fl = true;
                }

                if (cp.CommandArguments.ContainsKey("GridId"))
                {
                    string[] elemsToDelete = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);

                    int error = 0;
                    using (DbTransaction tran = DbTransaction.Begin())
                    {
                        foreach (string elem in elemsToDelete)
                        {
                            int id = Convert.ToInt32(elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture);
                            if (id > 0)
                            {
                                Issue2.MarkAsSpam(id, fl);
                            }
                        }
                        tran.Commit();
                    }
                    if (error > 0)
                    {
                    }
                    CHelper.RequireBindGrid();
                }
                else if (((Control)Sender).Page.Request["IncidentId"] != null)
                {
                    Issue2.MarkAsSpam(int.Parse(((Control)Sender).Page.Request["IncidentId"]), fl);
                    if (fl)
                    {
                        ((Control)Sender).Page.Response.Redirect("~/Apps/HelpDeskManagement/Pages/IncidentListNew.aspx", true);
                    }
                    else
                    {
                        ((Control)Sender).Page.Response.Redirect(((Control)Sender).Page.Request.RawUrl, true);
                    }
                }
            }
        }
コード例 #10
0
        private void AddChecked(bool mustBeConfirmed)
        {
            DataTable dt = ((DataTable)ViewState["Resources"]).Copy();

            string[] mas = MCGrid.GetCheckedCollection(this.Page, grdMain.ID);
            if (mas.Length == 0)
            {
                mas = hdnValue.Value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            }
            foreach (string s in mas)
            {
                DataRow dr = dt.NewRow();
                dr["UserId"]          = int.Parse(s);
                dr["MustBeConfirmed"] = mustBeConfirmed;
                dr["ResponsePending"] = true;
                dt.Rows.Add(dr);
            }
            ViewState["Resources"] = dt;
        }
コード例 #11
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp            = (CommandParameters)Element;
                string[]          elemsToDelete = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);

                ArrayList alIds = new ArrayList();
                foreach (string elem in elemsToDelete)
                {
                    int id = Convert.ToInt32(elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture);
                    if (id > 0)
                    {
                        alIds.Add(id);
                    }
                }
                EMailMessage.ApprovePending(alIds);

                CHelper.RequireBindGrid();
            }
        }
コード例 #12
0
        protected void lbDelete_Click(object sender, EventArgs e)
        {
            DataTable dt = ((DataTable)ViewState["Resources"]).Copy();

            string[] mas = MCGrid.GetCheckedCollection(this.Page, grdMain_Selected.ID);
            if (mas.Length == 0)
            {
                mas = hdnValue.Value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            }
            foreach (string s in mas)
            {
                DataRow[] dr = dt.Select(String.Format("Id='{0}'", s));
                if (dr.Length > 0)
                {
                    dt.Rows.Remove(dr[0]);
                }
            }
            ViewState["Resources"] = dt;

            grdMainSelectedPanel.Update();
            CommonEventPart();
            hdnValue.Value = String.Empty;
        }
コード例 #13
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp            = (CommandParameters)Element;
                string[]          selectedItems = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);

                HttpRequest request = HttpContext.Current.Request;

                int?profileId = null;
                if (String.Compare(request["ClassName"], CustomizationProfileEntity.ClassName, true) == 0 && !String.IsNullOrEmpty(request["ObjectId"]))
                {
                    profileId = int.Parse(request["ObjectId"]);
                }

                int?principalId = null;
                if (String.Compare(request["ClassName"], "Principal", true) == 0 && !String.IsNullOrEmpty(request["ObjectId"]))
                {
                    principalId = int.Parse(request["ObjectId"]);
                }

                using (DbTransaction tran = DbTransaction.Begin())
                {
                    foreach (string fullId in selectedItems)
                    {
                        NavigationManager.ShowCustomizationItem(fullId, CustomizationStructureType.NavigationMenu, profileId, principalId);
                    }
                    tran.Commit();
                }

                if (selectedItems.Length > 0)
                {
                    CHelper.RequireBindGrid();
                }
            }
        }
コード例 #14
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

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

                using (TransactionScope tran = DataContext.Current.BeginTransaction())
                {
                    foreach (string elem in elems)
                    {
                        DateTime            startDate = DateTime.Parse(elem, CultureInfo.InvariantCulture);
                        TimeTrackingBlock[] mas       = TimeTrackingBlock.List(FilterElement.EqualElement("OwnerId", Mediachase.IBN.Business.Security.CurrentUser.UserID), FilterElement.EqualElement("StartDate", startDate));
                        foreach (TimeTrackingBlock ttb in mas)
                        {
                            StateMachineService sms = ((BusinessObject)ttb).GetService <StateMachineService>();

                            // process only initial state
                            if (sms.StateMachine.GetStateIndex(sms.CurrentState.Name) == 0)
                            {
                                StateTransition[] availableTransitions = sms.GetNextAvailableTransitions(true);
                                if (availableTransitions.Length > 0)
                                {
                                    sms.MakeTransition(availableTransitions[0].Uid);
                                    ttb.Save();
                                }
                            }
                        }
                    }
                    tran.Commit();
                }

                CHelper.RequireBindGrid();
            }
        }