Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int pk_KMP = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID));

            if (pk_KMP == 0)
            {
                return;
            }

            DataTable dt = (DataTable)grdLink.DataSource;

            DataRow[] drs = dt.Select("TYLE > 0");
            if (drs.Length == 0)
            {
                MessageBox.Show("Bạn chưa cấu hình tỷ lệ phân bổ cho chi phí này.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            for (int i = 0; i < grvLink.RowCount - 1; i++)
            {
                //if (TextUtils.ToDecimal(grvLink.GetRowCellValue(i, colLinkTyLe)) == 0) continue;
                int linkID = TextUtils.ToInt(grvLink.GetRowCellValue(i, colLinkID));
                T_DM_PHANXUONG_KMPModel link = new T_DM_PHANXUONG_KMPModel();
                if (linkID > 0)
                {
                    link = (T_DM_PHANXUONG_KMPModel)T_DM_PHANXUONG_KMPBO.Instance.FindByPK(linkID);
                }

                link.PK_KMP       = pk_KMP;
                link.PK_PHANXUONG = TextUtils.ToInt(grvLink.GetRowCellValue(i, colLinkPK_PHANXUONG));
                link.TYLE         = TextUtils.ToDecimal(grvLink.GetRowCellValue(i, colLinkTyLe));

                if (linkID > 0)
                {
                    T_DM_PHANXUONG_KMPBO.Instance.Update(link);
                }
                else
                {
                    T_DM_PHANXUONG_KMPBO.Instance.Insert(link);
                }
            }
            MessageBox.Show("Lưu trữ thành công.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            loadLink();
        }
Example #2
0
 protected T_DM_PHANXUONG_KMPFacade(T_DM_PHANXUONG_KMPModel model) : base(model)
 {
 }