Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string userID = TextUtils.ToString(cboUser.EditValue);

            if (userID == "")
            {
                return;
            }
            string userName = TextUtils.ToString(grvCboUser.GetFocusedRowCellValue(colFullName));

            int[] listHandle = grvM.GetSelectedRows();
            int   count      = 0;

            foreach (int i in listHandle)
            {
                long linkID = TextUtils.ToInt64(grvM.GetRowCellValue(i, colMLinkID));
                PartUserLinkModel linkModel = new PartUserLinkModel();
                if (linkID > 0)
                {
                    linkModel = (PartUserLinkModel)PartUserLinkBO.Instance.FindByPK(linkID);
                }
                linkModel.UserId  = userID;
                linkModel.PartsId = TextUtils.ToString(grvM.GetRowCellValue(i, colMPartsId));
                if (linkID > 0)
                {
                    PartUserLinkBO.Instance.Update(linkModel);
                }
                else
                {
                    PartUserLinkBO.Instance.Insert(linkModel);
                }

                grvM.SetRowCellValue(i, colMLinkID, linkID);
                grvM.SetRowCellValue(i, colMUserId, userID);
                grvM.SetRowCellValue(i, colMUserName, userName);
                count++;
            }
            if (count > 0)
            {
                MessageBox.Show("Lưu trữ thành công!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 2
0
 protected PartUserLinkFacade(PartUserLinkModel model) : base(model)
 {
 }