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();
            }
        }
示例#2
0
        private void dgForum_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int nodeId = int.Parse(e.CommandArgument.ToString());

            Issue2.DeleteForumMessage(IncidentId, nodeId);
            Response.Redirect("../Incidents/IncidentView.aspx?IncidentId=" + IncidentId);
        }
示例#3
0
        protected void btnSave_ServerClick(object sender, System.EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            txtTitle.Text       = HttpUtility.HtmlEncode(txtTitle.Text);
            txtDescription.Text = HttpUtility.HtmlEncode(txtDescription.Text);

            Issue2.UpdateGeneralInfo(IncidentId, txtTitle.Text, txtDescription.Text, int.Parse(ddlType.SelectedValue), int.Parse(ddlSeverity.SelectedValue));
            Issue2.UpdatePriority(IncidentId, int.Parse(ddlPriority.SelectedValue));

            if (!String.IsNullOrEmpty(Command))                 // popup mode
            {
                CommandParameters cp = new CommandParameters(Command);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                        "try {window.opener.top.frames['right'].location.href='../Incidents/IncidentView.aspx?IncidentId=" + IncidentId + "';}" +
                                                        "catch (e){} window.close();", true);
            }
        }
        private void Process()
        {
            string FileName1 = (McFileUp1.PostedFile == null) ? "" : McFileUp1.PostedFile.FileName;
            string FileName2 = (McFileUp2.PostedFile == null) ? "" : McFileUp2.PostedFile.FileName;
            string FileName3 = (McFileUp3.PostedFile == null) ? "" : McFileUp3.PostedFile.FileName;

            System.IO.Stream Stream1 = (McFileUp1.PostedFile == null) ? null : McFileUp1.PostedFile.InputStream;
            System.IO.Stream Stream2 = (McFileUp2.PostedFile == null) ? null : McFileUp2.PostedFile.InputStream;
            System.IO.Stream Stream3 = (McFileUp3.PostedFile == null) ? null : McFileUp3.PostedFile.InputStream;

            int nodeType = ((FileName1 != "" && Stream1 != null) ||
                            (FileName2 != "" && Stream2 != null) ||
                            (FileName3 != "" && Stream3 != null)) ?
                           (int)ForumStorage.NodeContentType.TextWithFiles :
                           (int)ForumStorage.NodeContentType.Text;

            ArrayList alAttrs = new ArrayList();

            foreach (ListItem liItem in cbList.Items)
            {
                if (liItem.Selected)
                {
                    alAttrs.Add(liItem.Value);
                }
            }

            string sMessage = txtMessage.Text;

            sMessage = Util.CommonHelper.parsetext_br(sMessage);
            Issue2.AddForumMessage2(IncidentId, sMessage, nodeType, alAttrs, false, int.Parse(ddlStatus.SelectedValue), FileName1, Stream1, FileName2, Stream2, FileName3, Stream3);
        }
示例#5
0
        private void dg_delete(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int RelIssId = int.Parse(e.Item.Cells[0].Text);

            Issue2.DeleteRelation(IncidentId, RelIssId);
            Response.Redirect("../Incidents/IncidentView.aspx?IncidentId=" + IncidentId);
        }
示例#6
0
        private void dgForum_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int nodeId = int.Parse(e.CommandArgument.ToString());

            Issue2.DeleteForumMessage(IncidentId, nodeId);
            //Response.Redirect(this.Page.Request.RawUrl, true);
        }
        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)
                                {
                                    Issue2.AddRelation(id1, id2);
                                }
                            }
                        }

                        tran.Commit();
                    }

                    CHelper.RequireBindGrid();
                }
            }
        }
示例#8
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            SynchronizeDT();
            //Page.RegisterStartupScript("DisableButtons","DisableButtons(this);");
            DataTable dt = (DataTable)ViewState["Participants"];

            Issue2.UpdateResources(IncidentID, dt);


            if (BtnID != String.Empty)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                        "<script language=javascript>" +
                                                        "try {window.top.frames['right'].location.href='IncidentView.aspx?IncidentId=" + IncidentID + "';}" +
                                                        "catch (e){}</script>");
            }
            else if (Request["closeFramePopup"] != null)
            {
                CommandParameters cp = new CommandParameters("MC_HDM_ResEdit");
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                        "<script language=javascript>" +
                                                        "try {window.opener.top.frames['right'].location.href='../Incidents/IncidentView.aspx?IncidentId=" + IncidentID + "';}" +
                                                        "catch (e){} window.close();</script>");
            }
        }
示例#9
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

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

                if (cp.CommandArguments.ContainsKey("SelectedValue"))
                {
                    string[] elemsToAdd = cp.CommandArguments["SelectedValue"].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    using (DbTransaction tran = DbTransaction.Begin())
                    {
                        foreach (string elem in elemsToAdd)
                        {
                            int selectedValue = 0;
                            if (int.TryParse(elem, out selectedValue))
                            {
                                Issue2.AddRelation(issueId, selectedValue);
                            }
                        }
                        tran.Commit();
                    }
                }

                CHelper.RequireBindGrid();
            }
        }
示例#10
0
        public static void ChangeResponsible(int incidentId, int responsibleId)
        {
            try
            {
                DataTable responsibleGroup = Incident.GetResponsibleGroupDataTable(incidentId);
                responsibleGroup.Columns.Add(new DataColumn("IsNew", typeof(bool)));

                foreach (DataRow row in responsibleGroup.Rows)
                {
                    row["IsNew"] = false;
                }

                if (responsibleId == -1)                 // NotSetResponsibleId
                {
                    Issue2.UpdateQuickTracking(incidentId, null, -1, false, responsibleGroup);
                }
                else if (responsibleId == -2)                 // GroupResponsibleId
                {
                    Issue2.UpdateQuickTracking(incidentId, null, -1, true, responsibleGroup);
                }
                else
                {
                    Issue2.UpdateQuickTracking(incidentId, null, responsibleId, false, responsibleGroup);
                }
            }
            catch (AccessDeniedException)
            {
            }
            catch (Exception ex)
            {
                Log.WriteError(ex.ToString());
            }
        }
示例#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"]);

                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.DownPriority(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();
            }
        }
示例#12
0
 protected void btnAccept_ServerClick(object sender, System.EventArgs e)
 {
     Issue2.AcceptResource(IncidentId);
     if (!Security.CurrentUser.IsExternal)
     {
         Util.CommonHelper.ReloadTopFrame("ActiveWork.ascx", "../Incidents/IncidentView.aspx?IncidentId=" + IncidentId, Response);
     }
     else
     {
         Util.CommonHelper.ReloadTopFrame("ActiveWork.ascx", "../External/ExternalIncident.aspx?IncidentId=" + IncidentId, Response);
     }
 }
示例#13
0
 protected void btnDecline_ServerClick(object sender, System.EventArgs e)
 {
     Issue2.DeclineResource(IncidentId);
     if (!Security.CurrentUser.IsExternal)
     {
         Util.CommonHelper.ReloadTopFrame("ActiveWork.ascx", "../Workspace/default.aspx?BTab=Workspace", Response);
     }
     else
     {
         Response.Redirect("~/External/MissingObject.aspx");
     }
 }
示例#14
0
        private void lbAddIssue_Click(object sender, EventArgs e)
        {
            int RelIssueId = int.Parse(hdnIssueId.Value);

            if (IncidentId > 0 && IncidentId != RelIssueId)
            {
                Issue2.AddRelation(IncidentId, RelIssueId);
            }

            CommandParameters cp = new CommandParameters("MC_HDM_Redirect");

            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
示例#15
0
        private void btnSave_ServerClick(object sender, EventArgs e)
        {
            ArrayList categories         = new ArrayList();
            ArrayList incidentCategories = new ArrayList();

            CollectSelectedValues(grdCategories, categories);
            CollectSelectedValues(grdIncidentCategories, incidentCategories);

            Issue2.UpdateCategories(IncidentId, categories, incidentCategories);

            Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                    "try {window.opener.top.frames['right'].location.href='../Incidents/IncidentView.aspx?IncidentId=" + IncidentId + "';}" +
                                                    "catch (e){} window.close();", true);
        }
示例#16
0
        protected void PriorityList_ItemCommand(object source, DataListCommandEventArgs e)
        {
            int priorityId = int.Parse(e.CommandArgument.ToString());

            if (ObjectTypeId == (int)ObjectTypes.Task)
            {
                Task2.UpdatePriority(ObjectId, priorityId);
            }
            else if (ObjectTypeId == (int)ObjectTypes.ToDo)
            {
                ToDo2.UpdatePriority(ObjectId, priorityId);
            }
            else if (ObjectTypeId == (int)ObjectTypes.Issue)
            {
                Issue2.UpdatePriority(ObjectId, priorityId);
            }
            else if (ObjectTypeId == (int)ObjectTypes.Document)
            {
                if (AssignmentId.HasValue)
                {
                    AssignmentEntity assignment = (AssignmentEntity)BusinessManager.Load(AssignmentEntity.ClassName, (PrimaryKeyId)AssignmentId.Value);
                    if (priorityId == (int)Priority.Low)
                    {
                        assignment.Priority = (int)AssignmentPriority.Low;
                    }
                    else if (priorityId == (int)Priority.Normal)
                    {
                        assignment.Priority = (int)AssignmentPriority.Normal;
                    }
                    else if (priorityId == (int)Priority.High)
                    {
                        assignment.Priority = (int)AssignmentPriority.High;
                    }
                    else if (priorityId == (int)Priority.VeryHigh)
                    {
                        assignment.Priority = (int)AssignmentPriority.VeryHigh;
                    }
                    else
                    {
                        assignment.Priority = (int)AssignmentPriority.Urgent;
                    }

                    BusinessManager.Update(assignment);
                }
            }

            CommandParameters cp = new CommandParameters(CommandName);

            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString(), true);
        }
示例#17
0
        void btnAddRelatedIss_Click(object sender, EventArgs e)
        {
            string param = Request["__EVENTARGUMENT"];

            if (!String.IsNullOrEmpty(param))
            {
                string[] mas = param.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                if (mas.Length < 2 || !mas[0].Equals("7"))
                {
                    return;
                }
                int iRelId = int.Parse(mas[1]);
                Issue2.AddRelation(IncidentId, iRelId);
                BindDG();
            }
        }
示例#18
0
        protected void btnAddRelatedIss_Click(object sender, EventArgs e)
        {
            string param = Request["__EVENTARGUMENT"];

            if (!String.IsNullOrEmpty(param))
            {
                string[] mas = param.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                if (mas.Length < 2 || !mas[0].Equals("7"))
                {
                    return;
                }
                int iRelId = int.Parse(mas[1]);
                Issue2.AddRelation(IncidentId, iRelId);
                Response.Redirect("~/Incidents/IncidentView.aspx?IncidentId=" + IncidentId + "&Tab=General", true);
            }
        }
        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);
                    }
                }
            }
        }
示例#20
0
        void btnSave_ServerClick(object sender, EventArgs e)
        {
            string values = hfValues.Value;

            if (!String.IsNullOrEmpty(values))
            {
                int state_id = int.Parse(ddStatus.SelectedValue);
                if (state_id > 0)
                {
                    string sMessage = txtComment.Text;
                    sMessage = Mediachase.UI.Web.Util.CommonHelper.parsetext_br(sMessage);
                    ArrayList errors = new ArrayList();
                    string[]  elems  = values.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string s in elems)
                    {
                        int id = Convert.ToInt32(s, CultureInfo.InvariantCulture);
                        try
                        {
                            Issue2.UpdateQuickTracking(id, sMessage, state_id);
                        }
                        catch
                        {
                            errors.Add(id);
                        }
                    }

                    if (errors.Count > 0)
                    {
                        divErrors.Visible = true;
                        tblMain.Visible   = false;
                        ShowErrors(errors);
                    }
                    else
                    {
                        CloseThis();
                    }
                }
                else
                {
                    CloseThis();
                }
            }
            else
            {
                CloseThis();
            }
        }
示例#21
0
        /// <summary>
        /// Adds to incident message.
        /// </summary>
        /// <param name="IsInternal">if set to <c>true</c> [is internal].</param>
        /// <param name="IncidentId">The incident id.</param>
        /// <param name="EMailMessageId">The E mail message id.</param>
        /// <param name="msg">The MSG.</param>
        /// <returns></returns>
        public static int AddToIncidentMessage(bool IsInternal, int IncidentId, int EMailMessageId, Pop3Message msg)
        {
            IncidentBox incidentBox = IncidentBox.Load(Incident.GetIncidentBox(IncidentId));

            if (IsInternal)
            {
                // 2007-02-15: OZ: New Messagew Addon
                Issue2.SetNewMessage(IncidentId, false);
                //

                // TODO: If Responsible is Group, set current user as responsible

                return(AddInternalEMail2Incident(IncidentId, EMailMessageId, EMailMessage.GetSenderName(msg), EMailMessage.GetSenderEmail(msg)));
            }
            else
            {
                // 2007-02-15: OZ: New Messagew Addon
                Issue2.SetNewMessage(IncidentId, true);
                //

                return(AddExternalEMail2Incident(IncidentId, EMailMessageId, EMailMessage.GetSenderName(msg), EMailMessage.GetSenderEmail(msg)));
            }
        }
示例#22
0
 public static void SetIncidentState(ForumStorage.NodeType nodeType, IncidentBoxDocument incidentBoxDocument, int IncidentId, int ThreadNodeId, ObjectStates state)
 {
     Issue2.SetStateByEmail(nodeType, incidentBoxDocument, IncidentId, ThreadNodeId, state);
 }
示例#23
0
        private void ShowStep(int step)
        {
            HtmlButton btn      = null;
            object     template = this.Parent.Parent.Parent;

            if (template is WizardTemplate)
            {
                btn = ((WizardTemplate)template).GetbtnNext();
            }

            basic.Visible      = false;
            upload.Visible     = false;
            categories.Visible = false;
            comments.Visible   = false;

            if (step == 2 && rbActions.SelectedIndex == 0 && btn != null)
            {
                btn.Attributes.Add("onclick", "DisableButtons(this);ShowProgress();");
            }

            #region Save
            if (step == _stepCount + 1)
            {
                string sItem = "";
                if (ObjectType == 7)
                {
                    if (rbActions.SelectedIndex == 0)
                    {
                        sItem = "0";
                        if ((ffileUp.PostedFile != null && ffileUp.PostedFile.ContentLength > 0))
                        {
                            Incident.UploadFile(ObjectID, ffileUp.PostedFile.FileName, ffileUp.PostedFile.InputStream);
                        }
                    }
                    if (rbActions.SelectedIndex == 1)
                    {
                        sItem = "1";
                        ArrayList alCategories = new ArrayList();
                        for (int i = 0; i < lbCategories.Items.Count; i++)
                        {
                            if (lbCategories.Items[i].Selected)
                            {
                                alCategories.Add(int.Parse(lbCategories.Items[i].Value));
                            }
                        }
                        Issue2.AddIssueCategories(ObjectID, alCategories);
                    }
                    if (rbActions.SelectedIndex == 2)
                    {
                        sItem = "2";
                        Incident.AddDiscussion(ObjectID, txtComments.Text);
                    }
                    string sPath = "../Wizards/CommonWizard.aspx?ObjectType=7&ObjectID=" + ObjectID.ToString();
                    if (sItem != "")
                    {
                        sPath = sPath + "&item=" + sItem;
                    }
                    Response.Redirect(sPath);
                }
                if (ObjectType == 6)
                {
                    if (rbActions.SelectedIndex == 0)
                    {
                        sItem = "0";
                        if ((ffileUp.PostedFile != null && ffileUp.PostedFile.ContentLength > 0))
                        {
                            ToDo.UploadFile(ObjectID, ffileUp.PostedFile.FileName, ffileUp.PostedFile.InputStream);
                        }
                    }
                    if (rbActions.SelectedIndex == 1)
                    {
                        sItem = "1";
                        ArrayList alCategories = new ArrayList();
                        for (int i = 0; i < lbCategories.Items.Count; i++)
                        {
                            if (lbCategories.Items[i].Selected)
                            {
                                alCategories.Add(int.Parse(lbCategories.Items[i].Value));
                            }
                        }
                        ToDo2.SetGeneralCategories(ObjectID, alCategories);
                    }
                    if (rbActions.SelectedIndex == 2)
                    {
                        sItem = "2";
                        ToDo.AddDiscussion(ObjectID, txtComments.Text);
                    }
                    string sPath = "../Wizards/CommonWizard.aspx?ObjectType=6&ObjectID=" + ObjectID.ToString();
                    if (sItem != "")
                    {
                        sPath = sPath + "&item=" + sItem;
                    }
                    Response.Redirect(sPath);
                }
                if (ObjectType == 4)
                {
                    if (rbActions.SelectedIndex == 0)
                    {
                        sItem = "0";
                        if ((ffileUp.PostedFile != null && ffileUp.PostedFile.ContentLength > 0))
                        {
                            CalendarEntry.UploadFile(ObjectID, ffileUp.PostedFile.FileName, ffileUp.PostedFile.InputStream);
                        }
                    }
                    if (rbActions.SelectedIndex == 1)
                    {
                        sItem = "1";
                        ArrayList alCategories = new ArrayList();
                        for (int i = 0; i < lbCategories.Items.Count; i++)
                        {
                            if (lbCategories.Items[i].Selected)
                            {
                                alCategories.Add(int.Parse(lbCategories.Items[i].Value));
                            }
                        }
                        CalendarEntry2.SetGeneralCategories(ObjectID, alCategories);
                    }
                    if (rbActions.SelectedIndex == 2)
                    {
                        sItem = "2";
                        CalendarEntry.AddDiscussion(ObjectID, txtComments.Text);
                    }
                    string sPath = "../Wizards/CommonWizard.aspx?ObjectType=4&ObjectID=" + ObjectID.ToString();
                    if (sItem != "")
                    {
                        sPath = sPath + "&item=" + sItem;
                    }
                    Response.Redirect(sPath);
                }
                return;
            }
            #endregion

            ((Panel)steps[step - 1]).Visible = true;
        }
示例#24
0
        /// <summary>
        /// Copies to incident.
        /// </summary>
        /// <param name="emailMessageId">The email message id.</param>
        /// <param name="incidentId">The incident id.</param>
        public static void CopyToIncident(int emailMessageId, int incidentId)
        {
            using (DbTransaction tran = DbTransaction.Begin())
            {
                // Remove from pending
                PendingEMailMessageRow.DeleteByEMailMessageId(emailMessageId);

                // Load Pop3 Message
                EMailMessageInfo   msgInfo  = EMailMessageInfo.Load(emailMessageId);
                EMailRouterPop3Box emailBox = EMailRouterPop3Box.Load(msgInfo.EMailRouterPop3BoxId);

                Pop3Message msg = EMailMessage.GetPop3Message(emailMessageId);

                // Add User to White Lits
                string SenderEmail = EMailMessage.GetSenderEmail(msg);
                //if(!WhiteListItem.Contains(SenderEmail))

                if (PortalConfig.UseAntiSpamFilter && PortalConfig.AutoFillWhiteList)
                {
                    WhiteListItem.Create(SenderEmail);
                }


                int creatorId, issueBoxId;
                using (IDataReader reader = Incident.GetIncident(incidentId))
                {
                    reader.Read();

                    creatorId  = (int)reader["CreatorId"];
                    issueBoxId = (int)reader["IncidentBoxId"];
                }

                int       stateId, managerId, responsibleId;
                bool      isResposibleGroup;
                ArrayList users = new ArrayList();
                Issue2.GetIssueBoxSettings(issueBoxId, out stateId, out managerId, out responsibleId, out isResposibleGroup, users);

                UserLight prevUser = LogOnCreator(creatorId, msg);

                int ThreadNodeId = AddToIncidentMessage(emailBox.IsInternal, incidentId, emailMessageId, msg);

                if (ProcessXIbnHeaders(incidentId, ThreadNodeId, msg))
                {
                    ArrayList excludeUsers = EMailRouterOutputMessage.Send(incidentId, emailBox, msg);

                    // O.R. [2008-09-09]: Exclude inactive users
                    if (responsibleId > 0 && User.GetUserActivity(responsibleId) != User.UserActivity.Active)
                    {
                        responsibleId = -1;
                    }
                    ArrayList activeUsers = new ArrayList();
                    foreach (int userId in users)
                    {
                        if (User.GetUserActivity(userId) == User.UserActivity.Active)
                        {
                            activeUsers.Add(userId);
                        }
                    }
                    //

                    Issue2.SendAlertsForNewIssue(incidentId, managerId, responsibleId, activeUsers, excludeUsers);
                }

                tran.Commit();
            }
        }
示例#25
0
        /// <summary>
        /// Approves the pending.
        /// </summary>
        /// <param name="EMailMessageId">The E mail message id.</param>
        public static void ApprovePending(int EMailMessageId)
        {
            // Stop Double Approve
            if (!PendingEMailMessageRow.Contains(EMailMessageId))
            {
                return;
            }

            using (DbTransaction tran = DbTransaction.Begin())
            {
                // Remove from pending
                PendingEMailMessageRow.DeleteByEMailMessageId(EMailMessageId);

                // Load Pop3 Message
                EMailMessageInfo   msgInfo  = EMailMessageInfo.Load(EMailMessageId);
                EMailRouterPop3Box emailBox = EMailRouterPop3Box.Load(msgInfo.EMailRouterPop3BoxId);

                Pop3Message msg = EMailMessage.GetPop3Message(EMailMessageId);

                // Add User to White Lits
                string SenderEmail = EMailMessage.GetSenderEmail(msg);
                //if(!WhiteListItem.Contains(SenderEmail))

                if (PortalConfig.UseAntiSpamFilter && PortalConfig.AutoFillWhiteList)
                {
                    WhiteListItem.Create(SenderEmail);
                }

                string TicketUID = TicketUidUtil.LoadFromString(msg.Subject == null ? string.Empty : msg.Subject);

                if (TicketUID == string.Empty)
                {
                    int IncidentId = CreateNewIncident(EMailMessageId, emailBox, msg);

                    // Automaticaly by Incident.CreateFromEmail
                    //EMailRouterOutputMessage.Send(IncidentId, emailBox, msg);
                }
                else
                {
                    // Assign By Ticket
                    int IncidentId = FindIncidentByTicket(TicketUID);

                    if (IncidentId != -1)
                    {
                        int creatorId, issueBoxId;
                        using (IDataReader reader = Incident.GetIncident(IncidentId))
                        {
                            reader.Read();

                            creatorId  = (int)reader["CreatorId"];
                            issueBoxId = (int)reader["IncidentBoxId"];
                        }

                        int       stateId, managerId, responsibleId;
                        bool      isResposibleGroup;
                        ArrayList users = new ArrayList();
                        Issue2.GetIssueBoxSettings(issueBoxId, out stateId, out managerId, out responsibleId, out isResposibleGroup, users);

                        UserLight prevUser = LogOnCreator(creatorId, msg);

                        int ThreadNodeId = AddToIncidentMessage(emailBox.IsInternal, IncidentId, EMailMessageId, msg);

                        if (ProcessXIbnHeaders(IncidentId, ThreadNodeId, msg))
                        {
                            ArrayList excludeUsers = EMailRouterOutputMessage.Send(IncidentId, emailBox, msg);

                            // O.R. [2008-09-09]: Exclude inactive users
                            if (responsibleId > 0 && User.GetUserActivity(responsibleId) != User.UserActivity.Active)
                            {
                                responsibleId = -1;
                            }
                            ArrayList activeUsers = new ArrayList();
                            foreach (int userId in users)
                            {
                                if (User.GetUserActivity(userId) == User.UserActivity.Active)
                                {
                                    activeUsers.Add(userId);
                                }
                            }
                            //

                            Issue2.SendAlertsForNewIssue(IncidentId, managerId, responsibleId, activeUsers, excludeUsers);
                        }
                    }
                    else
                    {
                        IncidentId = CreateNewIncident(EMailMessageId, emailBox, msg);

                        // Automaticaly by Incident.CreateFromEmail
                        //EMailRouterOutputMessage.Send(IncidentId, emailBox, msg);
                    }
                }
                tran.Commit();
            }
        }
示例#26
0
        private void imbSend_ServerClick(object sender, EventArgs e)
        {
            DataTable dt = null;

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

            int  iRespId     = -1;
            bool isRespGroup = false;

            using (IDataReader reader = Incident.GetIncidentTrackingState(IncidentID))
            {
                if (reader.Read())
                {
                    if ((int)reader["ResponsibleId"] != -1)
                    {
                        iRespId = (int)reader["ResponsibleId"];
                    }
                    if (reader["IsResponsibleGroup"] != DBNull.Value)
                    {
                        isRespGroup = (bool)reader["IsResponsibleGroup"];
                    }
                }
            }

            string sMessage = txtDescription.Text;

            sMessage = Util.CommonHelper.parsetext_br(sMessage);

            int?issueBoxId = null;

            if (trIssueBox.Visible)
            {
                issueBoxId = int.Parse(ddIssueBox.SelectedValue, CultureInfo.InvariantCulture);
            }

            int?projectId = null;

            if (trProject.Visible)
            {
                projectId = ddProject.ObjectId;
            }

            if (hidDecline.Value == "1")
            {
                Issue2.UpdateQuickTracking(IncidentID, sMessage,
                                           int.Parse(ddStatus.SelectedValue, CultureInfo.InvariantCulture),
                                           int.Parse(ddPriority.SelectedValue, CultureInfo.InvariantCulture),
                                           issueBoxId,
                                           projectId,
                                           iRespId, isRespGroup, dt, true, UseNewResponsible.Checked);
            }
            else
            {
                switch (hidResp.Value)
                {
                case "-2":                              //not set
                    iRespId     = -1;
                    isRespGroup = false;
                    break;

                case "-1":                              //group
                    iRespId     = -1;
                    isRespGroup = true;
                    break;

                default:                                //user
                    try
                    {
                        iRespId     = int.Parse(hidResp.Value, CultureInfo.InvariantCulture);
                        isRespGroup = false;
                    }
                    catch { }
                    break;
                }

                Issue2.UpdateQuickTracking(IncidentID, sMessage,
                                           int.Parse(ddStatus.SelectedValue, CultureInfo.InvariantCulture),
                                           int.Parse(ddPriority.SelectedValue, CultureInfo.InvariantCulture),
                                           issueBoxId,
                                           projectId,
                                           iRespId, isRespGroup, dt, false, UseNewResponsible.Checked);
            }

            if (!String.IsNullOrEmpty(Command))                 // popup mode
            {
                CommandParameters cp = new CommandParameters(Command);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
            {
                string sLink = "../Incidents/IncidentView.aspx?IncidentId=" + IncidentID;
                if (Security.CurrentUser.IsExternal)
                {
                    sLink = "../External/ExternalIncident.aspx?IncidentId=" + IncidentID;
                }
                Response.Redirect(sLink);
            }
        }
示例#27
0
        private void OnNewMessage(object sender, EventArgs e)
        {
            if (e is NewPop3MessageEventArgs && sender is EMailRouterPop3BoxMessageLoader)
            {
                EMailRouterPop3Box internalPop3Box = EMailRouterPop3Box.ListInternal();
                if (internalPop3Box != null && !internalPop3Box.Activity.IsActive)
                {
                    internalPop3Box = null;
                }

                UserLight prevUser = Security.CurrentUser;

                Alerts2.SendToCurrentUser = true;

                try
                {
                    using (DbTransaction tran = DbTransaction.Begin())
                    {
                        EMailRouterPop3BoxMessageLoader loader = (EMailRouterPop3BoxMessageLoader)sender;

                        Pop3Message msg = ((NewPop3MessageEventArgs)e).Message;

                        string TicketUID = TicketUidUtil.LoadFromString(msg.Subject == null ? string.Empty : msg.Subject);

                        EMailMessageAntiSpamRuleRusult result = EMailMessageAntiSpamRuleRusult.Deny;

                        if (loader.Owner.IsInternal)
                        {
                            int UserId = DBUser.GetUserByEmail(EMailMessage.GetSenderEmail(msg), false);
                            if (TicketUID != string.Empty && UserId > 0)
                            {
                                result = EMailMessageAntiSpamRuleRusult.Accept;
                            }
                        }
                        else
                        {
                            if (PortalConfig.UseAntiSpamFilter)
                            {
                                result = EMailMessageAntiSpamRule.Check(loader.Owner, msg);
                            }
                            else
                            {
                                result = EMailMessageAntiSpamRuleRusult.Accept;
                            }
                        }

                        int EMailMessageId = -1;

                        // OZ: [2007-01-29] EMailMessageLog
                        if (EmailLogSettings != null)
                        {
                            string from = string.Empty;

                            if (msg.Headers["Reply-To"] != null)
                            {
                                from = msg.Headers["Reply-To"];
                            }
                            //else if (msg.Headers["Sender"] != null)
                            //{
                            //    from = msg.Headers["Sender"];
                            //}
                            else if (msg.Headers["From"] != null)
                            {
                                from = msg.Headers["From"];
                            }

                            EMailMessageLog.Add(from,
                                                msg.Headers["To"] != null ? msg.Headers["To"] : string.Empty,
                                                msg.Headers["Subject"] != null ? msg.Headers["Subject"] : string.Empty,
                                                loader.Owner.EMailRouterPop3BoxId,
                                                result);
                        }
                        //

                        switch (result)
                        {
                        case EMailMessageAntiSpamRuleRusult.Pending:
                            // Register Email Message
                            EMailMessageId = RegisterEmail(loader.Owner.EMailRouterPop3BoxId, msg);
                            // Add to pending email table
                            EMailMessage.MarkAsPendingMessage(EMailMessageId);
                            break;

                        case EMailMessageAntiSpamRuleRusult.Accept:
                            // Register Email Message
                            EMailMessageId = RegisterEmail(loader.Owner.EMailRouterPop3BoxId, msg);


                            if (TicketUID == string.Empty)
                            {
                                int IncidentId = EMailMessage.CreateNewIncident(EMailMessageId, loader.Owner, msg);
                            }
                            else
                            {
                                // Assign By Ticket
                                int IncidentId = FindIncidentByTicket(TicketUID);

                                if (IncidentId != -1)
                                {
                                    int creatorId, issueBoxId;
                                    using (IDataReader reader = DBIncident.GetIncident(IncidentId, 0, 1))
                                    {
                                        reader.Read();

                                        creatorId  = (int)reader["CreatorId"];
                                        issueBoxId = (int)reader["IncidentBoxId"];
                                    }

                                    int       stateId, managerId, responsibleId;
                                    bool      isResposibleGroup;
                                    ArrayList users = new ArrayList();

                                    Issue2.GetIssueBoxSettings(issueBoxId, out stateId, out managerId, out responsibleId, out isResposibleGroup, users);

                                    EMailMessage.LogOnCreator(creatorId, msg);

                                    int ThreadNodeId = EMailMessage.AddToIncidentMessage(loader.Owner.IsInternal, IncidentId, EMailMessageId, msg);

                                    if (EMailMessage.ProcessXIbnHeaders(IncidentId, ThreadNodeId, msg))
                                    {
                                        try
                                        {
                                            ArrayList excludeUsers = EMailRouterOutputMessage.Send(IncidentId, loader.Owner, msg);
                                            SystemEvents.AddSystemEvents(SystemEventTypes.Issue_Updated_Forum_MessageAdded, IncidentId, -1, excludeUsers);
                                        }
                                        catch (Exception ex)
                                        {
                                            System.Diagnostics.Trace.WriteLine(ex);
                                            Log.WriteError(ex.ToString());
                                        }
                                    }
                                }
                                else
                                {
                                    // Add to pending email table
                                    if (!loader.Owner.IsInternal)
                                    {
                                        EMailMessage.MarkAsPendingMessage(EMailMessageId);
                                    }
                                }
                            }
                            break;

                        case EMailMessageAntiSpamRuleRusult.Deny:
                            // Do nothing
                            break;
                        }

                        tran.Commit();
                    }
                }
                finally
                {
                    Alerts2.SendToCurrentUser = false;

                    if (Security.CurrentUser != prevUser)
                    {
                        Security.SetCurrentUser(prevUser);
                    }
                }
            }
        }
示例#28
0
 public void SetUp()
 {
     _issue = new Issue2();
 }
示例#29
0
        void btnSave_ServerClick(object sender, EventArgs e)
        {
            string values = hfValues.Value;

            if (!String.IsNullOrEmpty(values))
            {
                DataTable dt = null;
                if (ViewState["ResponsiblePool"] != null)
                {
                    dt = ((DataTable)ViewState["ResponsiblePool"]).Copy();
                }

                int  iRespId     = -1;
                bool isRespGroup = false;

                switch (hidResp.Value)
                {
                case "-3":                              //not change
                    iRespId     = -3;
                    isRespGroup = false;
                    break;

                case "-2":                              //not set
                    iRespId     = -1;
                    isRespGroup = false;
                    break;

                case "-1":                              //group
                    iRespId     = -1;
                    isRespGroup = true;
                    break;

                default:                                //user
                    try
                    {
                        iRespId     = int.Parse(hidResp.Value, CultureInfo.InvariantCulture);
                        isRespGroup = false;
                    }
                    catch { }
                    break;
                }

                if (iRespId > -3)
                {
                    string sMessage = txtComment.Text;
                    sMessage = Mediachase.UI.Web.Util.CommonHelper.parsetext_br(sMessage);
                    ArrayList errors = new ArrayList();
                    string[]  elems  = values.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string s in elems)
                    {
                        int id = Convert.ToInt32(s, CultureInfo.InvariantCulture);
                        try
                        {
                            Issue2.UpdateQuickTracking(id, sMessage, iRespId, isRespGroup, dt);
                        }
                        catch
                        {
                            errors.Add(id);
                        }
                    }

                    if (errors.Count > 0)
                    {
                        divErrors.Visible = true;
                        tblMain.Visible   = false;
                        ShowErrors(errors);
                    }
                    else
                    {
                        CloseThis();
                    }
                }
                else
                {
                    CloseThis();
                }
            }
            else
            {
                CloseThis();
            }
        }
示例#30
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            ArrayList res      = new ArrayList();
            ArrayList resAdmin = new ArrayList();

            #region MakeUsers
            int iId1 = MakeUser(txtFirstName1.Text, txtLastName1.Text, txtEMail1.Text, cbAdmin1.Checked);
            if (iId1 > 0)
            {
                if (cbAdmin1.Checked)
                {
                    resAdmin.Add(iId1);
                }
                res.Add(iId1);
            }

            int iId2 = MakeUser(txtFirstName2.Text, txtLastName2.Text, txtEMail2.Text, cbAdmin2.Checked);
            if (iId2 > 0)
            {
                if (cbAdmin2.Checked)
                {
                    resAdmin.Add(iId2);
                }
                res.Add(iId2);
            }

            int iId3 = MakeUser(txtFirstName3.Text, txtLastName3.Text, txtEMail3.Text, cbAdmin3.Checked);
            if (iId3 > 0)
            {
                if (cbAdmin3.Checked)
                {
                    resAdmin.Add(iId3);
                }
                res.Add(iId3);
            }

            int iId4 = MakeUser(txtFirstName4.Text, txtLastName4.Text, txtEMail4.Text, cbAdmin4.Checked);
            if (iId4 > 0)
            {
                if (cbAdmin4.Checked)
                {
                    resAdmin.Add(iId4);
                }
                res.Add(iId4);
            }

            res.Add(Security.CurrentUser.UserID);
            if (Security.IsUserInGroup(InternalSecureGroups.Administrator))
            {
                resAdmin.Add(Security.CurrentUser.UserID);
            }
            #endregion

            #region MakeObjects
            if (cbAdd.Checked)
            {
                //1.
                string       data0      = string.Format("[InternetShortcut]\r\nURL={0}", GlobalResourceManager.Strings["QuickHelpLink"]);
                MemoryStream memStream0 = new MemoryStream();
                StreamWriter writer0    = new StreamWriter(memStream0, Encoding.Unicode);
                writer0.Write(data0);
                writer0.Flush();
                memStream0.Seek(0, SeekOrigin.Begin);
                string title0         = String.Format("Справочник по работе с {0}", IbnConst.ProductFamilyShort);
                string html_filename0 = Mediachase.UI.Web.Util.CommonHelper.GetHtmlFileTitle(title0);
                if (html_filename0.IndexOf(".url") < 0)
                {
                    html_filename0 += ".url";
                }

                PrimaryKeyId org_id     = PrimaryKeyId.Empty;
                PrimaryKeyId contact_id = PrimaryKeyId.Empty;
                Common.GetDefaultClient(PortalConfig.ToDoDefaultValueClientField, out contact_id, out org_id);

                ToDo.Create(-1, Security.CurrentUser.UserID, String.Format("Ознакомиться со Справочником по работе с {0}", IbnConst.ProductFamilyShort), "", DateTime.Now, DateTime.MinValue,
                            int.Parse(PortalConfig.ToDoDefaultValuePriorityField),
                            int.Parse(PortalConfig.ToDoDefaultValueActivationTypeField),
                            int.Parse(PortalConfig.ToDoDefaultValueCompetionTypeField),
                            bool.Parse(PortalConfig.ToDoDefaultValueMustConfirmField),
                            int.Parse(PortalConfig.ToDoDefaultValueTaskTimeField),
                            Common.StringToArrayList(PortalConfig.ToDoDefaultValueGeneralCategoriesField),
                            html_filename0, memStream0, res, contact_id, org_id);

                //2.
                if (resAdmin.Count > 0)
                {
                    string       data      = string.Format("[InternetShortcut]\r\nURL={0}", "http://friends.pmbox.ru/media/p/5422.aspx");
                    MemoryStream memStream = new MemoryStream();
                    StreamWriter writer    = new StreamWriter(memStream, Encoding.Unicode);
                    writer.Write(data);
                    writer.Flush();
                    memStream.Seek(0, SeekOrigin.Begin);
                    string title         = String.Format("Администрирование {0}", IbnConst.ProductName);
                    string html_filename = Mediachase.UI.Web.Util.CommonHelper.GetHtmlFileTitle(title);
                    if (html_filename.IndexOf(".url") < 0)
                    {
                        html_filename += ".url";
                    }

                    ToDo.Create(-1, Security.CurrentUser.UserID, "Прочитать про администрирование портала", "", DateTime.Now, DateTime.MinValue,
                                int.Parse(PortalConfig.ToDoDefaultValuePriorityField),
                                int.Parse(PortalConfig.ToDoDefaultValueActivationTypeField),
                                int.Parse(PortalConfig.ToDoDefaultValueCompetionTypeField),
                                bool.Parse(PortalConfig.ToDoDefaultValueMustConfirmField),
                                int.Parse(PortalConfig.ToDoDefaultValueTaskTimeField),
                                Common.StringToArrayList(PortalConfig.ToDoDefaultValueGeneralCategoriesField),
                                html_filename, memStream, resAdmin, contact_id, org_id);
                }

                //3.
                string       data1      = string.Format("[InternetShortcut]\r\nURL={0}", "http://friends.pmbox.ru/files/folders/ibn/entry2685.aspx");
                MemoryStream memStream1 = new MemoryStream();
                StreamWriter writer1    = new StreamWriter(memStream1, Encoding.Unicode);
                writer1.Write(data1);
                writer1.Flush();
                memStream1.Seek(0, SeekOrigin.Begin);
                string title1         = String.Format("Что нового в {0} {1}", IbnConst.ProductFamilyShort, IbnConst.VersionMajorDotMinor);
                string html_filename1 = Mediachase.UI.Web.Util.CommonHelper.GetHtmlFileTitle(title1);
                if (html_filename1.IndexOf(".url") < 0)
                {
                    html_filename1 += ".url";
                }

                ToDo.Create(-1, Security.CurrentUser.UserID, String.Format("Ознакомиться с документом Что нового в {0} {1}", IbnConst.ProductFamilyShort, IbnConst.VersionMajorDotMinor), "", DateTime.Now, DateTime.MinValue,
                            int.Parse(PortalConfig.ToDoDefaultValuePriorityField),
                            int.Parse(PortalConfig.ToDoDefaultValueActivationTypeField),
                            int.Parse(PortalConfig.ToDoDefaultValueCompetionTypeField),
                            bool.Parse(PortalConfig.ToDoDefaultValueMustConfirmField),
                            int.Parse(PortalConfig.ToDoDefaultValueTaskTimeField),
                            Common.StringToArrayList(PortalConfig.ToDoDefaultValueGeneralCategoriesField),
                            html_filename1, memStream1, res, contact_id, org_id);

                //4.
                if (resAdmin.Count > 0)
                {
                    string       data2      = string.Format("[InternetShortcut]\r\nURL={0}", "http://friends.pmbox.ru/wikis/docs/help-desk-ibn.aspx");
                    MemoryStream memStream2 = new MemoryStream();
                    StreamWriter writer2    = new StreamWriter(memStream2, Encoding.Unicode);
                    writer2.Write(data2);
                    writer2.Flush();
                    memStream2.Seek(0, SeekOrigin.Begin);
                    string title2         = String.Format("Как настроить работу Help Desk в {0} {1}", IbnConst.ProductFamilyShort, IbnConst.VersionMajorDotMinor);
                    string html_filename2 = Mediachase.UI.Web.Util.CommonHelper.GetHtmlFileTitle(title2);
                    if (html_filename2.IndexOf(".url") < 0)
                    {
                        html_filename2 += ".url";
                    }

                    ToDo.Create(-1, Security.CurrentUser.UserID, "Прочитать про настройку Help Desk", "", DateTime.Now, DateTime.MinValue,
                                int.Parse(PortalConfig.ToDoDefaultValuePriorityField),
                                int.Parse(PortalConfig.ToDoDefaultValueActivationTypeField),
                                int.Parse(PortalConfig.ToDoDefaultValueCompetionTypeField),
                                bool.Parse(PortalConfig.ToDoDefaultValueMustConfirmField),
                                int.Parse(PortalConfig.ToDoDefaultValueTaskTimeField),
                                Common.StringToArrayList(PortalConfig.ToDoDefaultValueGeneralCategoriesField),
                                html_filename2, memStream2, resAdmin, contact_id, org_id);
                }

                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("PrincipalId", typeof(int)));
                dt.Columns.Add(new DataColumn("IsNew", typeof(bool)));
                dt.Columns.Add(new DataColumn("ResponsePending", typeof(bool)));
                dt.Columns.Add(new DataColumn("MustBeConfirmed", typeof(bool)));
                dt.Columns.Add(new DataColumn("CanManage", typeof(bool)));
                foreach (int usId in res)
                {
                    DataRow row = dt.NewRow();
                    row["PrincipalId"]     = usId;
                    row["IsNew"]           = true;
                    row["ResponsePending"] = true;
                    row["MustBeConfirmed"] = false;
                    row["CanManage"]       = (usId == Security.CurrentUser.UserID);
                    dt.Rows.Add(row);
                }

                if (Configuration.HelpDeskEnabled)
                {
                    //5.
                    int IssId = Incident.Create("Демо инцидент", "",
                                                int.Parse(PortalConfig.IncidentDefaultValueTypeField),
                                                int.Parse(PortalConfig.IncidentDefaultValuePriorityField),
                                                int.Parse(PortalConfig.IncidentDefaultValueSeverityField),
                                                Security.CurrentUser.UserID, DateTime.UtcNow);
                    Issue2.UpdateQuickTracking(IssId, "", (int)ObjectStates.Active, -1, -1, true, dt, false);
                }
                //6.
                org_id     = PrimaryKeyId.Empty;
                contact_id = PrimaryKeyId.Empty;
                Common.GetDefaultClient(PortalConfig.CEntryDefaultValueClientField, out contact_id, out org_id);
                CalendarEntry.Create("Демо мероприятие", "", "", -1, Security.CurrentUser.UserID,
                                     int.Parse(PortalConfig.CEntryDefaultValuePriorityField),
                                     (int)CalendarEntry.EventType.Event,
                                     DateTime.Today.AddDays(1).AddHours(10),
                                     DateTime.Today.AddDays(1).AddHours(11),
                                     Mediachase.IBN.Business.Common.StringToArrayList(PortalConfig.CEntryDefaultValueGeneralCategoriesField),
                                     null, null, res, contact_id, org_id);

                //7.
                org_id     = PrimaryKeyId.Empty;
                contact_id = PrimaryKeyId.Empty;
                Common.GetDefaultClient(PortalConfig.DocumentDefaultValueClientField, out contact_id, out org_id);
                int docId = Document.Create(String.Format("Подготовить регламент по работе с {0}", IbnConst.ProductFamilyShort), "", -1,
                                            int.Parse(PortalConfig.DocumentDefaultValuePriorityField), Security.CurrentUser.UserID, 1, int.Parse(PortalConfig.DocumentDefaultValueTaskTimeField),
                                            contact_id, org_id);
                Document2.UpdateResources(docId, dt);
                Document.ActivateDocument(docId);
            }
            #endregion

            PortalConfig.PortalShowAdminWizard = false;
            Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "window.top.location.href='" + ResolveClientUrl("~/Apps/Shell/Pages/default.aspx") + "';", true);
        }