コード例 #1
0
        public IEnumerable <BugInfo> ExtractBugInfo()
        {
            var result = new List <BugInfo>();

            var bugs = this.dbContext.Bugs
                       .Include("Priority")
                       .Include("Speciality")
                       .Include("AttachedTo")
                       //  .Include("Team")
                       .ToList();

            foreach (var bug in bugs)
            {
                var bugIngo = new BugInfo
                {
                    Id          = bug.Id,
                    Description = bug.Description,
                    Priority    = bug.Priority.Name,
                    Speciality  = bug.Speciality.Name,
                    SolvedOn    = bug.solvedOn.ToString(),
                    //AttachTo = bug.AttachedTo.UserName
                    //Team = bug.AttachedTo.Team.Name
                };

                result.Add(bugIngo);
            }

            return(result);
        }
コード例 #2
0
        private void SymptonsAndAssign_Load(object sender, EventArgs e)
        {
            BugInfoDAO bugInformationDAO = new BugInfoDAO();
            BugInfo    bugInformation    = bugInformationDAO.GetById(Program.bugId);

            if (bugInformation != null)
            {
                button1.Hide();
                button2.Show();
                textBox1.Text = bugInformation.Symptoms;
                textBox2.Text = bugInformation.Cause;
            }
            else
            {
                button1.Show();
                button2.Show();
            }

            ProgrammerDAO     programmerDAO = new ProgrammerDAO();
            List <Programmer> list          = programmerDAO.GetAll();


            foreach (var l in list)
            {
                comboBox1.Items.Add(l.ProgrammerId + "," + l.FullName);
                //comboBox1.DisplayMember = l.FullName;
                //comboBox1.ValueMember = l.ProgrammerId.ToString();
            }

            assignedUser();
        }
コード例 #3
0
ファイル: BizDAL.cs プロジェクト: MondayR/TeamToDoList
        /// <summary>
        /// 问题记录数据插入
        /// </summary>
        /// <param name="myBug"></param>
        /// <returns></returns>
        public bool SaveBugInfo(BugInfo myBug)
        {
            string strSql = "Insert Into BugsTake(Describe,BugLevel,PresenterID,PresenterName,PresentDate,DealState,SendeeName,SendeeID)" +
                            "Values(@Describe,@BugLevel,@PresenterID,@PresenterName,getdate(),@DealState,'',0);" +
                            "Select SCOPE_IDENTITY() As BugID;";
            SqlConnection con = new SqlConnection(DBConInfo.strConn);

            con.Open();
            SqlCommand cmd = new SqlCommand(strSql, con);

            cmd.Parameters.Add("@Describe", DbType.String);
            cmd.Parameters["@Describe"].Value = myBug.Describe;
            cmd.Parameters.Add("@BugLevel", DbType.Int32);
            cmd.Parameters["@BugLevel"].Value = myBug.BugLevel;
            cmd.Parameters.Add("@PresenterID", DbType.Int32);
            cmd.Parameters["@PresenterID"].Value = myBug.PresenterID;
            cmd.Parameters.Add("@PresenterName", DbType.String);
            cmd.Parameters["@PresenterName"].Value = myBug.PresenterName;
            cmd.Parameters.Add("@DealState", DbType.Int32);
            cmd.Parameters["@DealState"].Value = myBug.DealState;
            int flag = cmd.ExecuteNonQuery();

            con.Close();
            return(true);
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            BugInfoDAO bugInformationDAO = new BugInfoDAO();
            BugInfo    bugInformation    = new BugInfo
            {
                Cause    = textBox2.Text,
                Symptoms = textBox1.Text,
                BugId    = Program.bugId
            };


            if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text))
            {
                MessageBox.Show("You must add symptons and cause");
            }
            else
            {
                try
                {
                    bugInformationDAO.Insert(bugInformation);
                    MessageBox.Show("Added");
                    button1.Hide();
                    button2.Show();
                } catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
コード例 #5
0
ファイル: AddBug.cs プロジェクト: MondayR/TeamToDoList
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            if (TxtDescribe.Text == "")
            {
                MessageBox.Show("为获取到需要保存的数据!请重新输入!");
                return;
            }
            BugInfo myBug = new BugInfo();

            myBug.Describe      = TxtDescribe.Text;
            myBug.BugLevel      = CBBLevel.SelectedIndex;
            myBug.PresenterID   = loginUser.UserID;
            myBug.PresenterName = loginUser.UserName;
            BizController myBiz = new BizController();

            try
            {
                bool SaveFlag = myBiz.SaveBugInfo(myBug);
                if (SaveFlag)
                {
                    MessageBox.Show("保存成功!");
                    FormDataList ParentForm = (FormDataList)this.Owner;
                    ParentForm.Refresh_Window();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("保存失败!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败!原因是:" + ex.Message);
            }
        }
コード例 #6
0
        //@}

/*! \name General methods */
        //@{

        /// <summary>Update bug from server</summary>
        /// <remarks>Get any changes to the bug from the server. This updates information
        /// such as the time/date of the last change to the bug, etc.</remarks>
        public void Update()
        {
            int[]  ids = new int[] { bi.id };
            BugIds param;

            param.ids = ids;
            this.bi   = server.Proxy.GetBugs(param).bugs[0];
        }
コード例 #7
0
        /// <summary>表单内容界面</summary>
        /// <returns></returns>
        public ActionResult Form(string options)
        {
            // 所属应用信息
            ApplicationInfo application = ViewBag.application = AppsContext.Instance.ApplicationService[BugConfiguration.ApplicationName];

            // 管理员身份标记
            bool isAdminToken = ViewBag.isAdminToken = AppsSecurity.IsAdministrator(this.Account, application.ApplicationName);

            // -------------------------------------------------------
            // 业务数据处理
            // -------------------------------------------------------

            JsonData request = JsonMapper.ToObject(options == null ? "{}" : options);

            // 实体数据标识
            string id = !request.Keys.Contains("id") ? string.Empty : request["id"].ToString();
            // 文档编辑模式
            DocEditMode docEditMode = DocEditMode.Unkown;
            // 实体数据信息
            BugInfo param = null;

            if (string.IsNullOrEmpty(id))
            {
                param = new BugInfo();

                param.Id = DigitalNumberContext.Generate("Table_Bug_Key_Id");

                // 设置编辑模式【新建】
                docEditMode = DocEditMode.New;
            }
            else
            {
                param = BugContext.Instance.BugService.FindOne(id);

                if (param == null)
                {
                    ApplicationError.Write(404);
                }

                // 设置编辑模式【编辑】
                docEditMode = DocEditMode.Edit;
            }

            // -------------------------------------------------------
            // 数据加载
            // -------------------------------------------------------

            ViewBag.Title = string.Format("{0}-{1}-{2}", (string.IsNullOrEmpty(param.Title) ? "新问题" : param.Title), application.ApplicationDisplayName, this.SystemName);

            // 加载当前业务实体类名称
            ViewBag.entityClassName = KernelContext.ParseObjectType(param.GetType());
            // 加载当前业务实体数据
            ViewBag.param = param;
            // 加载当前文档编辑模式
            ViewBag.docEditMode = docEditMode;

            return(View("/views/main/bugs/bug-form.cshtml"));
        }
コード例 #8
0
        // -------------------------------------------------------
        // 保存 添加 修改 删除
        // -------------------------------------------------------

        #region 函数:Save(BugInfo param)
        /// <summary>保存记录</summary>
        /// <param name="param">BugInfo 实例详细信息</param>
        /// <returns>BugInfo 实例详细信息</returns>
        public BugInfo Save(BugInfo param)
        {
            if (!IsExist(param.Id))
            {
                Insert(param);
            }
            else
            {
                Update(param);
            }

            return(param);
        }
コード例 #9
0
        // -------------------------------------------------------
        // 查询
        // -------------------------------------------------------

        #region 函数:FindOne(XmlDocument doc)
        /// <summary>获取详细信息</summary>
        /// <param name="doc">Xml 文档对象</param>
        /// <returns>返回操作结果</returns>
        public string FindOne(XmlDocument doc)
        {
            StringBuilder outString = new StringBuilder();

            string id = XmlHelper.Fetch("id", doc);

            BugInfo param = this.service.FindOne(id);

            outString.Append("{\"data\":" + AjaxUtil.Parse <BugInfo>(param) + ",");

            outString.Append(MessageObject.Stringify("0", I18n.Strings["msg_query_success"], true) + "}");

            return(outString.ToString());
        }
コード例 #10
0
        public void addBugview(BugInfo bug)
        {
            bugList.BeginUpdate();
            ListViewItem item = new ListViewItem();

            item.Text = "";

            item.SubItems.Add(bug.id);
            item.SubItems.Add(bug.title);
            item.SubItems.Add("").Tag = false;

            bugList.Items.Add(item);
            bugList.EndUpdate();
        }
コード例 #11
0
        /// <summary>详细内容界面</summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public ActionResult Detail(string options)
        {
            // 所属应用信息
            ApplicationInfo application = ViewBag.application = AppsContext.Instance.ApplicationService[BugConfiguration.ApplicationName];

            // 管理员身份标记
            bool isAdminToken = ViewBag.isAdminToken = AppsSecurity.IsAdministrator(this.Account, application.ApplicationName);

            JsonData request = JsonMapper.ToObject(options == null ? "{}" : options);

            // 实体数据标识
            string id = !request.Keys.Contains("id") ? string.Empty : request["id"].ToString();
            // 实体数据编码
            string code = !request.Keys.Contains("code") ? string.Empty : request["code"].ToString();

            BugInfo param = null;

            if (!string.IsNullOrEmpty(id))
            {
                param = BugContext.Instance.BugService.FindOne(id);
            }
            else if (!string.IsNullOrEmpty(code))
            {
                param = BugContext.Instance.BugService.FindOneByCode(code);
            }

            if (param == null)
            {
                ApplicationError.Write(404);
            }

            // -------------------------------------------------------
            // 数据加载
            // -------------------------------------------------------

            ViewBag.Title = string.Format("{0}-{1}-{2}", param.Title, application.ApplicationDisplayName, this.SystemName);

            // 加载数据表前缀
            ViewBag.dataTablePrefix = BugConfigurationView.Instance.DataTablePrefix;
            // 加载当前业务实体数据
            ViewBag.entityClassName = KernelContext.ParseObjectType(param.GetType());
            // 加载当前业务实体数据
            ViewBag.param = param;
            // 加载当前用户详细信息
            ViewBag.member = MembershipManagement.Instance.MemberService[this.Account.Id];

            return(View("/views/main/bugs/bug-detail.cshtml"));
        }
コード例 #12
0
        private IBugService service = BugContext.Instance.BugService; // 数据服务

        // -------------------------------------------------------
        // 保存 删除
        // -------------------------------------------------------

        #region 函数:Save(XmlDocument doc)
        /// <summary>保存记录</summary>
        /// <param name="doc">Xml 文档对象</param>
        /// <returns>返回操作结果</returns>
        public string Save(XmlDocument doc)
        {
            BugInfo param = new BugInfo();

            param = (BugInfo)AjaxUtil.Deserialize(param, doc);

            param.Properties["FromStatus"] = XmlHelper.Fetch("fromStatus", doc);
            param.Properties["ToStatus"]   = XmlHelper.Fetch("toStatus", doc);

            bool isNewObject = !this.service.IsExist(param.Id);

            this.service.Save(param);

            if (isNewObject)
            {
                ApplicationInfo application = AppsContext.Instance.ApplicationService[BugConfiguration.ApplicationName];

                Uri actionUri = new Uri(KernelConfigurationView.Instance.HostName + "/api/timeline.save.aspx?client_id=" + application.Id + "&client_secret=" + application.ApplicationSecret);

                string taskCode = DigitalNumberContext.Generate("Key_Guid");

                string content = string.Format("报告了一个新的问题【{0}】。<a href=\"{1}/bugs/article/{2}.aspx\" target=\"_blank\" >网页链接</a>", param.Title, KernelConfigurationView.Instance.HostName, param.Id);

                string xml = string.Format(@"<?xml version=""1.0"" encoding=""utf-8""?>
<request>
    <id><![CDATA[{0}]]></id>
    <applicationId><![CDATA[{1}]]></applicationId>
    <accountId><![CDATA[{2}]]></accountId>
    <content><![CDATA[{3}]]></content>
</request>
", taskCode, application.Id, KernelContext.Current.User.Id, content);

                // 发送请求信息
                AjaxRequestData reqeustData = new AjaxRequestData();

                reqeustData.ActionUri = actionUri;
                reqeustData.Args.Add("xml", xml);

                AjaxRequest.RequestAsync(reqeustData, null);
            }

            return(MessageObject.Stringify("0", I18n.Strings["msg_save_success"]));
        }
コード例 #13
0
        // -------------------------------------------------------
        // 权限设置
        // -------------------------------------------------------

        #region 函数:HasAuthorizationReadObject(BugInfo param)
        /// <summary>验证对象的权限</summary>
        /// <param name="param">需验证的对象</param>
        /// <returns>对象</returns>
        private bool HasAuthority(BugInfo param)
        {
            IAccountInfo account = KernelContext.Current.User;

            if (AppsSecurity.IsAdministrator(account, "Bug") ||
                param.AccountId == account.Id ||
                param.AssignToAccountId == account.Id)
            {
                return(true);
            }
            else
            {
                if (MembershipAuthorizationScopeManagement.Authenticate(param.AuthorizationReadScopeObjects, account))
                {
                    return(true);
                }

                return(false);
            }
        }
コード例 #14
0
        // Must always be valid
/*! \name Constructors */

        //@{

        // This assumes the bug already exists on the server side.
        /// <summary>
        /// Initialize a new instance of the <see cref="Bug"/> class.
        /// </summary>
        /// <param name="server">A <see cref="Server"/> instance that is associated with this bug</param>
        /// <param name="bi">Information about the bug, as retreived from the server</param>
        internal Bug(Server server, BugInfo bi)
        {
            this.server = server;
            this.bi     = bi;
        }
コード例 #15
0
 /// <summary>修改记录</summary>
 /// <param name="param">BugInfo 实例的详细信息</param>
 public void Update(BugInfo param)
 {
     this.ibatisMapper.Update(StringHelper.ToProcedurePrefix(string.Format("{0}_Update", this.tableName)), param);
 }
コード例 #16
0
 /// <summary>添加记录</summary>
 /// <param name="param">BugInfo 实例的详细信息</param>
 public void Insert(BugInfo param)
 {
     this.ibatisMapper.Insert(StringHelper.ToProcedurePrefix(string.Format("{0}_Insert", this.tableName)), param);
 }
コード例 #17
0
ファイル: Bug.cs プロジェクト: slluis/bugziller
 // Must always be valid
 /*! \name Constructors */
 //@{
 // This assumes the bug already exists on the server side.
 /// <summary>
 /// Initialize a new instance of the <see cref="Bug"/> class.
 /// </summary>
 /// <param name="server">A <see cref="Server"/> instance that is associated with this bug</param>
 /// <param name="bi">Information about the bug, as retreived from the server</param>
 internal Bug(Server server, BugInfo bi)
 {
     this.server = server;
     this.bi = bi;
 }
コード例 #18
0
        // -------------------------------------------------------
        // 保存 删除
        // -------------------------------------------------------

        #region 函数:Save(BugInfo param)
        /// <summary>保存记录</summary>
        /// <param name="param">BugInfo 实例详细信息</param>
        /// <param name="message">数据库操作返回的相关信息</param>
        /// <returns>BugInfo 实例详细信息</returns>
        public BugInfo Save(BugInfo param)
        {
            if (string.IsNullOrEmpty(param.Id))
            {
                throw new Exception("实例标识不能为空。");
            }

            bool isNewObject = !this.IsExist(param.Id);

            BugInfo originalObject = isNewObject ? null : this.FindOne(param.Id);

            string methodName = isNewObject ? "新增" : "编辑";

            if (isNewObject)
            {
                IAccountInfo account = KernelContext.Current.User;

                param.AccountId   = account.Id;
                param.AccountName = account.Name;
            }

            // 指派问题负责人
            if (string.IsNullOrEmpty(param.AssignToAccountId))
            {
                param.AssignToAccountName = string.Empty;
            }
            else
            {
                param.AssignToAccountName = MembershipManagement.Instance.AccountService[param.AssignToAccountId].Name;
            }

            // 生成问题编号
            if (string.IsNullOrEmpty(param.Code))
            {
                string code = string.Empty;

                // 所属类别信息
                ApplicationInfo application = AppsContext.Instance.ApplicationService[BugConfiguration.ApplicationName];

                // 编号的相关实体数据表
                string entityTableName = BugConfigurationView.Instance.DigitalNumberEntityTableName;

                // 编号的前缀编码
                string prefixCode = BugConfigurationView.Instance.DigitalNumberPrefixCodeRule
                                    .Replace("{ApplicationPinYin}", application.PinYin);

                // 编号的自增流水号长度
                int incrementCodeLength = BugConfigurationView.Instance.DigitalNumberIncrementCodeLength;

                GenericSqlCommand command = this.provider.CreateGenericSqlCommand();

                code = DigitalNumberContext.GenerateDateCodeByPrefixCode(command, entityTableName, prefixCode, incrementCodeLength);

                param.Code = code.ToUpper();
            }

            // 过滤 Cross Site Script
            param = StringHelper.ToSafeXSS <BugInfo>(param);

            this.provider.Save(param);

            param = this.FindOne(param.Id);

            if (isNewObject)
            {
                originalObject = param;
            }

            // 记录问题状态信息
            BugHistoryInfo history = new BugHistoryInfo();

            history.Id    = StringHelper.ToGuid();
            history.BugId = param.Id;

            if (isNewObject)
            {
                // 0.新问题 | 1.确认中 | 2.处理中 | 3.已解决 | 4.已关闭
                history.FromStatus = 0;
                history.ToStatus   = 0;

                BugContext.Instance.BugHistoryService.Save(history);
            }
            else
            {
                history.FromStatus = (param.Properties["FromStatus"] == null) ? 0 : Convert.ToInt32(param.Properties["FromStatus"].ToString());
                history.ToStatus   = param.Status;

                if (history.FromStatus != history.ToStatus)
                {
                    BugContext.Instance.BugHistoryService.Save(history);
                }
            }

            // 发送邮件提醒
            // 新问题状态发送给负责人, 已解决状态发送给提交人
            if (BugConfigurationView.Instance.SendMailAlert == "ON"
                // && isNewObject || (param.ModifiedDate.AddHours(2) > originalObject.ModifiedDate)
                && (param.Status == 0 || param.Status == 3))
            {
                if (isNewObject || (param.Status != originalObject.Status || param.AssignToAccountId != originalObject.AssignToAccountId))
                {
                    string mailTo, mailSubject, mailBody;

                    IMemberInfo member = null;

                    if (param.Status == 3)
                    {
                        // 已解决的问题, 发邮件通知提交人
                        member = MembershipManagement.Instance.MemberService.FindOneByAccountId(param.AccountId);
                    }
                    else
                    {
                        member = MembershipManagement.Instance.MemberService.FindOneByAccountId(param.AssignToAccountId);
                    }

                    if (member != null && !string.IsNullOrEmpty(member.Email))
                    {
                        VelocityContext context = new VelocityContext();

                        // 加载当前实体数据信息
                        context.Put("kernelConfiguration", KernelConfigurationView.Instance);
                        // 加载当前实体数据信息
                        context.Put("param", param);

                        mailTo = member.Email;

                        mailSubject = mailBody = string.Empty;

                        if (param.Status == 0)
                        {
                            // 0.新的问题
                            mailSubject = "您有一个新问题【" + param.Title + "】,等待处理。";

                            mailBody = VelocityManager.Instance.ParseTemplateVirtualPath(context, "/resources/email/Bug/bugzilla-new-mail.vm");
                        }
                        else if (param.Status == 3)
                        {
                            // 3.已解决
                            mailSubject = param.AssignToAccountId + "已将问题【" + param.Title + "】解决,请确认。";

                            mailBody = VelocityManager.Instance.ParseTemplateVirtualPath(context, "/resources/email/Bug/bugzilla-resolved-mail.vm");
                        }

                        EmailClientContext.Instance.Send(mailTo, mailSubject, mailBody, EmailFormat.Html);
                    }
                }
            }

            return(param);
        }
コード例 #19
0
ファイル: Bug.cs プロジェクト: slluis/bugziller
 //@}
 /*! \name General methods */
 //@{
 /// <summary>Update bug from server</summary>
 /// <remarks>Get any changes to the bug from the server. This updates information
 /// such as the time/date of the last change to the bug, etc.</remarks>
 public void Update()
 {
     int[] ids = new int[] { bi.id };
     BugIds param;
     param.ids = ids;
     this.bi = server.Proxy.GetBugs (param).bugs[0];
 }