private void btnSave_Click(object sender, EventArgs e) { if (IsValidScreen()) { try { Table<ItemCategory> itemCategories = dc.GetTable<ItemCategory>(); AssignProperties(); if (_itemCategory.ItemCategoryID == 0) { _itemCategory.CreatedBy = LoggedClientProfile.UserProfileID; _itemCategory.DateCreated = System.DateTime.Now; _itemCategory.PCCreated = LoggedClientProfile.UserPCID; _itemCategory.IsDeleted = false; itemCategories.InsertOnSubmit(_itemCategory); } dc.SubmitChanges(); MessageBox.Show("Successfully Saved."); dc = new dcInventoryDataContext(); ClearScreen(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } }
private void buttonReset_Click(object sender, EventArgs e) { dc = new dcInventoryDataContext(); _userProfile = new UserProfile(); textBoxUserName.Enabled = true; textBoxUserName.Text = string.Empty; textBoxPassword.Text = string.Empty; textBoxConfirmPassword.Text = string.Empty; comboBoxType.SelectedIndex = -1; textBoxFullName.Text = string.Empty; textBoxFullName.Focus(); }
private void ClearScreen() { groupBoxItem.Text = "New Item"; txt_Item_Code.Text=string.Empty; txt_Item_Code.Enabled = true; txtDescription.Text=string.Empty; textBoxBillName.Text = string.Empty; cmbItemCategry.Text = string.Empty; txtPackDate.Text = string.Empty; dc = new dcInventoryDataContext(); _item = new Item(); GetNextItemCodeNumber(); }