private void btnCopy_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { mTable = new POS_Area(); txtCode.Focus(); txtCode.SelectAll(); NewRecord = true; ID = 0; var user = db.Users.FirstOrDefault(c => c.ID == Settings.CurrentUser_ID && c.Branch_ID == Settings.CurrentBranch_ID); lblUserCreate.Text = user.UserName; lblUserCreateDate.Text = DateTime.Now.ToString(); lblUserLastModified.Text = string.Empty; lbllblUserLastModifiedDate.Text = string.Empty; }
private void Retrieve(long id) { int position = lookup.IndexOf(lookup.Find(c => c.ID == id)); if (position > -1) { dataNavigator1.Position = position; } mTable = db.POS_Area.Find(id); if (mTable == null) { btn_AddNew_ItemClick(null, null); return; } NewRecord = false; txtCode.Text = mTable.AreaCode; txtName.Text = mTable.AreaName; var user = db.Users.FirstOrDefault(c => c.ID == mTable.UserCreate && c.Branch_ID == Settings.CurrentBranch_ID); lblUserCreate.Text = user.UserName; lblUserCreateDate.Text = mTable.CreationDate.ToString(); user = db.Users.FirstOrDefault(c => c.ID == mTable.UserLastModified && c.Branch_ID == Settings.CurrentBranch_ID); if (user != null) { lblUserLastModified.Text = user.UserName; } else { lblUserLastModified.Text = ""; } lbllblUserLastModifiedDate.Text = mTable.LastModified.ToString(); }