public static void UpdateGroup(GroupInfo groupInfo) { var grp = GetGroup(groupInfo); grp.Name = groupInfo.Name; GroupDAL.UpdateGroup(grp); }
private void dataGridViewGroups_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { //at the momment we can only edit "Description" column GroupDAL.UpdateGroup((int)dataGridViewGroups.Rows[dataGridViewGroups.SelectedCells[0].RowIndex].Cells["Group ID"].Value, dataGridViewGroups.Rows[dataGridViewGroups.SelectedCells[0].RowIndex].Cells["Description"].Value.ToString()); MessageBox.Show("Changes successfully saved!"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// To pass 'Group' data in GroupDAL Data Access Layer for updation public int UpdateGroup(int GroupId, string GroupDescription, bool IsActive, string GroupName, int LoginUser, string Ret) { GroupDAL GroupDAL = new GroupDAL(); try { return(GroupDAL.UpdateGroup(GroupId, GroupDescription, IsActive, GroupName, LoginUser, Ret)); } catch { throw; } finally { GroupDAL = null; } }
private void saveGroups() { SchoolJournalEntities context = new SchoolJournalEntities(); var groupIDs = from g in context.Groups select g.GroupID; try { foreach (DataGridViewRow r in GroupsDataGridView.Rows) { if (r.IsNewRow) { continue; } int groupID = int.Parse(GroupsDataGridView["GroupID", r.Index].Value.ToString()); if (groupIDs.Contains(groupID)) //update { GroupDAL.UpdateGroup(groupID, int.Parse(GroupsDataGridView["TeacherID", r.Index].Value.ToString()), GroupsDataGridView["Subject", r.Index].EditedFormattedValue.ToString(), GroupsDataGridView["Grade", r.Index].EditedFormattedValue.ToString(), GroupsDataGridView["Description", r.Index].Value.ToString()); } else //add new { GroupsDataGridView["GroupID", r.Index].Value = GroupDAL.NewGroup(int.Parse(GroupsDataGridView["TeacherID", r.Index].Value.ToString()), GroupsDataGridView["Subject", r.Index].EditedFormattedValue.ToString(), GroupsDataGridView["Grade", r.Index].EditedFormattedValue.ToString(), GroupsDataGridView["Description", r.Index].Value.ToString()); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { context.Dispose(); } }
// To pass 'Group' data in GroupDAL Data Access Layer for updation public int UpdateGroup(int GroupId,string GroupDescription, bool IsActive, string GroupName, int LoginUser, string Ret) { GroupDAL GroupDAL = new GroupDAL(); try { return GroupDAL.UpdateGroup(GroupId, GroupDescription,IsActive, GroupName, LoginUser, Ret); } catch { throw; } finally { GroupDAL = null; } }
internal int UpdateGroup(Inv_ProductGroup groupObj, int groupId) { return(groupDal.UpdateGroup(groupId, groupObj)); }
public static void UpdateGroup(string ID, string GroupName, int leadID) { GroupDAL.UpdateGroup(GroupName, leadID, int.Parse(ID)); }