コード例 #1
0
ファイル: XIbnHeaderCommand.cs プロジェクト: alex765022/IBN
        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());
            }
        }
コード例 #2
0
ファイル: AssignStatus.ascx.cs プロジェクト: alex765022/IBN
        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();
            }
        }
コード例 #3
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();
            }
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: Responsibility.ascx.cs プロジェクト: alex765022/IBN
        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);
            }
        }