Beispiel #1
0
 private void btnSaveSetting_Click(object sender, EventArgs e)
 {
     using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
     {
         string currUser = UserInfo.GetInstence().UserCode;
         var    userExt  = context.SYS_UserExt.Where(p => p.UserCode == currUser).FirstOrDefault();
         if (userExt == null)
         {
             userExt               = new SYS_UserExt();
             userExt.UserCode      = currUser;
             userExt.Host          = this.txtHOST.Text.Trim();
             userExt.Port          = this.txtPORT.Text.Trim();
             userExt.ServiceName   = this.txtSERVICENAME.Text.Trim();
             userExt.Username      = this.txtUsername.Text.Trim();
             userExt.Password      = this.txtPassword.Text.Trim();
             userExt.TempTableName = this.txtTableName.Text.Trim();
             context.SYS_UserExt.Add(userExt);
             context.SaveChanges();
         }
         else
         {
             userExt.Host          = this.txtHOST.Text.Trim();
             userExt.Port          = this.txtPORT.Text.Trim();
             userExt.ServiceName   = this.txtSERVICENAME.Text.Trim();
             userExt.Username      = this.txtUsername.Text.Trim();
             userExt.Password      = this.txtPassword.Text.Trim();
             userExt.TempTableName = this.txtTableName.Text.Trim();
             context.SaveChanges();
         }
         MessageBox.Show("保存配置成功!");
     }
 }
Beispiel #2
0
        private void btnTurnToProblemTrace_Click(object sender, EventArgs e)
        {
            var key = this.dataGridViewExt1.CurrentRow.Cells["ID"].Value;

            if (key == null)
            {
                MessageBox.Show("请先选择一行数据");
            }
            else
            {
                var dealPerson = this.dataGridViewExt1.CurrentRow.Cells["DealPerson"].Value;
                if (dealPerson == null || string.IsNullOrWhiteSpace(dealPerson.ToString()))
                {
                    MessageBox.Show("当前任务没有负责人,不能下发");
                    return;
                }

                if (MessageBox.Show("您确定要下发任务吗?", "提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
                {
                    int id = Convert.ToInt32(key);
                    using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
                    {
                        #region 验证是否已经下发任务
                        var problemTraceList = context.PPM_ProblemTrace.Where(p => p.ProjectPlanID == id);
                        if (problemTraceList != null && problemTraceList.Count() > 0)
                        {
                            MessageBox.Show("任务已经下发!");
                            return;
                        }
                        #endregion
                        var projectPlan  = context.PPM_ProjectPlan.Where(p => p.ID == id).FirstOrDefault();
                        var problemTrace = new PPM_ProblemTrace()
                        {
                            ProjectCode    = projectPlan.ProjectCode,
                            Module         = projectPlan.Activity,
                            Problem        = projectPlan.Task,
                            FindPerson     = UserInfo.GetInstence().UserName,
                            FindPersonCode = UserInfo.GetInstence().UserCode,
                            FindDate       = DateTime.Now,
                            DealPerson     = projectPlan.ResourceName,
                            DealPersonCode = projectPlan.ResourceCode,
                            Status         = projectPlan.Status,
                            DeleteFlag     = 0,
                            CreateDate     = DateTime.Now,
                            CreatePerson   = UserInfo.GetInstence().UserCode,
                            UpdateDate     = DateTime.Now,
                            UpdatePerson   = UserInfo.GetInstence().UserCode,
                            ProblemType    = projectPlan.PlanType,
                            ProjectPlanID  = projectPlan.ID,
                            IsRepeat       = "否"
                        };
                        context.PPM_ProblemTrace.Add(problemTrace);
                        context.SaveChanges();
                        MessageBox.Show("任务下发成功!");
                        _loacateIndex = true;
                        this.DataBind();
                    }
                }
            }
        }
Beispiel #3
0
 private void btnDeleteSaleOrder_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("您确定要删除吗?", "提示:", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
     {
         var key = dgvSaleOrder.CurrentRow.Cells["ID"].Value;
         if (key == null)
         {
             MessageBox.Show("请先选择一行数据");
         }
         else
         {
             RowID = Int32.Parse(key.ToString());
             using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
             {
                 var saleOrder = context.SCM_SaleOrder.Where(p => p.ID == RowID).FirstOrDefault();
                 if (saleOrder != null)
                 {
                     context.SCM_SaleOrder.Remove(saleOrder);
                     context.SaveChanges();
                     MessageBox.Show("删除成功!");
                     btnSearch_Click(null, null);
                 }
             }
         }
     }
 }
Beispiel #4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("您确定要删除吗?", "提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
     {
         var key = dgvProblemTrace.CurrentRow.Cells["ID"].Value;
         if (key == null)
         {
             MessageBox.Show("请先选择一行数据");
         }
         else
         {
             FormArgument.ProblemTraceID = Int32.Parse(key.ToString());
             using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
             {
                 var saleOrder = context.PPM_ProblemTrace.Where(p => p.ID == FormArgument.ProblemTraceID).FirstOrDefault();
                 if (saleOrder != null)
                 {
                     saleOrder.DeleteFlag   = 1;//删除标识
                     saleOrder.UpdatePerson = UserInfo.GetInstence().UserCode;
                     saleOrder.UpdateDate   = DateTime.Now;
                     //context.PPM_ProblemTrace.Remove(saleOrder);
                     context.SaveChanges();
                     MessageBox.Show("删除成功!");
                     btnSearch_Click(null, null);
                 }
             }
         }
     }
 }
Beispiel #5
0
        private void btnSaveSaleOrder_Click(object sender, EventArgs e)
        {
            SCM_SaleOrder    saleOrder;
            BugTraceEntities zEntity = new BugTraceEntities(EntityContextHelper.GetEntityConnString());

            if (this.SaleOrderID == -1)
            {
                saleOrder = new SCM_SaleOrder();
            }
            else
            {
                saleOrder = zEntity.SCM_SaleOrder.Where(p => p.ID == this.SaleOrderID).FirstOrDefault();
            }
            saleOrder.DeliveryDate = DateTime.Parse(this.dtDeliveryDate.Text);
            saleOrder.CustomName   = this.txtCustomName.Text;
            saleOrder.CustomTel    = this.txtCustomTel.Text;
            saleOrder.AgentName    = this.txtAgentName.Text;
            saleOrder.CustomAddr   = this.txtCustomAddr.Text;
            decimal sumMoney = 0;

            if (!decimal.TryParse(this.txtSumMoney.Text, out sumMoney))
            {
                MessageBox.Show("金额必须为数字");
                return;
            }
            saleOrder.SumMoney = sumMoney;
            decimal qty = 0;

            if (!decimal.TryParse(this.txtQty.Text, out qty))
            {
                MessageBox.Show("金额必须为数字");
                return;
            }
            saleOrder.Qty          = qty;
            saleOrder.GoodName     = this.cbxGoodsName.Text;
            saleOrder.GoodSort     = this.txtGoodsSort.Text;
            saleOrder.DeliveryType = this.cbxDeliveryType.Text;
            saleOrder.DeliveryNo   = this.txtDeliveryNo.Text;
            saleOrder.PayStatus    = this.cbxPayStatus.Text;
            saleOrder.PayType      = this.cbxPayType.Text;
            saleOrder.GiftDesc     = this.txtGiftDesc.Text;
            saleOrder.Memo         = this.txtMemo.Text;
            if (this.SaleOrderID == -1)
            {
                zEntity.SCM_SaleOrder.Add(saleOrder);
            }
            zEntity.SaveChanges();
            MessageBox.Show("保存成功!");
            this.Close();
            var saleOrderListForm = FormSingle.GetForm(typeof(SaleOrderList)) as SaleOrderList;

            saleOrderListForm.SearchClick();
        }
Beispiel #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
            {
                PPM_ProjectInfo projectInfo;
                if (this._formFlag == "Add")
                {
                    projectInfo = new PPM_ProjectInfo();
                }
                else
                {
                    string projectCode = cbxSelectProject.SelectedValue.ToString();
                    projectInfo = context.PPM_ProjectInfo.Where(p => p.ProjectCode == projectCode).FirstOrDefault();
                }
                projectInfo.ProjectCode        = txtProjectCode.Text;
                projectInfo.ProjectName        = txtProjectName.Text;
                projectInfo.BeginDate          = dtBeginDate.Value;
                projectInfo.ProjectManagerCode = this.cbxProjectManager.SelectedValue.ToString();

                if (this._formFlag == "Edit")
                {
                    string projectCode     = cbxSelectProject.SelectedValue.ToString();
                    var    projectTeamList = context.PPM_ProjectTeam.Where(p => p.ProjectCode == projectCode);
                    context.PPM_ProjectTeam.RemoveRange(projectTeamList);
                }
                PPM_ProjectTeam projectTeam;
                foreach (var item in lbxProjectTeam.Items)
                {
                    string[] strTeam = item.ToString().Split(',');
                    projectTeam             = new PPM_ProjectTeam();
                    projectTeam.ProjectCode = projectInfo.ProjectCode;
                    projectTeam.TeamLeader  = strTeam[1];
                    projectTeam.TeamMember  = strTeam[0];
                    projectTeam.Status      = 1;
                    context.PPM_ProjectTeam.Add(projectTeam);
                }
                projectTeam             = new PPM_ProjectTeam();
                projectTeam.ProjectCode = projectInfo.ProjectCode;
                projectTeam.TeamMember  = projectInfo.ProjectManagerCode;
                projectTeam.TeamLeader  = projectInfo.ProjectManagerCode;
                projectTeam.Status      = 1;
                context.PPM_ProjectTeam.Add(projectTeam);
                if (this._formFlag == "Add")
                {
                    context.PPM_ProjectInfo.Add(projectInfo);
                }
                context.SaveChanges();
                MessageBox.Show("保存成功!");
            }
        }
Beispiel #7
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("您确定要删除吗?", "提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
     {
         var key = dataGridViewExt1.CurrentRow.Cells["ID"].Value;
         if (key == null)
         {
             MessageBox.Show("请先选择一行数据");
         }
         else
         {
             this.SelectedID = Int32.Parse(key.ToString());
             using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
             {
                 //var problemTraceList = context.PPM_ProblemTrace.Where(p => p.ProjectPlanID == this.SelectedID);
                 //if (problemTraceList != null && problemTraceList.Count() > 0)
                 //{
                 //    MessageBox.Show("任务已经下发,不能删除");
                 //    return;
                 //}
                 var projectPlan = context.PPM_ProjectPlan.Where(p => p.ID == this.SelectedID).FirstOrDefault();
                 if (projectPlan != null)
                 {
                     projectPlan.DeleteFlag   = 1;//删除标识
                     projectPlan.UpdatePerson = UserInfo.GetInstence().UserCode;
                     projectPlan.UpdateDate   = DateTime.Now;
                     var problemTraceList = context.PPM_ProblemTrace.Where(p => p.ProjectPlanID == this.SelectedID);
                     foreach (var problemTrace in problemTraceList)
                     {
                         problemTrace.DeleteFlag   = 1;//删除标识
                         problemTrace.UpdatePerson = UserInfo.GetInstence().UserCode;
                         problemTrace.UpdateDate   = DateTime.Now;
                     }
                     context.SaveChanges();
                     MessageBox.Show("删除成功!");
                     _loacateIndex = false;
                     this.DataBind();
                 }
             }
         }
     }
 }
Beispiel #8
0
 private void btnSaveBusinessCode_Click(object sender, EventArgs e)
 {
     using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
     {
         foreach (DataGridViewRow row in this.dataGridViewExt1.Rows)
         {
             if (row.Tag == null || row.Tag.ToString() != "Changed")
             {
                 continue;
             }
             int    id          = Convert.ToInt32(row.Cells["ID"].Value);
             string bCode       = row.Cells["BusinessCode"].Value.ToString();
             var    projectPlan = context.PPM_ProjectPlan.Where(p => p.ID == id).FirstOrDefault();
             projectPlan.BusinessCode = bCode;
         }
         context.SaveChanges();
     }
     MessageBox.Show("保存业务编码成功!");
     _loacateIndex = true;
     this.DataBind();
 }
Beispiel #9
0
 private void btnTestPublish_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("您确定已经测试发版了吗?", "提示:", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
     {
         using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
         {
             var problem = context.PPM_ProblemTrace.Where(p => p.Status == "已提交未审核" || p.Status == "完成" || p.Status == "发版关闭");
             foreach (var item in problem)
             {
                 item.TestFlag = 1;
             }
             string defaultProjectCode = UserInfo.GetInstence().DefaultProjectCode;
             var    project            = context.PPM_ProjectInfo.Where(p => p.ProjectCode == defaultProjectCode).FirstOrDefault();
             if (project != null)
             {
                 project.TestPublishDate = DateTime.Now;
             }
             context.SaveChanges();
             this.lblTestPublish.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             MessageBox.Show("保存成功!");
             this.SearchClick();
         }
     }
 }
Beispiel #10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            #region 验证
            if (!CheckNumber(this.txtBudgetWorkload.Text))
            {
                MessageBox.Show("预算工作量必须是数值类型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.txtBudgetWorkload.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(cbxPlanType.Text))
            {
                MessageBox.Show("任务类型不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.cbxPlanType.Focus();
                return;
            }

            #endregion

            using (BugTraceEntities zEntity = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
            {
                PPM_ProjectPlan projectPlan;
                if (this._projectPlanID == -1 || this._isCopy)
                {
                    projectPlan = new PPM_ProjectPlan();
                }
                else
                {
                    projectPlan = zEntity.PPM_ProjectPlan.Where(p => p.ID == this._projectPlanID).FirstOrDefault();
                }
                projectPlan.Unit           = this.cbxUnit.Text;
                projectPlan.Activity       = this.txtActivity.Text;
                projectPlan.Task           = this.txtTask.Text;
                projectPlan.BudgetWorkload = Convert.ToDecimal(this.txtBudgetWorkload.Text);
                if (!string.IsNullOrWhiteSpace(this.dtBudgetBeginDate.Text))
                {
                    projectPlan.BudgetBeginDate = Convert.ToDateTime(this.dtBudgetBeginDate.Text);
                }
                else
                {
                    projectPlan.BudgetBeginDate = null;
                }

                if (!string.IsNullOrWhiteSpace(this.dtBudgetEndDate.Text))
                {
                    projectPlan.BudgetEndDate = Convert.ToDateTime(this.dtBudgetEndDate.Text);
                }
                else
                {
                    projectPlan.BudgetEndDate = null;
                }

                if (!string.IsNullOrWhiteSpace(this.cbxResource.Text))
                {
                    projectPlan.ResourceCode = this.cbxResource.SelectedValue.ToString();
                    projectPlan.ResourceName = this.cbxResource.Text;
                }
                if (this._projectPlanID == -1 || this._isCopy)
                {
                    projectPlan.CreateDate   = DateTime.Now;
                    projectPlan.CreatePerson = UserInfo.GetInstence().UserCode;
                    projectPlan.DeleteFlag   = 0;
                    projectPlan.Status       = "未开始";
                    zEntity.PPM_ProjectPlan.Add(projectPlan);
                }
                else
                {
                    var problemTrace = zEntity.PPM_ProblemTrace.Where(p => p.ProjectPlanID == projectPlan.ID).FirstOrDefault();
                    if (problemTrace != null && problemTrace.Status == "未开始")
                    {
                        problemTrace.Module         = projectPlan.Activity;
                        problemTrace.Problem        = projectPlan.Task;
                        problemTrace.FindPerson     = UserInfo.GetInstence().UserName;
                        problemTrace.FindPersonCode = UserInfo.GetInstence().UserCode;
                        //problemTrace.FindDate = DateTime.Now;
                        problemTrace.DealPerson     = projectPlan.ResourceName;
                        problemTrace.DealPersonCode = projectPlan.ResourceCode;
                        problemTrace.UpdateDate     = DateTime.Now;
                        problemTrace.UpdatePerson   = UserInfo.GetInstence().UserCode;
                        problemTrace.ProblemType    = projectPlan.PlanType;
                    }
                }
                projectPlan.UpdateDate   = DateTime.Now;
                projectPlan.UpdatePerson = UserInfo.GetInstence().UserCode;
                projectPlan.ProjectCode  = UserInfo.GetInstence().DefaultProjectCode;
                projectPlan.BusinessCode = this.txtBusinessCode.Text;
                projectPlan.PlanType     = cbxPlanType.Text;
                if (this.rdoDisplay.Checked && !this.rdoHide.Checked)
                {
                    projectPlan.HideFlag = 0;
                }
                else
                {
                    projectPlan.HideFlag = 1;
                }
                projectPlan.DiffAnalyze = this.txtDiffAnalyze.Text;
                zEntity.SaveChanges();
            }
            MessageBox.Show("保存成功!");
            this.Close();
            var projectPlanList = FormSingle.GetForm(typeof(ProjectPlanList)) as ProjectPlanList;
            projectPlanList.SearchClick();
        }
Beispiel #11
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);
            }
        }
Beispiel #12
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();
                }
            }
        }