private void bindAllgroup() { OracleQuery2 cc2 = new OracleQuery2(); DataTable _dtgroup = cc2.LoadAllGroups(); DataTable dtgroup = _dtgroup.Select("GROUP_LEVEL >2").Length > 0 ? _dtgroup.Select("GROUP_LEVEL >2").CopyToDataTable() : _dtgroup.Clone(); dtgroup.Columns.Add("text"); dtgroup.Columns.Add("text_grp"); foreach (DataRow r in dtgroup.Rows) { r["text"] = r["DEPARTMENT"] + " - " + r["GROUP_NAME"]; r["text_grp"] = r["GROUP_NAME"]; } DataView view = new DataView(dtgroup.Select("MASTER_GROUP_ID <> GROUP_ID ").CopyToDataTable()); DataTable distinctValues = view.ToTable(true, "text_grp"); GroupList.DataSource = distinctValues; GroupList.DataTextField = "text_grp"; GroupList.DataValueField = "text_grp"; GroupList.DataBind(); GroupList.Items.Insert(0, new ListItem("--ทั้งหมด--", "-1")); GroupList.SelectedIndex = 0; GroupList_selectall.DataSource = dtgroup; GroupList_selectall.DataTextField = "text"; GroupList_selectall.DataValueField = "GROUP_ID"; GroupList_selectall.DataBind(); GroupList_selectall.Items.Insert(0, new ListItem("--กรุณาเลือกกลุ่ม--", "-11")); //GroupList_selectall.Items.Insert(1, new ListItem("--ทั้งหมด--", "0")); GroupList_selectall.SelectedIndex = 0; }
private void BindGroups(Group group) { IList <Group> groups = GroupDataSource.LoadAll("Name"); groups.RemoveAt(groups.IndexOf(group)); GroupList.DataSource = groups; GroupList.DataBind(); }
protected void BindGroups() { GroupListPanel.Visible = (UseGroupRestriction.SelectedIndex > 0); if (GroupListPanel.Visible) { GroupList.DataSource = GroupDataSource.LoadAll("Name"); GroupList.DataBind(); } }
public override void DataBind() { base.DataBind(); GroupList.DataSource = Controller.GetGroups(); GroupList.DataBind(); btnCreateGroup.PostBackUrl = ServerModel.Forms.BuildRedirectUrl(new CreateGroupController { BackUrl = Request.RawUrl }); }
protected void OkBtn_Click(object sender, EventArgs e) { DataSourceSelectArguments pArguments = new DataSourceSelectArguments(); SqlDominio.Select(pArguments); SqlGrupo.Select(pArguments); DeleteBtn.Visible = (SuperID.Text == "medlinknet"); DomainList.DataBind(); GroupList.DataBind(); }
protected void BindGroups() { GroupListPanel.Visible = (UseGroupRestriction.SelectedIndex > 0); if (GroupListPanel.Visible) { GroupList.DataSource = GroupDataSource.LoadAll("Name"); GroupList.DataBind(); foreach (CommerceBuilder.Users.Group item in _ShipMethod.Groups) { ListItem listItem = GroupList.Items.FindByValue(item.Id.ToString()); if (listItem != null) { listItem.Selected = true; } } } }
protected void BindGroups() { GroupListPanel.Visible = (UseGroupRestriction.SelectedIndex > 0); if (GroupListPanel.Visible) { GroupList.DataSource = GroupDataSource.LoadAll("Name"); GroupList.DataBind(); foreach (Group group in _VolumeDiscount.Groups) { ListItem listItem = GroupList.Items.FindByValue(group.Id.ToString()); if (listItem != null) { listItem.Selected = true; } } } }
private void bindGroupList() { OracleQuery2 cc2 = new OracleQuery2(); DataTable dtgroup = cc2.LoadAllGroups(); dtgroup.Columns.Add("text"); foreach (DataRow r in dtgroup.Rows) { r["text"] = r["DEPARTMENT"] + " - " + r["GROUP_NAME"]; } GroupList.DataSource = dtgroup; GroupList.DataTextField = "text"; GroupList.DataValueField = "GROUP_ID"; GroupList.DataBind(); GroupList.Items.Insert(0, new ListItem("--ทั้งหมด--", "-1")); GroupList.SelectedIndex = 0; }
protected void BindGroups() { PaymentMethod _PaymentMethod = PaymentMethodDataSource.Load(PaymentMethodId); GroupListPanel.Visible = (UseGroupRestriction.SelectedIndex > 0); if (GroupListPanel.Visible) { GroupList.DataSource = GroupDataSource.LoadAll("Name"); GroupList.DataBind(); foreach (Group r in _PaymentMethod.Groups) { ListItem item = GroupList.Items.FindByValue(r.Id.ToString()); if (item != null) { item.Selected = true; } } } }
public override void DataBind() { base.DataBind(); var groups = ServerModel.DB.Load <TblGroups>(ServerModel.DB.LookupMany2ManyIds <TblGroups>(Controller.User, null)); GroupList.DataSource = Controller.GetGroups(); GroupList.DataBind(); var userName = Controller.User.DisplayName; lbUserGroups.Text = (GroupList.Visible = groups.Count > 0) ? string.Format("{0} participating in following groups:", userName) : string.Format("{0} are not participating in any groups", userName); lbUserRoles.Text = Title = "Edit User Profile - " + userName; btnInclude.PostBackUrl = ServerModel.Forms.BuildRedirectUrl(new Admin_SelectGroupController { UserID = Controller.User.ID, Operation = SELECT_GROUP_OPERATION.INCLUDE, BackUrl = Request.RawUrl }); }
protected void Page_Init() { IList <TaxCode> taxCodes = TaxCodeDataSource.LoadAll(); TaxCodes.DataSource = taxCodes; TaxCodes.DataBind(); TaxCode.Items.Clear(); TaxCode.Items.Add(""); TaxCode.DataSource = taxCodes; TaxCode.DataBind(); ZoneList.DataSource = ShipZoneDataSource.LoadAll("Name"); ZoneList.DataBind(); GroupList.DataSource = GroupDataSource.LoadAll("Name"); GroupList.DataBind(); // ROUNDING RULE RoundingRule.Items.Clear(); RoundingRule.Items.Add(new ListItem("Common Method", ((int)CommerceBuilder.Taxes.RoundingRule.Common).ToString())); RoundingRule.Items.Add(new ListItem("Round to Even", ((int)CommerceBuilder.Taxes.RoundingRule.RoundToEven).ToString())); RoundingRule.Items.Add(new ListItem("Always Round Up", ((int)CommerceBuilder.Taxes.RoundingRule.AlwaysRoundUp).ToString())); }
protected void Page_Load(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Msg", "window.parent.changewin();", true); strinfo.InnerHtml = ""; strinfo.Visible = false; if (!IsPostBack) { if (!Code.SessionBox.CheckUserSession()) { Response.Redirect("~/Login.aspx"); } else { //初始化模块权限 Code.UserHandle.InitModule("admin_RolesPage"); //是否有浏览权限 if (Code.UserHandle.ValidationHandle(Code.Tag.Browse)) { if (!Code.UserHandle.ValidationHandle(Code.Tag.Add)) { addpanel.Visible = false; } btn_add.Attributes.Add("onclick", "return CheckAdd()");//加入验证 //绑定组信息 BLL.BASE_GROUP Groupbll = new BLL.BASE_GROUP(); GroupList.DataSource = Groupbll.GetGroupList("GroupType=1", "order by GroupOrder asc"); GroupList.DataTextField = "GroupName"; GroupList.DataValueField = "GroupID"; GroupList.DataBind(); GroupList.Items.Insert(0, new ListItem("全部", "all")); BindOrder(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Global.CurrentPerson == null || string.IsNullOrEmpty(Request.QueryString["Series"])) { Response.Redirect("Index.aspx"); } SeriesId = long.Parse(Request.QueryString["Series"]); DataTable eventTable = new DataTable(); List <Models.Event> eventModel = new List <Models.Event>(); DataTable requestsTable = new DataTable(); List <Models.GroupRequest> requestsModel = new List <Models.GroupRequest>(); using (OracleConnection objConn = new OracleConnection(Global.ConnectionString)) { // Set up the getEvent command var eventCommand = new OracleCommand("TICKETS_QUERIES.getEvent", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure }; eventCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue); eventCommand.Parameters.Add("p_SeriesId", OracleDbType.Int64, SeriesId, ParameterDirection.Input); // Set up the getGroupRequestsForEvent command var requestsCommand = new OracleCommand("TICKETS_QUERIES.getAcceptedGroupForEvent", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure }; requestsCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue); requestsCommand.Parameters.Add("p_SeriesId", OracleDbType.Int64, SeriesId, ParameterDirection.Input); requestsCommand.Parameters.Add("p_PersonId", OracleDbType.Int64, Global.CurrentPerson.person_id, ParameterDirection.Input); try { // Execute the queries and auto map the results to models objConn.Open(); var eventAdapter = new OracleDataAdapter(eventCommand); eventAdapter.Fill(eventTable); eventModel = Mapper.DynamicMap <IDataReader, List <Models.Event> >(eventTable.CreateDataReader()); var requestsAdapter = new OracleDataAdapter(requestsCommand); requestsAdapter.Fill(requestsTable); requestsModel = Mapper.DynamicMap <IDataReader, List <Models.GroupRequest> >(requestsTable.CreateDataReader()); } catch (Exception) { Response.Redirect("EventSignup.aspx?Series=" + SeriesId); } objConn.Close(); } if (eventModel.Any()) { var currentEvent = eventModel.FirstOrDefault(); EventName.InnerHtml = currentEvent.name; EventDescription.Text = currentEvent.description; EventLocation.Text = currentEvent.building; EventDateList.DataSource = eventModel; EventDateList.DataBind(); } if (requestsModel.Any()) { var leaderInformation = requestsModel.First(); GroupLeaderName.Text = string.Format("{0} {1}", leaderInformation.group_leader_firstname, leaderInformation.group_leader_lastname); GuestTickets = leaderInformation.guest_tickets; GroupList.DataSource = requestsModel; GroupList.DataBind(); } else { Response.Redirect("EventSignup.aspx?Series=" + SeriesId); } } }
/// <summary> /// Bind data for this control. /// </summary> private void BindData() { // load available images from images/medals folder using (DataTable dt = new DataTable("Files")) { // create structure dt.Columns.Add("FileID", typeof(long)); dt.Columns.Add("FileName", typeof(string)); dt.Columns.Add("Description", typeof(string)); // add blank row DataRow dr = dt.NewRow(); dr["FileID"] = 0; dr["FileName"] = "../spacer.gif"; // use blank.gif for Description Entry dr["Description"] = "Select Medal Image"; dt.Rows.Add(dr); // add files from medals folder DirectoryInfo dir = new DirectoryInfo(Request.MapPath(String.Format("{0}images/medals", YafForumInfo.ForumFileRoot))); FileInfo[] files = dir.GetFiles("*.*"); long nFileID = 1; foreach (FileInfo file in files) { string sExt = file.Extension.ToLower(); // do just images if (sExt != ".png" && sExt != ".gif" && sExt != ".jpg") { continue; } dr = dt.NewRow(); dr["FileID"] = nFileID++; dr["FileName"] = file.Name; dr["Description"] = file.Name; dt.Rows.Add(dr); } // medal image MedalImage.DataSource = dt; MedalImage.DataValueField = "FileName"; MedalImage.DataTextField = "Description"; // ribbon bar image RibbonImage.DataSource = dt; RibbonImage.DataValueField = "FileName"; RibbonImage.DataTextField = "Description"; // small medal image SmallMedalImage.DataSource = dt; SmallMedalImage.DataValueField = "FileName"; SmallMedalImage.DataTextField = "Description"; // small ribbon bar image SmallRibbonImage.DataSource = dt; SmallRibbonImage.DataValueField = "FileName"; SmallRibbonImage.DataTextField = "Description"; } // bind data to controls DataBind(); // load existing medal if we are editing one if (Request.QueryString["m"] != null) { // load users and groups who has been assigned this medal UserList.DataSource = DB.user_medal_list(null, Request.QueryString["m"]); UserList.DataBind(); GroupList.DataSource = DB.group_medal_list(null, Request.QueryString["m"]); GroupList.DataBind(); // enable adding users/groups AddUserRow.Visible = true; AddGroupRow.Visible = true; using (DataTable dt = YAF.Classes.Data.DB.medal_list(Request.QueryString["m"])) { // get data row DataRow row = dt.Rows[0]; // load flags MedalFlags flags = new MedalFlags(row["Flags"]); // set controls Name.Text = row["Name"].ToString(); Description.Text = row["Description"].ToString(); Message.Text = row["Message"].ToString(); Category.Text = row["Category"].ToString(); SortOrder.Text = row["SortOrder"].ToString(); ShowMessage.Checked = flags.ShowMessage; AllowRibbon.Checked = flags.AllowRibbon; AllowHiding.Checked = flags.AllowHiding; AllowReOrdering.Checked = flags.AllowReOrdering; // select images SelectImage(MedalImage, MedalPreview, row["MedalURL"]); SelectImage(RibbonImage, RibbonPreview, row["RibbonURL"]); SelectImage(SmallMedalImage, SmallMedalPreview, row["SmallMedalURL"]); SelectImage(SmallRibbonImage, SmallRibbonPreview, row["SmallRibbonURL"]); } using (DataTable dt = DB.group_list(PageContext.PageBoardID, null)) { // get data row DataRow row = dt.Rows[0]; AvailableGroupList.DataSource = dt; AvailableGroupList.DataTextField = "Name"; AvailableGroupList.DataValueField = "GroupID"; AvailableGroupList.DataBind(); } } else { // set all previews on blank image MedalPreview.Src = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot); RibbonPreview.Src = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot); SmallMedalPreview.Src = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot); SmallRibbonPreview.Src = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot); } }
protected void Page_Load(object sender, EventArgs e) { GuestTicketsSize.Attributes.Add("readonly", "readonly"); FacultyTicketsSize.Attributes.Add("readonly", "readonly"); if (!IsPostBack) { if (Global.CurrentPerson == null || string.IsNullOrEmpty(Request.QueryString["Series"])) { Response.Redirect("Index.aspx"); } SeriesId = long.Parse(Request.QueryString["Series"]); SeriesIdField.Value = SeriesId.ToString(); checkIfTicketsAlreadyPurchased(SeriesId); DataTable eventTable = new DataTable(); List <Models.Event> eventModel = new List <Models.Event>(); DataTable requestsTable = new DataTable(); List <Models.GroupRequest> requestsModel = new List <Models.GroupRequest>(); DataTable seasonsTable = new DataTable(); List <Models.Season> seasonsModel = new List <Models.Season>(); using (OracleConnection objConn = new OracleConnection(Global.ConnectionString)) { // Set up the getEvent command var eventCommand = new OracleCommand("TICKETS_QUERIES.getEvent", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure }; eventCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue); eventCommand.Parameters.Add("p_SeriesId", OracleDbType.Int64, SeriesId, ParameterDirection.Input); // Set up the getGroupRequestsForEvent command var requestsCommand = new OracleCommand("TICKETS_QUERIES.getGroupForEvent", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure }; requestsCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue); requestsCommand.Parameters.Add("p_SeriesId", OracleDbType.Int64, SeriesId, ParameterDirection.Input); requestsCommand.Parameters.Add("p_PersonId", OracleDbType.Int64, Global.CurrentPerson.person_id, ParameterDirection.Input); // Set up the getSeasonTickets command var seasonsCommand = new OracleCommand("TICKETS_QUERIES.getSeasonTickets", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure }; seasonsCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue); seasonsCommand.Parameters.Add("p_PersonId", OracleDbType.Int64, Global.CurrentPerson.person_id, ParameterDirection.Input); try { // Execute the queries and auto map the results to models objConn.Open(); var eventAdapter = new OracleDataAdapter(eventCommand); eventAdapter.Fill(eventTable); eventModel = Mapper.DynamicMap <IDataReader, List <Models.Event> >(eventTable.CreateDataReader()); var requestsAdapter = new OracleDataAdapter(requestsCommand); requestsAdapter.Fill(requestsTable); requestsModel = Mapper.DynamicMap <IDataReader, List <Models.GroupRequest> >(requestsTable.CreateDataReader()); var seasonsAdapter = new OracleDataAdapter(seasonsCommand); seasonsAdapter.Fill(seasonsTable); seasonsModel = Mapper.DynamicMap <IDataReader, List <Models.Season> >(seasonsTable.CreateDataReader()); } catch (Exception) { // This shouldn't happen, redirect them back to the event chosing page Response.Redirect("Index.aspx"); } objConn.Close(); } // Fill list dropdowns with data from the database if (eventModel.Count > 0) { var currentEvent = eventModel.FirstOrDefault(); BuildingKey = currentEvent.building_key; Building = currentEvent.building; BuildingKeyField.Value = BuildingKey.ToString(); EventName.InnerHtml = currentEvent.name; EventDescription.Text = currentEvent.description; EventLocation.Text = currentEvent.building; EventPrice.Text = "$" + currentEvent.regular_price; EventPrimePrice.Text = "$" + currentEvent.prime_price; eventModel.ForEach(ed => ed.friendly_date = ed.event_datetime.ToString("dddd, MMMM d - h:mm tt")); EventDateDropDown.DataTextField = "friendly_date"; EventDateDropDown.DataValueField = "event_id"; EventDateDropDown.DataSource = eventModel; EventDateDropDown.DataBind(); if (seasonsModel.Count > 0) { var season = seasonsModel.Where(s => s.season_id == currentEvent.season_id).FirstOrDefault(); if (season != null) { seasonTicketsAmount = season.ticket_count; } } } if (requestsModel.Count > 0) { GuestTickets = requestsModel.FirstOrDefault().guest_tickets; FacultyTickets = requestsModel.FirstOrDefault().faculty_tickets; RequestedTickets = requestsModel.Where(ticket => ticket.requested_id != 0).Count(); if (RequestedTickets == 0) { requestsModel.Clear(); } var error = ""; if ((error = Request.QueryString["Error"]) != null) { if (error.Equals("1")) { Error.Text = "Those seats are no longer available. Please pick new seats."; Error.Visible = true; } else if (error.Equals("2")) { Error.Text = "Could not buy extra tickets, try again later."; Error.Visible = true; } else if (error.Equals("3")) { Error.Text = "You may not have more than 10 members in your group (including yourself)."; Error.Visible = true; } } } TotalSize = GuestTickets + FacultyTickets + RequestedTickets + 1; if (TotalSize > 10) { TotalSize = 10; } GroupSize.Value = TotalSize.ToString(); GroupList.DataSource = requestsModel; GroupList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Global.CurrentPerson == null || string.IsNullOrEmpty(Request.QueryString["Series"])) { Response.Redirect("Index.aspx"); } SeriesId = long.Parse(Request.QueryString["Series"]); DataTable eventSeatsTable = new DataTable(); List <Models.EventSeats> eventSeatsModel = new List <Models.EventSeats>(); using (OracleConnection objConn = new OracleConnection(Global.ConnectionString)) { // Set up the getEventSeats command var eventSeatsCommand = new OracleCommand("TICKETS_QUERIES.getEventSeats", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure }; eventSeatsCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue); eventSeatsCommand.Parameters.Add("p_SeriesId", OracleDbType.Int64, SeriesId, ParameterDirection.Input); eventSeatsCommand.Parameters.Add("p_PersonId", OracleDbType.Int64, Global.CurrentPerson.person_id, ParameterDirection.Input); try { // Execute the queries and auto map the results to models objConn.Open(); var eventSeatsAdapter = new OracleDataAdapter(eventSeatsCommand); eventSeatsAdapter.Fill(eventSeatsTable); eventSeatsModel = Mapper.DynamicMap <IDataReader, List <Models.EventSeats> >(eventSeatsTable.CreateDataReader()); } catch (Exception) { Response.Redirect("EventSignup.aspx?Series=" + SeriesId); } objConn.Close(); // If the person already has tickets, redirect them to the page where they can review it if (eventSeatsModel.Any()) { Event.Text = eventSeatsModel.FirstOrDefault().name; Date.InnerText = eventSeatsModel.FirstOrDefault().event_datetime.ToString("dddd, MMMM d - h:mm tt"); Section.InnerText = eventSeatsModel.FirstOrDefault().description; string location = "Row "; location += eventSeatsModel.FirstOrDefault().seat_row + ", "; if (eventSeatsModel.Count > 1) { location += "Seats "; location += eventSeatsModel.Min(t => t.seat_number).ToString() + "-"; location += eventSeatsModel.Max(t => t.seat_number).ToString(); } else { location += "Seat "; location += eventSeatsModel.FirstOrDefault().seat_number.ToString(); } Location.InnerText = location; Door.InnerText = "Enter By Door " + eventSeatsModel.FirstOrDefault().door; try { var leaderInformation = eventSeatsModel.First(t => t.leader == 1); LeaderName = string.Format("{0} {1}", leaderInformation.firstname, leaderInformation.lastname); GuestTickets = leaderInformation.guest_tickets; FacultyTickets = leaderInformation.faculty_tickets; eventSeatsModel.RemoveAll(t => t.leader == 1); GroupList.DataSource = eventSeatsModel; GroupList.DataBind(); if (GuestTickets + FacultyTickets > 0 && eventSeatsModel.Any()) { Divider.Visible = true; } } catch { // This means that there was no group, this person is by himself } } else { Response.Redirect("EventSignup.aspx?Series=" + SeriesId); } } }