private void dgvDetailList_CellEndEdit(object sender, DataGridViewCellEventArgs e) { Decimal qty = Decimal.Zero, uamt = Decimal.Zero, amt = Decimal.Zero; try { qty = Convert.ToDecimal(dgvDetailList.Rows[e.RowIndex].Cells[5].Value.ToString()); // Qty uamt = Convert.ToDecimal(dgvDetailList.Rows[e.RowIndex].Cells[7].Value.ToString()); // Unit Amount amt = (decimal)qty * uamt; } catch { } dgvDetailList.Rows[e.RowIndex].Cells[8].Value = amt; // Amount if (qty > 0) { dgvDetailList.Rows[e.RowIndex].Cells[5].Style.Font = new Font(dgvDetailList.DefaultCellStyle.Font, FontStyle.Bold); dgvDetailList.Rows[e.RowIndex].Cells[6].Style.Font = new Font(dgvDetailList.DefaultCellStyle.Font, FontStyle.Bold); } if (uamt > 0) { dgvDetailList.Rows[e.RowIndex].Cells[7].Style.Font = new Font(dgvDetailList.DefaultCellStyle.Font, FontStyle.Bold); dgvDetailList.Rows[e.RowIndex].Cells[8].Style.Font = new Font(dgvDetailList.DefaultCellStyle.Font, FontStyle.Bold); } if (DAL.Common.Utility.IsGUID(dgvDetailList.Rows[e.RowIndex].Cells[0].Value.ToString())) { Guid productId = new Guid(dgvDetailList.Rows[e.RowIndex].Cells[0].Value.ToString()); DetailData detail = ResultList.Find(d => d.ProductId == productId); if (detail == null) { detail = new DetailData(); detail.ProductId = productId; detail.Qty = qty; detail.UnitAmount = uamt; } else { ResultList.Remove(detail); detail.Qty = qty; detail.UnitAmount = uamt; } ResultList.Add(detail); } CalcSubTotalQty(); }
private void dgvDetailList_CellEndEdit(object sender, DataGridViewCellEventArgs e) { decimal qty = Convert.ToDecimal(dgvDetailList.Rows[e.RowIndex].Cells[5].Value.ToString()); // Qty decimal uamt = Convert.ToDecimal(dgvDetailList.Rows[e.RowIndex].Cells[7].Value.ToString()); // Unit Amount decimal amt = (decimal)qty * uamt; dgvDetailList.Rows[e.RowIndex].Cells[8].Value = amt; // Amount if (qty > 0) { dgvDetailList.Rows[e.RowIndex].Cells[5].Style.Font = new Font(dgvDetailList.DefaultCellStyle.Font, FontStyle.Bold); dgvDetailList.Rows[e.RowIndex].Cells[6].Style.Font = new Font(dgvDetailList.DefaultCellStyle.Font, FontStyle.Bold); } if (uamt > 0) { dgvDetailList.Rows[e.RowIndex].Cells[7].Style.Font = new Font(dgvDetailList.DefaultCellStyle.Font, FontStyle.Bold); dgvDetailList.Rows[e.RowIndex].Cells[8].Style.Font = new Font(dgvDetailList.DefaultCellStyle.Font, FontStyle.Bold); } Guid productId = Guid.Empty; if (Guid.TryParse(dgvDetailList.Rows[e.RowIndex].Cells[0].Value.ToString(), out productId)) { //Guid productId = new Guid(dgvDetailList.Rows[e.RowIndex].Cells[0].Value.ToString()); DetailData detail = ResultList.Find(d => d.ProductId == productId); decimal price = GetPrice(productId); if (detail == null) { detail = new DetailData(); detail.ProductId = productId; detail.Qty = qty; detail.UnitAmount = price > 0 ? price : uamt; } else { ResultList.Remove(detail); detail.Qty = qty; detail.UnitAmount = price > 0 ? price : uamt; } ResultList.Add(detail); } CalcSubTotalQty(); }
override public int Start() { if (null != PrevTaskMainline && null != PrevTaskBranch) { ResultList = PrevTaskMainline.Files.Where(tmp => tmp.Extension.Equals(".csproj")).Select(fi => { return(new CompareResult() { PathMainline = new FileInfo(fi.FullName), PathBranch = null, TfsMapping = PrevTaskMainline.TfsMapping, Developer = PrevTaskBranch.Developer }); }).ToList(); int i = 0; IEnumerable <FileInfo> csprojFiles = PrevTaskBranch.Files.Where(tmp => tmp.Extension.Equals(".csproj")); foreach (FileInfo file in csprojFiles) { CompareResult result = null; if (null != (result = ResultList.Find(r => { //if (null == r?.PathMainline) System.Diagnostics.Trace.WriteLine(string.Format("ERROR: 读取主线文件时出现了空引用, r={0}, b={1}, m={2}", r, r?.PathBranch, r?.PathMainline)); return(0 == CompareGitWmsProjFile(r.PathMainline, file)); }))) { result.PathBranch = file; // update compare result. } else { ResultList.Add(new CompareResult() { PathBranch = file, PathMainline = null, TfsMapping = PrevTaskMainline.TfsMapping, Developer = PrevTaskBranch.Developer }); // add new compare result for branch only files } i++; } // foreach (... // compare with branch for each file. } return(1); }