private void gvRooms_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { int index = this.gvRooms.RowCount - 1; rooms[index].BuildingCode = this.txtBuildingCode.Text; rooms[index].RoomCode = this.txtBuildingCode.Text + this.rooms[index].RoomNumber.ToString(); rooms[index].Deactivated = false; gvRooms.DataSource = rooms1; gvRooms.DataSource = rooms; }
private void gridUnits_UserDeletedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { //Helper.ShowInformation("gridUnits_UserDeletedRow"); //Unit currentUnit = new Unit(); //currentUnit = (Unit)e.Row.DataBoundItem; //if (currentUnit != null) //{ // EQ_MainForm.dbContext.Units.Remove(currentUnit); // EQ_MainForm.dbContext.SaveChanges(); //} }
private void gridEQCategory_UserDeletedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { //Helper.ShowInformation("gridEQCategory_UserDeletedRow"); //EQ_Categories currentEQCategory = new EQ_Categories(); //currentEQCategory = (EQ_Categories)e.Row.DataBoundItem; //if (currentEQCategory != null) //{ // EQ_MainForm.dbContext.EQ_Categories.Remove(currentEQCategory); // EQ_MainForm.dbContext.SaveChanges(); //} }
private void gridDepartments_UserDeletedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { //Helper.ShowInformation("gridDepartments_UserDeletedRow"); Department currentDept = new Department(); currentDept = (Department)e.Row.DataBoundItem; if (currentDept != null) { EQ_MainForm.dbContext.Departments.Remove(currentDept); EQ_MainForm.dbContext.SaveChanges(); } }
private void gridRoles_UserDeletedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { //Helper.ShowInformation("gridRoles_UserDeletedRow"); Role currentRole = new Role(); currentRole = (Role)e.Row.DataBoundItem; if (currentRole != null) { EQ_MainForm.dbContext.Roles.Remove(currentRole); EQ_MainForm.dbContext.SaveChanges(); } }
private void gridCoType_UserDeletedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { //Helper.ShowInformation("gridCoType_UserDeletedRow"); CoType currentCoType = new CoType(); currentCoType = (CoType)e.Row.DataBoundItem; //EQ_MainForm.dbContext.CoTypes.FirstOrDefault(ct => ct.CoType_ID == cotypeID); if (currentCoType != null) { EQ_MainForm.dbContext.CoTypes.Remove(currentCoType); EQ_MainForm.dbContext.SaveChanges(); } }
private void gridEQCategory_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { //EQ_Categories newEQCategory = new EQ_Categories(); //newEQCategory.Code = Helper.ConvertToString(e.Row.Cells["Code"].Value); //newEQCategory.Name = Helper.ConvertToString(e.Row.Cells["Name"].Value); //newEQCategory.Description = Helper.ConvertToString(e.Row.Cells["Description"].Value); //if (Helper.ConvertToString(e.Row.Cells["Active"].Value) != string.Empty) // newEQCategory.Active = (bool)e.Row.Cells["Active"].Value; //else newEQCategory.Active = false; //newEQCategory.UpdatedDate = DateTime.Now; //EQ_MainForm.dbContext.EQ_Categories.Add(newEQCategory); //EQ_MainForm.dbContext.SaveChanges(); //InitData(); // rebound datasource //Helper.ShowInformation("A new Equipment CATEGORY has been created under line " + (e.Row.Index + 1).ToString()); }
private void gridUnits_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { //Unit newUnit = new Unit(); //newUnit.UCode = Helper.ConvertToString(e.Row.Cells["UCode"].Value); //newUnit.UName = Helper.ConvertToString(e.Row.Cells["UName"].Value); //newUnit.UGroup = Helper.ConvertToString(e.Row.Cells["UGroup"].Value); //if (Helper.ConvertToString(e.Row.Cells["Active"].Value) != string.Empty) // newUnit.Active = (bool)e.Row.Cells["Active"].Value; //else newUnit.Active = false; //newUnit.UNotes = Helper.ConvertToString(e.Row.Cells["UNotes"].Value); //newUnit.UpdatedDate = DateTime.Now; //EQ_MainForm.dbContext.Units.Add(newUnit); //EQ_MainForm.dbContext.SaveChanges(); //InitData(); //to rebound the datasource for the grid (actually the grid doesn't reflect the new created ID of new item) //Helper.ShowInformation("A new UNIT has been created under line " + (e.Row.Index + 1).ToString()); }
private void gridRoles_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { Role newRole = new Role(); newRole.RoleCode = Helper.ConvertToString(e.Row.Cells["RoleCode"].Value); newRole.RoleName = Helper.ConvertToString(e.Row.Cells["RoleName"].Value); newRole.Description = Helper.ConvertToString(e.Row.Cells["Description"].Value); if (Helper.ConvertToString(e.Row.Cells["Active"].Value) != string.Empty) { newRole.Active = (bool)e.Row.Cells["Active"].Value; } else { newRole.Active = false; } newRole.UpdatedDate = DateTime.Now; EQ_MainForm.dbContext.Roles.Add(newRole); EQ_MainForm.dbContext.SaveChanges(); InitData(); // rebound datasource Helper.ShowInformation("A new ROLE has been created under line " + (e.Row.Index + 1).ToString()); }
private void gridCoType_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { CoType newCoType = new CoType(); newCoType.CoCode = Helper.ConvertToString(e.Row.Cells["CoCode"].Value); newCoType.CoName = Helper.ConvertToString(e.Row.Cells["CoName"].Value); newCoType.CoNotes = Helper.ConvertToString(e.Row.Cells["CoNotes"].Value); if (Helper.ConvertToString(e.Row.Cells["Active"].Value) != string.Empty) { newCoType.Active = (bool)e.Row.Cells["Active"].Value; } else { newCoType.Active = false; } newCoType.UpdatedDate = DateTime.Now; EQ_MainForm.dbContext.CoTypes.Add(newCoType); EQ_MainForm.dbContext.SaveChanges(); InitData(); // rebound datasource Helper.ShowInformation("A new COMPANY-TYPE has been created under line " + (e.Row.Index + 1).ToString()); }
private void gridDepartments_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { Department newDepartment = new Department(); newDepartment.DeptCode = Helper.ConvertToString(e.Row.Cells["DeptCode"].Value); newDepartment.DeptName = Helper.ConvertToString(e.Row.Cells["DeptName"].Value); //newDepartment.ParentID = -1; newDepartment.DeptNotes = Helper.ConvertToString(e.Row.Cells["DeptNotes"].Value); if (Helper.ConvertToString(e.Row.Cells["Active"].Value) != string.Empty) { newDepartment.Active = (bool)e.Row.Cells["Active"].Value; } else { newDepartment.Active = false; } newDepartment.UpdatedDate = DateTime.Now; EQ_MainForm.dbContext.Departments.Add(newDepartment); EQ_MainForm.dbContext.SaveChanges(); InitData(); // rebound datasource Helper.ShowInformation("A new DEPARTMENT has been created under line " + (e.Row.Index + 1).ToString()); }
private void MasterTemplate_UserDeletedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { MessageBox.Show("krai"); }
private void MasterTemplate_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e) { MessageBox.Show(e.Row.Cells[1].Value.MakeString()); }