private void btnPush_Click(object sender, EventArgs e) { string kmpCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colCode)); string phongbanCode = TextUtils.ToString(grvPhongBan.GetFocusedRowCellValue(colPBCode)); if (kmpCode == "" || phongbanCode == "") { return; } string sql = "SELECT top 1 * from V_DM_PHANXUONG_KMP_LINK where C_MA = '" + kmpCode + "' order by [C_MA]"; DataTable dt = LibIE.Select(sql); if (dt.Rows.Count > 0) { //MessageBox.Show("Khoản mục phí này đã được gán cho phòng (" + TextUtils.ToString(dt.Rows[0]["PHANXUONG_MA"]) + " - " + TextUtils.ToString(dt.Rows[0]["PHANXUONG_TEN"]) + ")" // , TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); //return; int id = TextUtils.ToInt(dt.Rows[0]["ID"]); T_DM_PHANXUONG_KMP_LinkModel link = (T_DM_PHANXUONG_KMP_LinkModel)T_DM_PHANXUONG_KMP_LinkBO.Instance.FindByPK(id); link.PK_KMP = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); link.PK_PHANXUONG = TextUtils.ToInt(grvPhongBan.GetFocusedRowCellValue(colPBID)); T_DM_PHANXUONG_KMP_LinkBO.Instance.Update(link); } else { T_DM_PHANXUONG_KMP_LinkModel link = new T_DM_PHANXUONG_KMP_LinkModel(); link.PK_KMP = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); link.PK_PHANXUONG = TextUtils.ToInt(grvPhongBan.GetFocusedRowCellValue(colPBID)); T_DM_PHANXUONG_KMP_LinkBO.Instance.Insert(link); } loadLink(); }
protected T_DM_PHANXUONG_KMP_LinkFacade(T_DM_PHANXUONG_KMP_LinkModel model) : base(model) { }