private void loadDG() { dataDS.Rows.Clear(); int i = 0; foreach (var item in listInput) { int mskh = productInputBO.GetData(u => u.ID == item.MSDH).First().MSKH; dataDS.Rows.Add(); dataDS.Rows[i].Cells[0].Value = "NH" + item.ID.ToString("D6"); dataDS.Rows[i].Cells[1].Value = item.Date.ToString(); dataDS.Rows[i].Cells[2].Value = "KH" + mskh.ToString("d6"); dataDS.Rows[i].Cells[3].Value = customerBO.GetNameByID(mskh); dataDS.Rows[i].Cells[4].Value = "DH" + item.MSDH.Value.ToString("d6"); dataDS.Rows[i].Cells[5].Value = item.Payment.ToString(); i++; } foreach (var item in listOutput) { int mskh = productOutputBO.GetData(u => u.ID == item.MSDH).First().MSKH.Value; dataDS.Rows.Add(); dataDS.Rows[i].Cells[0].Value = "XH" + item.ID.ToString("D6"); dataDS.Rows[i].Cells[1].Value = item.Date.ToString(); dataDS.Rows[i].Cells[2].Value = "KH" + mskh.ToString("d6"); dataDS.Rows[i].Cells[3].Value = customerBO.GetNameByID(mskh); dataDS.Rows[i].Cells[4].Value = "DH" + item.MSDH.Value.ToString("d6"); dataDS.Rows[i].Cells[5].Value = item.Payment.ToString(); i++; } }
public void loadDG() { int i = 0; int ID = productInputBO.GetID(); dataDS.Rows.Clear(); foreach (var item in list) { dataDS.Rows.Add(); list[i].ID = ID; dataDS.Rows[i].Cells[0].Value = "NH" + ID.ToString("D6"); dataDS.Rows[i].Cells[1].Value = "KH" + item.MSKH.Value.ToString("D6"); dataDS.Rows[i].Cells[2].Value = customer.GetNameByID(item.MSKH.Value);; dataDS.Rows[i].Cells[3].Value = item.Date.Value.ToShortDateString(); dataDS.Rows[i].Cells[4].Value = item.MSXE; dataDS.Rows[i].Cells[5].Value = item.TruckWeight; dataDS.Rows[i].Cells[6].Value = item.ProductName; dataDS.Rows[i].Cells[7].Value = item.ProductWeight; dataDS.Rows[i].Cells[8].Value = item.TotalWeight; dataDS.Rows[i].Cells[9].Value = item.ProductPrice; dataDS.Rows[i].Cells[10].Value = item.TotalAmount; i++; ID++; } }
public void loadDG() { int i = 0; dataDS.Rows.Clear(); int month = txtDate.Value.Month; int year = txtDate.Value.Year; list = productOutputBO.GetData(u => u.isDelete == false && u.MSKH == int.Parse(txtMSKH.Text.Substring(2)) && u.Date.Value.Month == month && u.Date.Value.Year == year).ToList(); foreach (var item in list) { dataDS.Rows.Add(); if (item.ProductWeight <= 0) { dataDS.Rows[i].Cells[0].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[1].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[2].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[3].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[4].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[5].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[6].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[7].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[8].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[9].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[10].Style.BackColor = System.Drawing.Color.Salmon; dataDS.Rows[i].Cells[11].Style.BackColor = System.Drawing.Color.Salmon; } dataDS.Rows[i].Cells[0].Value = "XH" + item.ID.ToString("D6"); dataDS.Rows[i].Cells[1].Value = "KH" + item.MSKH.Value.ToString("D6"); dataDS.Rows[i].Cells[2].Value = customer.GetNameByID(item.MSKH.Value);; dataDS.Rows[i].Cells[3].Value = item.Date.Value.ToShortDateString(); dataDS.Rows[i].Cells[4].Value = item.MSXE; dataDS.Rows[i].Cells[5].Value = item.TruckWeight; dataDS.Rows[i].Cells[6].Value = item.ProductName; dataDS.Rows[i].Cells[7].Value = item.ProductWeight; dataDS.Rows[i].Cells[8].Value = item.TypeSack; dataDS.Rows[i].Cells[9].Value = item.sack; dataDS.Rows[i].Cells[10].Value = item.TotalWeight; dataDS.Rows[i].Cells[11].Value = item.ProductPrice; dataDS.Rows[i].Cells[12].Value = item.TotalAmount; i++; } if (i > 0) { dataDS.CurrentCell = dataDS.Rows[i - 1].Cells[0]; dataDS.CurrentRow.Selected = true; } txtTotalWeight.Text = list.Sum(u => u.ProductWeight) != 0 ? list.Sum(u => u.ProductWeight).ToString("#,###") : "0"; }