private void btnSetVTPtoProject_Click(object sender, EventArgs e) { string projectId = TextUtils.ToString(cboProject.EditValue); if (projectId == "") { MessageBox.Show("Bạn phải chọn một dự án.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } DataTable dtlink = LibQLSX.Select("select top 1 ID from PartsGeneralProjectLink where ProjectId = '" + projectId + "'"); if (dtlink.Rows.Count > 0) { MessageBox.Show("Dự án này đã được phân bổ vật tư phụ.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (grvData.RowCount == 0) { MessageBox.Show("Khổng có vật tư phụ nào để chuyển cho dự án.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } for (int i = 0; i < grvData.RowCount; i++) { string partsId = TextUtils.ToString(grvData.GetRowCellValue(i, colPartsId)); decimal qty = TextUtils.ToDecimal(grvData.GetRowCellValue(i, colQty)); PartsGeneralProjectLinkModel model = new PartsGeneralProjectLinkModel(); model.ProjectId = projectId; model.PartsId = partsId; model.Qty = qty; model.QtyBuyDA = TextUtils.ToDecimal(grvData.GetRowCellValue(i, colQtyBuyDA)); model.QtyBuyKho = TextUtils.ToDecimal(grvData.GetRowCellValue(i, colQtyBuyKho)); model.QtyXuat = TextUtils.ToDecimal(grvData.GetRowCellValue(i, colQtyXuat)); PartsGeneralProjectLinkBO.Instance.Insert(model); //PartsGeneralModel g = (PartsGeneralModel)PartsGeneralBO.Instance.FindByAttribute("PartsId", partsId)[0]; //g.Qty -= qty; //PartsGeneralBO.Instance.UpdateQLSX(g); } MessageBox.Show("Xác nhận vật tư phụ cho dự án thành công.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information); }
protected PartsGeneralProjectLinkFacade(PartsGeneralProjectLinkModel model) : base(model) { }