Пример #1
0
        private void ProblemTraceList_FormClosing(object sender, FormClosingEventArgs e)
        {
            bool isExist = FormSingle.IsExist(typeof(ProblemTraceForm));

            if (isExist)
            {
                var tempForm = FormSingle.GetForm(typeof(ProblemTraceForm));
                tempForm.Close();
            }
        }
Пример #2
0
        private void SaveProblemTrace(bool hasUpload)
        {
            PPM_ProblemTrace problemTrace;

            using (BugTraceEntities zEntity = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
            {
                UserInfo currUser = UserInfo.GetInstence();
                if (this._problemTraceID == -1)
                {
                    problemTrace = new PPM_ProblemTrace();
                }
                else
                {
                    problemTrace = zEntity.PPM_ProblemTrace.Where(p => p.ID == this._problemTraceID).FirstOrDefault();
                }
                problemTrace.ProjectCode    = currUser.DefaultProjectCode;
                problemTrace.Module         = this.txtModule.Text;
                problemTrace.FindPersonCode = this.cbxFindPerson.SelectedValue.ToString();
                problemTrace.FindPerson     = this.cbxFindPerson.Text;
                problemTrace.Problem        = this.txtProblem.Text;
                problemTrace.DealPersonCode = this.cbxDealPerson.SelectedValue.ToString();
                problemTrace.DealPerson     = this.cbxDealPerson.Text;
                //problemTrace.ProjectUse = this.cbxProjectUse.Text;
                if (!string.IsNullOrWhiteSpace(this.dtBeginDealDate.Text))
                {
                    problemTrace.BeginDealDate = Convert.ToDateTime(this.dtBeginDealDate.Text);
                }
                else
                {
                    problemTrace.BeginDealDate = null;
                }
                if (!string.IsNullOrWhiteSpace(this.dtEndDealDate.Text))
                {
                    problemTrace.EndDealDate = Convert.ToDateTime(this.dtEndDealDate.Text);
                }
                problemTrace.Solution    = this.txtSolution.Text;
                problemTrace.Status      = this.cbxStatus.Text;
                problemTrace.ProblemType = this.cbxProblemType.Text;
                if (problemTrace.Status == "未通过")
                {
                    problemTrace.TestFlag = 0;
                }
                problemTrace.UpdateDate   = DateTime.Now;
                problemTrace.UpdatePerson = currUser.UserCode;
                problemTrace.IsRepeat     = this.cbxIsRepeat.Text;
                if (problemTrace.Status == "未开始" || problemTrace.Status == "进行中" || problemTrace.Status == "未通过")
                {
                    problemTrace.EndDealDate = null;
                }
                if (problemTrace.Status == "发版关闭")
                {
                    problemTrace.TestPersonCode = UserInfo.GetInstence().UserCode;
                    problemTrace.TestPerson     = UserInfo.GetInstence().UserName;
                    problemTrace.TestPassDate   = DateTime.Now;
                }
                if (this._problemTraceID == -1)
                {
                    problemTrace.FindDate     = DateTime.Now;
                    problemTrace.CreateDate   = DateTime.Now;
                    problemTrace.CreatePerson = currUser.UserCode;
                    problemTrace.DeleteFlag   = 0;
                    zEntity.PPM_ProblemTrace.Add(problemTrace);
                }
                if (hasUpload)//有上传附件
                {
                    problemTrace.AttachmentName       = Path.GetFileName(this.txtAttachment.Text);
                    problemTrace.AttachmentUniqueID   = this._attachmentUniqueID;
                    problemTrace.AttachmentCreateBy   = UserInfo.GetInstence().UserCode;
                    problemTrace.AttachmentCreateDate = DateTime.Now;
                }
                if (problemTrace.Status == "进行中")
                {
                    problemTrace.BeginDealDate = DateTime.Now;
                }
                #region 保存图片
                if (this._problemTraceID != -1)
                {//删除以前的图片
                    var delImage = zEntity.PPM_ProblemTraceImage.Where(p => p.ProblemTraceID == this._problemTraceID);
                    zEntity.PPM_ProblemTraceImage.RemoveRange(delImage);
                }
                int i = 1;
                foreach (Control item in flowLayoutPanel1.Controls)
                {
                    PictureBox pictureBox = item as PictureBox;
                    if (pictureBox != null)
                    {
                        PPM_ProblemTraceImage image = new PPM_ProblemTraceImage()
                        {
                            ID          = pictureBox.Tag.ToString(),
                            StorageType = 1,
                            SerialNo    = i++,
                            ImageFile   = ImageToBytes(pictureBox.Image),
                        };
                        problemTrace.PPM_ProblemTraceImage.Add(image);
                    }
                }
                #endregion
                zEntity.SaveChanges();
            }
            MessageBox.Show("保存成功!");
            this.Close();
            try
            {
                var problemTraceList = FormSingle.GetForm(typeof(ProblemTraceList)) as ProblemTraceList;
                problemTraceList.SearchClick();
                bool isExist = FormSingle.IsExist(typeof(ProjectPlanList));
                if (isExist)
                {
                    var tempForm = FormSingle.GetForm(typeof(ProjectPlanList)) as ProjectPlanList;
                    tempForm.SearchClick();
                }
            }
            catch (Exception ex)
            {
                MyLog.LogError("保存问题跟踪后刷新列表页面失败!", ex);
            }
        }
Пример #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            #region 验证
            if (string.IsNullOrWhiteSpace(this.txtTel.Text))
            {
                MessageBox.Show("电话不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.txtTel.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(this.txtQQ.Text))
            {
                MessageBox.Show("QQ不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.txtQQ.Focus();
                return;
            }
            #endregion
            using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
            {
                string strProject = string.Empty;
                if (this.lbProjectList.Items.Count > 0)
                {
                    foreach (var item in this.lbProjectList.Items)
                    {
                        strProject = strProject + item.ToString().Split(')')[0].Replace("(", "") + ",";
                    }
                    //strProject = strProject.Substring(0, strProject.Length-1);
                }

                string userCode    = UserInfo.GetInstence().UserCode;
                var    currUserExt = context.SYS_UserExt.Where(p => p.UserCode == userCode).FirstOrDefault();
                if (currUserExt != null)
                {
                    if (!string.IsNullOrWhiteSpace(this.txtEmailPassword.Text))
                    {
                        currUserExt.EmailPassword = Encrypt.TripleDESEncrypting(this.txtEmailPassword.Text);
                        currUserExt.CommonProject = strProject;
                        context.SaveChanges();
                    }
                }
                else
                {
                    currUserExt          = new SYS_UserExt();
                    currUserExt.UserCode = userCode;
                    if (!string.IsNullOrWhiteSpace(this.txtEmailPassword.Text))
                    {
                        currUserExt.EmailPassword = Encrypt.TripleDESEncrypting(this.txtEmailPassword.Text);
                    }
                    currUserExt.CommonProject = strProject;
                    context.SYS_UserExt.Add(currUserExt);
                    context.SaveChanges();
                }
                var currUser = context.SYS_User.Where(p => p.UserCode == userCode).FirstOrDefault();
                if (currUser != null && !string.IsNullOrWhiteSpace(this.cbxProject.SelectedValue.ToString()))
                {
                    currUser.DefaultProjectCode = this.cbxProject.SelectedValue.ToString();
                    currUser.QQ  = this.txtQQ.Text;
                    currUser.Tel = this.txtTel.Text;
                    context.SaveChanges();
                    UserInfo.GetInstence().DefaultProjectCode = this.cbxProject.SelectedValue.ToString();
                    UserInfo.GetInstence().QQ  = this.txtQQ.Text;
                    UserInfo.GetInstence().Tel = this.txtTel.Text;
                    MessageBox.Show("保存成功!");
                    try
                    {
                        bool isExist = FormSingle.IsExist(typeof(ProblemTraceList));
                        if (isExist)
                        {
                            var tempForm = FormSingle.GetForm(typeof(ProblemTraceList));
                            tempForm.Close();
                            tempForm = FormSingle.GetForm(typeof(ProblemTraceList));
                            tempForm.ShowNormal(this.ParentForm);
                        }
                        bool isExistPPL = FormSingle.IsExist(typeof(ProjectPlanList));
                        if (isExistPPL)
                        {
                            var tempForm = FormSingle.GetForm(typeof(ProjectPlanList));
                            tempForm.Close();
                            tempForm = FormSingle.GetForm(typeof(ProjectPlanList));
                            tempForm.ShowNormal(this.ParentForm);
                        }
                        bool isExistIndex = FormSingle.IsExist(typeof(FrmIndex));
                        if (isExistIndex)
                        {
                            var tempForm = FormSingle.GetForm(typeof(FrmIndex)) as FrmIndex;
                            tempForm.Close();
                            tempForm = FormSingle.GetForm(typeof(FrmIndex)) as FrmIndex;
                            tempForm.ShowNormal(this.ParentForm);
                        }
                    }
                    catch (Exception ex)
                    {
                        MyLog.LogError("保存个人设置后刷新各窗口失败!", ex);
                    }

                    this.Close();
                }
            }
        }