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); } } } } }
private void UploadAttachment() { string fileServiceUrl = string.Empty; using (BugTraceEntities zentity = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { var currVersion = zentity.SYS_Version.Where(p => p.IsDefault == 1).FirstOrDefault(); fileServiceUrl = currVersion.FileServiceUrlPort; } try { string filepath = this.txtAttachment.Text; EndpointAddress address = new EndpointAddress("http://" + fileServiceUrl + "/JAJ.WinServer/FileService"); FileTransferSvc.FileServiceClient _client = new FileTransferSvc.FileServiceClient("BasicHttpBinding_IFileService", address); FileTransferSvc.TransferFileData uploadData = new FileTransferSvc.TransferFileData(); uploadData.FileName = Path.GetFileName(filepath); uploadData.FileData = File.OpenRead(filepath); uploadData.FileSize = (int)uploadData.FileData.Length; uploadData.FileUniqueID = this._attachmentUniqueID; uploadData.FileType = "PPM_ProblemTrace"; uploadData.oldFileName = this._oldFileName; wait = new FrmWait("正 在 上 传 请 稍 候"); wait.Show(); _client.UploadFileAsync(uploadData.FileName, uploadData.FileSize, uploadData.FileType, uploadData.FileUniqueID, uploadData.oldFileName, uploadData.FileData); _client.UploadFileCompleted += _client_UploadFileCompleted; } catch (Exception ex) { MessageBox.Show("文件上传失败!"); MyLog.LogError("保存问题跟踪时文件上传失败!", ex); return; } }
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(); } } } }
private void FrmBrief_Load(object sender, EventArgs e) { using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { var versonList = context.SYS_Version.ToList(); string memo = string.Empty; foreach (var item in versonList.OrderByDescending(p => p.VersionNo)) { if (!string.IsNullOrWhiteSpace(memo)) { memo += "\r\n"; } string publishDate = "未发布"; if (item.PublishDate != null) { publishDate = item.PublishDate.Value.ToString("yyyy-MM-dd"); } memo += "版本号:" + item.VersionNo + " 发布日期:" + publishDate + "\r\n"; foreach (var dtl in item.Memo.Replace(';', ';').Split(';')) { memo += "\t" + dtl + "\r\n"; } } this.txtMemo.Text = memo; } }
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("保存配置成功!"); } }
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); } } } } }
private void ShareFileList_Load(object sender, EventArgs e) { #region 绑定文件分类 using (BugTraceEntities entiy = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { var query = (from c in entiy.SYS_SortDict where c.Type == 1 select new { c.SortCode, c.SortName }).ToList(); List <KeyValuePair <string, string> > kvp = new List <KeyValuePair <string, string> >(); foreach (var item in query) { kvp.Add(new KeyValuePair <string, string>(item.SortCode, item.SortName)); } this.cbxSort.DisplayMember = "value"; this.cbxSort.ValueMember = "key"; this.cbxSort.DataSource = kvp; } this.cbxSort.Text = ""; this.txtFileName.Text = ""; #endregion }
private void ProjectPlanForm_Load(object sender, EventArgs e) { string defaultProjectCode = UserInfo.GetInstence().DefaultProjectCode; using (BugTraceEntities entiy = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { var query = (from c in entiy.PPM_ProjectTeam join d in entiy.SYS_User on c.TeamMember equals d.UserCode where c.ProjectCode == defaultProjectCode && c.Status == 1 select new { UserCode = c.TeamMember, UserName = d.UserName }).ToList(); List <KeyValuePair <string, string> > kvp = new List <KeyValuePair <string, string> >(); foreach (var item in query) { kvp.Add(new KeyValuePair <string, string>(item.UserCode, item.UserName)); } this.cbxResource.DataSource = kvp; this.cbxResource.DisplayMember = "value"; this.cbxResource.ValueMember = "key"; } }
private void btnExport_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string strFolder = folderBrowserDialog1.SelectedPath; using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { string defaultProjectCode = UserInfo.GetInstence().DefaultProjectCode; SqlParameter[] sqlparams = new SqlParameter[1]; sqlparams[0] = new SqlParameter("@DefaultProjectCode", SqlDbType.VarChar, 50); sqlparams[0].Value = string.IsNullOrWhiteSpace(defaultProjectCode) ? "" : defaultProjectCode; DataTable dtbl = context.Database.SqlQueryForDataTatable( " SELECT a.Module,a.ProblemType,a.Problem,a.FindPerson,CONVERT(varchar(100), a.FindDate, 23),a.Solution,a.DealPerson,CONVERT(varchar(100), a.EndDealDate, 23),a.Status,a.ProjectUse " + " FROM dbo.PPM_ProblemTrace a WHERE a.DeleteFlag=0 and a.ProjectCode=@DefaultProjectCode ", sqlparams); using (OpenXmlHelper ox = new OpenXmlHelper()) { ox.RowIndex = new int[] { 3 }; var fileTemplatePath = System.Environment.CurrentDirectory + "\\Template\\ProblemTraceTemplate.xlsx"; var filePath = strFolder + "\\ProblemTrace.xlsx"; if (File.Exists(filePath)) { File.Delete(filePath); } DataSet ds = new DataSet(); ds.Tables.Add(dtbl); ox.ExcelExport(ds, filePath, fileTemplatePath); } MessageBox.Show("导出excel成功!"); } } }
private void cbxSelectProject_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(this.cbxSelectProject.Text)) { var projectCode = cbxSelectProject.SelectedValue.ToString(); using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { var projectInfo = context.PPM_ProjectInfo.Where(p => p.ProjectCode == projectCode).FirstOrDefault(); txtProjectCode.Text = projectInfo.ProjectCode; txtProjectName.Text = projectInfo.ProjectName; dtBeginDate.ValueX = projectInfo.BeginDate.Value; cbxProjectManager.SelectedValue = projectInfo.ProjectManagerCode; cbxProjectLeader.SelectedValue = projectInfo.ProjectManagerCode; var projectTeamList = context.PPM_ProjectTeam.Where(p => p.ProjectCode == projectCode); this.lbxProjectTeam.Items.Clear(); foreach (var item in projectTeamList) { if (item.TeamLeader == item.TeamMember && item.TeamMember == projectInfo.ProjectManagerCode) { continue; } this.lbxProjectTeam.Items.Add(item.TeamMember + "," + item.TeamLeader); } } } else { txtProjectCode.Text = ""; txtProjectName.Text = ""; dtBeginDate.ValueX = null; cbxProjectManager.Text = ""; cbxProjectLeader.Text = ""; this.lbxProjectTeam.Items.Clear(); } }
private void downloadFile(object rowIndex) { int BufferLen = 4096; string folder = folderBrowserDialog1.SelectedPath; string file = this.dgvShareFile.Rows[(int)rowIndex].Cells["FilePath"].Value.ToString(); string fileName = Path.GetFileName(file); string fileServiceUrl = string.Empty; using (BugTraceEntities zentity = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { var currVersion = zentity.SYS_Version.Where(p => p.IsDefault == 1).FirstOrDefault(); fileServiceUrl = currVersion.FileServiceUrlPort; } Stream sourceStream = null; try { EndpointAddress address = new EndpointAddress("http://" + fileServiceUrl + "/JAJ.WinServer/FileService"); FileTransferSvc.FileServiceClient _client = new FileTransferSvc.FileServiceClient("BasicHttpBinding_IFileService", address); sourceStream = _client.DowndloadFile(file); } catch (Exception ex) { MyLog.LogError("文件下载失败!", ex); return; } FileStream targetStream = null; if (!sourceStream.CanRead) { MyLog.LogError("下载异常", new Exception("Invalid Stream!")); throw new Exception("Invalid Stream!"); } string filePath = Path.Combine(folder, fileName); using (targetStream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None)) { byte[] buffer = new byte[BufferLen]; int count = 0; while ((count = sourceStream.Read(buffer, 0, BufferLen)) > 0) { targetStream.Write(buffer, 0, count); } targetStream.Close(); sourceStream.Close(); } this.Invoke(new MethodInvoker(() => { try { wait.Close(); } catch { } MessageBox.Show("下载成功!"); })); }
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(); }
/// <summary> /// 数据绑定 /// </summary> private void PageDataBind() { using (BugTraceEntities zEntity = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { var query = from c in zEntity.PPM_ShareFile join d in zEntity.SYS_SortDict on c.SortCode equals d.SortCode join e in zEntity.SYS_User on c.CreateBy equals e.UserCode where d.Type == 1 select new { c.ID, c.SortCode, d.SortName, c.FileName, c.FilePath, c.FileDesc, c.CreateBy, CreateByName = e.UserName, c.CreateDate, c.Memo }; //分类查询条件 if (!string.IsNullOrWhiteSpace(this.cbxSort.Text)) { string sortCode = this.cbxSort.SelectedValue.ToString(); query = query.Where(p => p.SortCode == sortCode); } //创建人查询条件 if (!string.IsNullOrWhiteSpace(this.txtCreateBy.Text)) { query = query.Where(p => p.CreateByName.Contains(this.txtCreateBy.Text)); } //文件名称查询条件 if (!string.IsNullOrWhiteSpace(this.txtFileName.Text)) { query = query.Where(p => p.FileName.Contains(this.txtFileName.Text)); } int pageSize = Int32.Parse(cbxPageSize.Text); int pageNum = Int32.Parse(txtPageNum.Text); var shareFileList = query.OrderByDescending(p => new { p.SortCode, p.CreateDate }).Skip(pageSize * (pageNum - 1)).Take(pageSize).ToList(); this.dgvShareFile.DataSource = shareFileList; var totalRecordCount = query.Count(); this.lblPageInfo.Text = "总共" + totalRecordCount + "条记录,每页"; this.lblPageTotal.Text = Math.Ceiling(Convert.ToDecimal(totalRecordCount) / pageSize) + "页"; } }
private void DataBind() { string selProject = cbxCommonProject.Text; if (string.IsNullOrWhiteSpace(selProject)) { return; } bool displayAllTask = this.chkDisplayAllTask.Checked; string defaultProjectCode = cbxCommonProject.SelectedValue.ToString(); using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { IQueryable <V_ProjectPlan> query; if (displayAllTask) { query = context.V_ProjectPlan.Where(p => p.DeleteFlag == 0 && p.ProjectCode == defaultProjectCode); } else { query = context.V_ProjectPlan.Where(p => p.DeleteFlag == 0 && p.HideFlag == 0 && p.ProjectCode == defaultProjectCode); } if (this.cbxDispatchStatus.Text != "全部") { query = query.Where(p => p.DispatchStatus == this.cbxDispatchStatus.Text); } var projectPlanList = query.OrderBy(p => p.BusinessCode).ToList(); foreach (var item in projectPlanList) { if (item.RealEndDate != null && item.RealBeginDate != null) { decimal workload = (item.RealEndDate.Value.Date - item.RealBeginDate.Value.Date).Days + 1; //if (item.RealBeginDate.Value.Hour >= 12) //{ // workload = workload - Convert.ToDecimal(0.5); //} //if (item.RealEndDate.Value.Hour < 12) //{ // workload = workload - Convert.ToDecimal(0.5); //} item.RealWorkload = workload; } } this.dataGridViewExt1.DataSource = projectPlanList; if (_currIndex > 0 && _loacateIndex) { dataGridViewExt1.Rows[_currIndex].Selected = true; dataGridViewExt1.FirstDisplayedScrollingRowIndex = _currIndex; dataGridViewExt1.CurrentCell = this.dataGridViewExt1.Rows[_currIndex].Cells[4]; } } }
private void ProblemTraceList_Load(object sender, EventArgs e) { using (BugTraceEntities entiy = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { string defaultProjectCode = UserInfo.GetInstence().DefaultProjectCode; var project = entiy.PPM_ProjectInfo.Where(p => p.ProjectCode == defaultProjectCode).FirstOrDefault(); if (project != null) { this.lblTestPublish.Text = project.TestPublishDate == null ? "" : project.TestPublishDate.Value.ToString("yyyy-MM-dd HH:mm:ss"); this.Text = project.ProjectName; if (!string.IsNullOrWhiteSpace(project.UsedCustom)) { string projectUse = project.UsedCustom.Replace(',', ',');//实施客户 foreach (var item in projectUse.Split(',')) { //this.lbProjectUse.Items.Add(item); } } } else { return; } var query = (from c in entiy.PPM_ProjectTeam join d in entiy.SYS_User on c.TeamMember equals d.UserCode where c.ProjectCode == defaultProjectCode && c.Status == 1 select new { UserCode = c.TeamMember, d.UserName }).ToList(); List <KeyValuePair <string, string> > kvp = new List <KeyValuePair <string, string> >(); List <KeyValuePair <string, string> > kvp2 = new List <KeyValuePair <string, string> >(); foreach (var item in query) { kvp.Add(new KeyValuePair <string, string>(item.UserCode, item.UserName)); kvp2.Add(new KeyValuePair <string, string>(item.UserCode, item.UserName)); } this.lbFindPerson.DisplayMember = "value"; this.lbFindPerson.ValueMember = "key"; this.lbFindPerson.DataSource = kvp; this.lbDealPerson.DisplayMember = "value"; this.lbDealPerson.ValueMember = "key"; this.lbDealPerson.DataSource = kvp2; } this.lbDealPerson.ClearSelected(); this.lbFindPerson.ClearSelected(); }
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("保存成功!"); } }
private void PPMProjectPlanList_Load(object sender, EventArgs e) { this.cbxDispatchStatus.SelectedIndex = 0; using (BugTraceEntities entiy = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { UserInfo userInfo = UserInfo.GetInstence(); string defaultProjectCode = userInfo.DefaultProjectCode; string defaultProjectName = string.Empty; var project = entiy.PPM_ProjectInfo.Where(p => p.ProjectCode == defaultProjectCode).FirstOrDefault(); if (project != null) { defaultProjectName = project.ProjectName; this.Text = project.ProjectName + "--项目计划"; } #region 绑定项目列表查询条件 List <KeyValuePair <string, string> > kvp = new List <KeyValuePair <string, string> >(); bool hasDeafaultPro = false;//常用项目是否包含当前项目 var userExt = entiy.SYS_UserExt.Where(p => p.UserCode == userInfo.UserCode).FirstOrDefault(); if (userExt != null) { if (!string.IsNullOrWhiteSpace(userExt.CommonProject)) { var commonProjectList = entiy.PPM_ProjectInfo.Where(p => userExt.CommonProject.Contains(p.ProjectCode + ",")); if (commonProjectList != null && commonProjectList.Count() > 0) { foreach (var item in commonProjectList.OrderByDescending(p => p.BeginDate)) { if (item.ProjectCode == defaultProjectCode) { hasDeafaultPro = true; } kvp.Add(new KeyValuePair <string, string>(item.ProjectCode, item.ProjectName)); } } } } if (!hasDeafaultPro) { kvp.Add(new KeyValuePair <string, string>(defaultProjectCode, defaultProjectName)); } this.cbxCommonProject.DisplayMember = "value"; this.cbxCommonProject.ValueMember = "key"; this.cbxCommonProject.DataSource = kvp; if (!string.IsNullOrWhiteSpace(defaultProjectCode)) { this.cbxCommonProject.SelectedValue = defaultProjectCode; } #endregion } }
private void SaleOrderForm_Activated(object sender, EventArgs e) { SaleOrderList listForm = FormSingle.GetForm(typeof(SaleOrderList)) as SaleOrderList; int rowID = listForm.RowID; BugTraceEntities zEntity = new BugTraceEntities(EntityContextHelper.GetEntityConnString()); var saleOrderList = zEntity.SCM_SaleOrder.Where(p => p.ID == rowID); if (saleOrderList != null && saleOrderList.Count() > 0) { SCM_SaleOrder saleOrder = saleOrderList.FirstOrDefault(); this.SaleOrderID = saleOrder.ID; this.dtDeliveryDate.Text = saleOrder.DeliveryDate.ToString(); this.txtCustomName.Text = saleOrder.CustomName; this.txtCustomTel.Text = saleOrder.CustomTel; this.txtAgentName.Text = saleOrder.AgentName; this.txtCustomAddr.Text = saleOrder.CustomAddr; this.txtSumMoney.Text = saleOrder.SumMoney.ToString(); this.txtQty.Text = saleOrder.Qty.ToString(); this.cbxGoodsName.Text = saleOrder.GoodName; this.txtGoodsSort.Text = saleOrder.GoodSort; this.cbxDeliveryType.Text = saleOrder.DeliveryType; this.txtDeliveryNo.Text = saleOrder.DeliveryNo; this.cbxPayStatus.Text = saleOrder.PayStatus; this.cbxPayType.Text = saleOrder.PayType; this.txtGiftDesc.Text = saleOrder.GiftDesc; this.txtMemo.Text = saleOrder.Memo; } else { this.SaleOrderID = rowID; this.dtDeliveryDate.Text = ""; this.txtCustomName.Text = ""; this.txtCustomTel.Text = ""; this.txtAgentName.Text = ""; this.txtCustomAddr.Text = ""; this.txtSumMoney.Text = ""; this.txtQty.Text = ""; this.cbxGoodsName.Text = ""; this.txtGoodsSort.Text = ""; this.cbxDeliveryType.Text = ""; this.txtDeliveryNo.Text = ""; this.cbxPayStatus.Text = ""; this.cbxPayType.Text = ""; this.txtGiftDesc.Text = ""; this.txtMemo.Text = ""; } }
private void FrmImportExcel_Load(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) { this.txtHOST.Text = userExt.Host; this.txtPORT.Text = userExt.Port; this.txtSERVICENAME.Text = userExt.ServiceName; this.txtUsername.Text = userExt.Username; this.txtPassword.Text = userExt.Password; this.txtTableName.Text = userExt.TempTableName; } } }
private void ProblemTraceForm_Load(object sender, EventArgs e) { string defaultProjectCode = UserInfo.GetInstence().DefaultProjectCode; using (BugTraceEntities entiy = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { //var project = entiy.PPM_ProjectInfo.Where(p => p.ProjectCode == defaultProjectCode).FirstOrDefault(); //if (project != null) //{ // if (!string.IsNullOrWhiteSpace(project.UsedCustom)) // { // string projectUse = project.UsedCustom.Replace(",", ",");//实施客户 // foreach (var item in projectUse.Split(',')) // { // this.cbxProjectUse.Items.Add(item); // } // } //} var query = (from c in entiy.PPM_ProjectTeam join d in entiy.SYS_User on c.TeamMember equals d.UserCode where c.ProjectCode == defaultProjectCode && c.Status == 1 select new { UserCode = c.TeamMember, UserName = d.UserName }).ToList(); List <KeyValuePair <string, string> > kvp = new List <KeyValuePair <string, string> >(); List <KeyValuePair <string, string> > kvp2 = new List <KeyValuePair <string, string> >(); foreach (var item in query) { kvp.Add(new KeyValuePair <string, string>(item.UserCode, item.UserName)); kvp2.Add(new KeyValuePair <string, string>(item.UserCode, item.UserName)); } this.cbxFindPerson.DataSource = kvp; this.cbxFindPerson.DisplayMember = "value"; this.cbxFindPerson.ValueMember = "key"; this.cbxDealPerson.DisplayMember = "value"; this.cbxDealPerson.ValueMember = "key"; this.cbxDealPerson.DataSource = kvp2; } }
private void btnExportExcel_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string strFolder = folderBrowserDialog1.SelectedPath; using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { string selProject = cbxCommonProject.Text; if (string.IsNullOrWhiteSpace(selProject)) { return; } string defaultProjectCode = cbxCommonProject.SelectedValue.ToString(); //string defaultProjectCode = UserInfo.GetInstence().DefaultProjectCode; SqlParameter[] sqlparams = new SqlParameter[1]; sqlparams[0] = new SqlParameter("@DefaultProjectCode", SqlDbType.VarChar, 50); sqlparams[0].Value = string.IsNullOrWhiteSpace(defaultProjectCode) ? "" : defaultProjectCode; string sql = @" SELECT a.Unit,a.Activity,a.Task,a.BudgetWorkload,CONVERT(varchar(100), a.BudgetBeginDate, 23), CONVERT(varchar(100), a.BudgetEndDate, 23),a.RealWorkload, CONVERT(varchar(100), a.RealBeginDate, 23),CONVERT(varchar(100), a.RealEndDate, 23), CONVERT(varchar(100), a.TestPassDate, 23),a.DispatchStatus,a.Status,a.DealPerson,a.TestPerson ,a.DiffAnalyze FROM dbo.V_ProjectPlan a WHERE a.ProjectCode=@DefaultProjectCode ORDER BY a.BusinessCode"; DataTable dtbl = context.Database.SqlQueryForDataTatable(sql, sqlparams); using (OpenXmlHelper ox = new OpenXmlHelper()) { ox.RowIndex = new int[] { 4 }; var fileTemplatePath = System.Environment.CurrentDirectory + "\\Template\\ProjectPlanTemplate.xlsx"; var filePath = strFolder + "\\ProjectPlan.xlsx"; if (File.Exists(filePath)) { File.Delete(filePath); } DataSet ds = new DataSet(); ds.Tables.Add(dtbl); ox.ExcelExport(ds, filePath, fileTemplatePath); } MessageBox.Show("导出excel成功!"); } } }
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(); } } } } }
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(); }
/// <summary> /// 数据绑定 /// </summary> private void PageDataBind() { using (BugTraceEntities zEntity = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { IQueryable <SCM_SaleOrder> query = from c in zEntity.SCM_SaleOrder select c; if (!string.IsNullOrWhiteSpace(this.txtCustomName.Text)) { query = query.Where(p => p.CustomName.Contains(this.txtCustomName.Text)); } if (!string.IsNullOrWhiteSpace(this.cbxPayStatus.Text)) { query = query.Where(p => p.PayStatus == this.cbxPayStatus.Text); } int pageSize = Int32.Parse(cbxPageSize.Text); int pageNum = Int32.Parse(txtPageNum.Text); var saleOrderList = query.OrderBy(p => p.ID).Skip(pageSize * (pageNum - 1)).Take(pageSize).ToList(); this.dgvSaleOrder.DataSource = saleOrderList; var totalRecordCount = query.Count(); this.lblPageInfo.Text = "总共" + totalRecordCount + "条记录,每页"; this.lblPageTotal.Text = Math.Ceiling(Convert.ToDecimal(totalRecordCount) / pageSize) + "页"; } }
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(); } } }
private void CreateProjectForm_Load(object sender, EventArgs e) { if (this.Tag != null && this.Tag.ToString() != null && this.Tag.ToString() == "Add") { this.Text = "新增项目"; _formFlag = "Add"; } else { this.Text = "编辑项目"; _formFlag = "Edit"; } using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { var query = (from c in context.SYS_User select new { UserCode = c.UserCode, UserName = c.UserName }).ToList(); List <KeyValuePair <string, string> > kvp = new List <KeyValuePair <string, string> >(); List <KeyValuePair <string, string> > kvpTeam = new List <KeyValuePair <string, string> >(); List <KeyValuePair <string, string> > kvpLeader = new List <KeyValuePair <string, string> >(); foreach (var item in query) { kvp.Add(new KeyValuePair <string, string>(item.UserCode, item.UserName)); kvpTeam.Add(new KeyValuePair <string, string>(item.UserCode, item.UserName)); kvpLeader.Add(new KeyValuePair <string, string>(item.UserCode, item.UserName)); } this.cbxProjectManager.DataSource = kvp; this.cbxProjectManager.DisplayMember = "value"; this.cbxProjectManager.ValueMember = "key"; cbxProjectManager.Text = ""; this.cbxProjectTeam.DataSource = kvpTeam; this.cbxProjectTeam.DisplayMember = "value"; this.cbxProjectTeam.ValueMember = "key"; cbxProjectTeam.Text = ""; this.cbxProjectLeader.DataSource = kvpLeader; this.cbxProjectLeader.DisplayMember = "value"; this.cbxProjectLeader.ValueMember = "key"; cbxProjectLeader.Text = ""; if (this._formFlag == "Edit") { this.lblSelectProject.Visible = true; this.cbxSelectProject.Visible = true; var projectList = from c in context.PPM_ProjectInfo group c by new { ProjectCode = c.ProjectCode, ProjectName = c.ProjectName } into g select new { g.Key.ProjectCode, g.Key.ProjectName, BeginDate = g.Max(p => p.BeginDate) }; List <KeyValuePair <string, string> > kvpProject = new List <KeyValuePair <string, string> >(); foreach (var item in projectList.OrderByDescending(p => p.BeginDate)) { kvpProject.Add(new KeyValuePair <string, string>(item.ProjectCode, item.ProjectName)); } this.cbxSelectProject.DisplayMember = "value"; this.cbxSelectProject.ValueMember = "key"; this.cbxSelectProject.DataSource = kvpProject; this.txtProjectCode.Enabled = false; //this.cbxSelectProject.SelectedText = ""; //cbxSelectProject.Text = ""; } } }
private void ProjectPlanForm_Activated(object sender, EventArgs e) { ProjectPlanList listForm = FormSingle.GetForm(typeof(ProjectPlanList)) as ProjectPlanList; this._projectPlanID = listForm.SelectedID; this._isCopy = listForm.IsCopy; if (_projectPlanID == -1) { this.cbxUnit.Text = ""; this.txtActivity.Text = ""; this.txtTask.Text = ""; this.txtBudgetWorkload.Text = ""; this.dtBudgetBeginDate.Text = ""; this.dtBudgetEndDate.Text = ""; this.cbxResource.Text = ""; this.txtBusinessCode.Text = ""; this.txtDiffAnalyze.Text = ""; } else { using (BugTraceEntities context = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { var projectPlanList = context.Set <PPM_ProjectPlan>().Where(p => p.ID == _projectPlanID); if (projectPlanList != null && projectPlanList.Count() > 0) { var projectPlan = projectPlanList.FirstOrDefault(); this.cbxUnit.Text = projectPlan.Unit; this.txtActivity.Text = projectPlan.Activity; this.txtTask.Text = projectPlan.Task; this.txtBudgetWorkload.Text = projectPlan.BudgetWorkload.ToString(); if (projectPlan.BudgetBeginDate != null) { this.dtBudgetBeginDate.ValueX = projectPlan.BudgetBeginDate; } else { this.dtBudgetBeginDate.ValueX = null; } if (projectPlan.BudgetEndDate != null) { this.dtBudgetEndDate.ValueX = projectPlan.BudgetEndDate; } else { this.dtBudgetEndDate.ValueX = null; } this.cbxResource.Text = projectPlan.ResourceName; this.txtBusinessCode.Text = projectPlan.BusinessCode; this.cbxPlanType.Text = projectPlan.PlanType; this.txtDiffAnalyze.Text = projectPlan.DiffAnalyze; if (projectPlan.HideFlag == 0) { this.rdoDisplay.Checked = true; this.rdoHide.Checked = false; } else { this.rdoDisplay.Checked = false; this.rdoHide.Checked = true; } } } } }
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(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { #region CultureInfo CultureInfo[] supportedCultures = { new("pl-PL") }; app.UseRequestLocalization(new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture("pl-PL"), SupportedCultures = supportedCultures, SupportedUICultures = supportedCultures }); #endregion if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); var cookiePolicyOptions = new CookiePolicyOptions { MinimumSameSitePolicy = SameSiteMode.Strict }; app.UseCookiePolicy(cookiePolicyOptions); app.UseAuthorization(); app.UseAuthentication(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( "default", "{controller=Home}/{action=Index}/{id?}"); endpoints.MapControllerRoute( "areas", "{area}/{controller}/{action}/{id?}"); endpoints.MapControllers(); }); #region HttpContextAccessor // Important Add HttpContextAccessor NetAppCommon.HttpContextAccessor.AppContext.Configure(app.ApplicationServices .GetRequiredService <IHttpContextAccessor>()); #endregion #region Migracja bazy danych Task.Run(() => { try { // Migracja bazy danych Knf.DataBase.Data.DataBaseContext EntityContextHelper.RunMigrationAsync <Knf.DataBase.Data.DataBaseContext>(app.ApplicationServices) .Wait(); } catch (Exception e) { _log4Net.Error(e); if (null != e.InnerException) { _log4Net.Error(e.InnerException); } } }).Wait(); Task.Run(() => { try { // Migracja bazy danych PortalApiGus.ApiRegon.DataBase.Data.DataBaseContext EntityContextHelper.RunMigrationAsync <DataBaseContext>(app.ApplicationServices) .Wait(); } catch (Exception e) { _log4Net.Error(e); if (null != e.InnerException) { _log4Net.Error(e.InnerException); } } }).Wait(); Task.Run(() => { try { // Migracja bazy danych ApiWykazuPodatnikowVatData.Data.ApiWykazuPodatnikowVatDataDbContext EntityContextHelper.RunMigrationAsync <ApiWykazuPodatnikowVatDataDbContext>(app.ApplicationServices) .Wait(); } catch (Exception e) { _log4Net.Error(e); if (null != e.InnerException) { _log4Net.Error(e.InnerException); } } }).Wait(); Task.Run(() => { try { // Migracja bazy danych Vies.Core.Database.Data.ViesCoreDatabaseContext EntityContextHelper.RunMigrationAsync <ViesCoreDatabaseContext>(app.ApplicationServices).Wait(); } catch (Exception e) { _log4Net.Error(e); if (null != e.InnerException) { _log4Net.Error(e.InnerException); } } }).Wait(); Task.Run(() => { try { // Migracja bazy danych Knf.DataBase.Data.DataBaseContext EntityContextHelper.RunMigrationAsync <Knf.DataBase.Data.DataBaseContext>(app.ApplicationServices) .Wait(); } catch (Exception e) { _log4Net.Error(e); if (null != e.InnerException) { _log4Net.Error(e.InnerException); } } }).Wait(); Task.Run(() => { try { // Migracja bazy danych EulerHermes.DataBase.Data.DataBaseContext EntityContextHelper .RunMigrationAsync <EulerHermes.DataBase.Data.DataBaseContext>(app.ApplicationServices).Wait(); } catch (Exception e) { _log4Net.Error(e); if (null != e.InnerException) { _log4Net.Error(e.InnerException); } } }).Wait(); #endregion }
private void ProblemTraceForm_Activated(object sender, EventArgs e) { int rowID = FormArgument.ProblemTraceID; if (rowID != -1) { using (BugTraceEntities zEntity = new BugTraceEntities(EntityContextHelper.GetEntityConnString())) { //var problemList = zEntity.PPM_ProblemTrace.Where(p => p.ID == rowID); var problemList = (from c in zEntity.PPM_ProblemTrace join d in zEntity.SYS_User on c.AttachmentCreateBy equals d.UserCode into g where c.ID == rowID from item in g.DefaultIfEmpty() select new { c.ID, c.Module, c.ProjectUse, c.FindPersonCode, c.Problem, c.DealPersonCode, c.BeginDealDate, c.EndDealDate, c.Solution, c.Status, c.ProblemType, c.AttachmentUniqueID, c.AttachmentName, c.AttachmentCreateBy, c.PPM_ProblemTraceImage, c.AttachmentCreateDate, AttachmentCreateByName = item.UserName, c.IsRepeat }).DefaultIfEmpty(); var problemTrace = problemList.FirstOrDefault(); this._problemTraceID = problemTrace.ID; this.txtModule.Text = problemTrace.Module; //this.cbxProjectUse.Text = problemTrace.ProjectUse; if (problemTrace.BeginDealDate != null) { this.dtBeginDealDate.ValueX = problemTrace.BeginDealDate; } else { this.dtBeginDealDate.ValueX = null; } this.cbxFindPerson.SelectedValue = problemTrace.FindPersonCode; this.txtProblem.Text = problemTrace.Problem; this.cbxDealPerson.SelectedValue = problemTrace.DealPersonCode; //this.dtEndDealDate.Text = problemTrace.EndDealDate.ToString(); if (problemTrace.EndDealDate != null) { this.dtEndDealDate.ValueX = problemTrace.EndDealDate; } else { this.dtEndDealDate.ValueX = null; } this.txtSolution.Text = problemTrace.Solution; this.cbxStatus.Text = problemTrace.Status; this.cbxProblemType.Text = problemTrace.ProblemType; this._attachmentUniqueID = problemTrace.AttachmentUniqueID; this._oldFileName = problemTrace.AttachmentUniqueID + problemTrace.AttachmentName; this.linkAttachment.Text = problemTrace.AttachmentName; if (!string.IsNullOrWhiteSpace(problemTrace.AttachmentCreateByName)) { this.lblAttachmentCreateBy.Text = "(上传人:" + problemTrace.AttachmentCreateByName + ",上传时间:" + (problemTrace.AttachmentCreateDate == null?"未记录":problemTrace.AttachmentCreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")) + ")"; } else { this.lblAttachmentCreateBy.Text = ""; } this.cbxIsRepeat.Text = problemTrace.IsRepeat; flowLayoutPanel1.Controls.Clear(); foreach (var item in problemTrace.PPM_ProblemTraceImage.OrderBy(p => p.SerialNo)) { genarateImageList(item.ID, ByteToImage(item.ImageFile)); } } } else { UserInfo userInfo = UserInfo.GetInstence(); this._problemTraceID = rowID; this.txtModule.Text = ""; this.cbxFindPerson.SelectedValue = userInfo.UserCode; //this.cbxProjectUse.Text = ""; this.dtBeginDealDate.Text = ""; this.txtProblem.Text = ""; this.cbxDealPerson.Text = ""; this.dtEndDealDate.Text = ""; this.txtSolution.Text = ""; this.cbxStatus.Text = "未开始"; this._attachmentUniqueID = ""; this._oldFileName = ""; this.linkAttachment.Text = ""; this.lblAttachmentCreateBy.Text = ""; this.cbxIsRepeat.Text = ""; flowLayoutPanel1.Controls.Clear(); } }