private int UpdateUserGroupDetails() { try { UserGroups ug = new UserGroups(); ug.GroupId = Convert.ToInt32(hdngroupid.Value); ug.Groupcode = txtGroupCode.Text; ug.GroupName = txtGroupName.Text; ug.LastUserID = Convert.ToInt32(Session["UserID"]); user_dll = new UsersDLL(); return(user_dll.UpdateUserGroup(ug)); } catch (Exception ex) { ErrorMessage(ex.Message); return(0); } }
public int AddUserGroupDetails() { try { UserGroups ug = new UserGroups(); ug.Groupcode = txtGroupCode.Text; // ug.GroupId = Convert.ToInt32(txtGroupID.Text); ug.GroupName = txtGroupName.Text; ug.CreatedBy = Convert.ToInt32(Session["UserID"]); ug.LastUserID = Convert.ToInt32(Session["UserID"]); user_dll = new UsersDLL(); return(user_dll.AddUserGroup(ug)); } catch (Exception ex) { ErrorMessage("Adding user group error:2 " + ex.Message); return(0); } }
public int UpdateUserGroup(UserGroups ug) { try { conn.Open(); SqlCommand cmd = new SqlCommand("dbo.spUpdateUserGroup", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@GROUPID", ug.GroupId); cmd.Parameters.AddWithValue("@GROUPCODE", ug.Groupcode); cmd.Parameters.AddWithValue("@GROUPNAME", ug.GroupName); cmd.Parameters.AddWithValue("@LASTUSERID", ug.LastUserID); return(cmd.ExecuteNonQuery()); } catch (Exception ex) { return(0); throw ex; } finally { conn.Close(); } }