Ejemplo n.º 1
0
        private void btnAddVTofM_Click(object sender, EventArgs e)
        {
            grvVTofM.FocusedRowHandle = -1;
            string folderCode = TextUtils.ToString(grvModule1.GetFocusedRowCellValue("FolderCode"));

            if (folderCode == "")
            {
                return;
            }
            DataTable dt = (DataTable)grdVTofM.DataSource;

            DataRow[] drsQty = dt.Select("Check = 1 and (Qty = 0 or Qty is null)");
            if (drsQty.Length > 0)
            {
                MessageBox.Show("Bạn phải nhập số lượng vật tư", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            DataRow[] drs = dt.Select("Check = 1");
            for (int i = 0; i < drs.Length; i++)
            {
                decimal qty = TextUtils.ToDecimal(drs[i]["Qty"]);
                if (qty == 0)
                {
                    continue;
                }
                string    partsId = TextUtils.ToString(drs[i]["PartsId"]);
                DataTable dtLink  = LibQLSX.Select("select top 1 ID from PartsNotDMVT where PartsId='" + partsId + "' and ModuleCode='" + folderCode + "'");
                if (dtLink.Rows.Count > 0)
                {
                    continue;
                }
                PartsNotDMVTModel pcl = new PartsNotDMVTModel();
                pcl.PartsId    = partsId;
                pcl.ModuleCode = folderCode;
                pcl.Qty        = qty;
                PartsNotDMVTBO.Instance.Insert(pcl);
            }
            loadPartsNotDMVT();
            loadVT1();
        }
Ejemplo n.º 2
0
 protected PartsNotDMVTFacade(PartsNotDMVTModel model) : base(model)
 {
 }