コード例 #1
0
    private static void generate_bullets(string _data, BulletedList List_Director_id)
    {
        string[] List_Director = _data.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

        List_Director_id.DataSource = List_Director;
        List_Director_id.DataBind();
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LinkButton btnHome = (LinkButton)Master.FindControl("btnHome");

        btnHome.Click += (s, a) => Response.Redirect("Default.aspx");
        BulletedList topMenu = (BulletedList)Master.FindControl("topMenu");

        topMenu.Click += (s, a) => Response.Redirect("AddStudent.aspx");
        if (!IsPostBack)
        {
            topMenu.Items.Add(new ListItem("Add Student Records"));
        }
        List <Course> courses = Session["courses"] as List <Course>;

        if (courses == null)
        {
            courses            = new List <Course>();
            Session["courses"] = courses;
        }
        string sort = Request.Params["sort"];

        if (!string.IsNullOrEmpty(sort))
        {
            ShowCourseInfo(courses, sort);
        }
        else
        {
            ShowCourseInfo(courses);
        }
    }
コード例 #3
0
        protected void commitList_Click(object sender, BulletedListEventArgs e)
        {
            BulletedList list       = (BulletedList)sender;
            string       branchName = "";

            branchName = list.Items[e.Index].Value;
        }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //SET UP SESSION VARIABLES
        //list for students added to a course
        List <AcademicRecord> records = (List <AcademicRecord>)Session["records"];
        //list of courses added on last page
        List <Course> courses = (List <Course>)Session["courses"];
        //course chosen to add to
        Course selectedCourse = (Course)Session["selectedCourse"];

        //BUTTONS IN HEADER
        LinkButton btnHome = (LinkButton)Master.FindControl("btnHome");

        btnHome.Click += (s, a) => Response.Redirect("Default.aspx");
        BulletedList topMenu = (BulletedList)Master.FindControl("topMenu");


        if (!IsPostBack)
        {
            topMenu.Items.Add(new ListItem("AddCourses"));
            //topMenu.Items.Add(new ListItem("Add Student Records"));

            //PROPAGATE DROPDOWN LIST WITH COURSES FROM COURSE LIST
            if (courses != null)
            {
                foreach (Course c in courses)
                {
                    dropdownCourseList.Items.Add(c.ToString());
                }
            }
        }
        topMenu.Click += topMenu_Click;
    }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LinkButton   btnHome    = (LinkButton)Master.FindControl("btnHome");
            BulletedList btnTopMenu = (BulletedList)Master.FindControl("topMenu");

            btnHome.Click    += (s, a) => Response.Redirect("Default.aspx");
            btnTopMenu.Click += (s, a) => Response.Redirect("AddCourses.aspx");

            if (!IsPostBack)
            {
                btnTopMenu.Items.Add(new ListItem("Add Courses"));

                using (StudentRecordEntities entities = new StudentRecordEntities())
                {
                    List <Course> courses = entities.Courses.ToList <Course>();

                    if (Session["courses"] == null)
                    {
                        Session["courses"] = courses;
                    }

                    foreach (Course course in courses)
                    {
                        drpCourseSelection.Items.Add(new ListItem(course.Code + " - " + course.Title, course.Code));
                    }

                    displayStudentRecordTable(null);
                }
            }
        }
コード例 #6
0
ファイル: SubMenu.cs プロジェクト: MarkManYUN/WALLE-Project
        /// <summary>
        /// 重写application前台导航栏的内容
        /// </summary>
        public static void ReWriteApplication()
        {
            ListItem     li;
            BulletedList bulllist = new BulletedList();

            bulllist.CssClass = "a";
            System.Data.DataSet ds = new BLL.t_menu().GetAllList();
            DataTable           dt = ds.Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                li = new ListItem();
                DataRow dr = dt.Rows[i];
                li.Text  = dr["menu_name"].ToString();
                li.Value = dr["menu_path"].ToString();

                li.Attributes.Add("class", "single_title");
                li.Attributes.Add("style", "font-size:1.5em;");
                li.Attributes.Add("classid", dr["menu_Cate_ID"].ToString());
                bulllist.Items.Add(li);
            }
            HttpContext.Current.Application.Lock();
            HttpContext.Current.Application["T_Menu"] = bulllist;
            HttpContext.Current.Application.UnLock();
        }
コード例 #7
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            BulletedList topMenu = (BulletedList)Master.FindControl("topMenu");

            topMenu.Items[1].Enabled = true;

            if (!IsPostBack)
            {
                var courses = GetCourses();

                courses.Sort((c1, c2) => c1.Code.CompareTo(c2.Code));
                foreach (Course course in courses)
                {
                    string format = course.Code + " " + course.Title;
                    CourseList.Items.Add(format);
                }
                txtStudentNum.ReadOnly  = false;
                txtStudentName.ReadOnly = false;
                CourseList.Enabled      = true;
            }
            string action = Request.Params["action"];

            ActionHandler(action);

            ShowStudentRecords();
        }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LinkButton btnHome = (LinkButton)Master.FindControl("btnHome");

        btnHome.Click += new EventHandler(delegate(Object o, EventArgs a)
        {
            Response.Redirect("Default.aspx");
        });
        BulletedList menulist = (BulletedList)Master.FindControl("topMenu");

        if (!IsPostBack)
        {
            menulist.Items.Add(new ListItem("Add Course"));
            menulist.Items.Add(new ListItem("Add Student Records"));
        }
        menulist.Click += (object o, BulletedListEventArgs args) =>
        {
            switch (args.Index)
            {
            case 0:
                Response.Redirect("AddCourse.aspx");
                break;

            case 1:
                Response.Redirect("AddStudent.aspx");
                break;
            }
        };
    }
コード例 #9
0
        private static void AddSubGroupToMenuColumn(HtmlGenericControl column, Pair currentSubGroup)
        {
            ListItem        subGroupHeader = (ListItem)currentSubGroup.First;
            List <ListItem> subGroupItems  = (List <ListItem>)currentSubGroup.Second;
            StringBuilder   headerText     = new StringBuilder(subGroupHeader.Text);

            headerText.Replace(" ", "&nbsp;");
            HtmlGenericControl subGroupHeaderControl = new HtmlGenericControl("h2");

            subGroupHeaderControl.InnerHtml = headerText.ToString();
            if (subGroupItems.Count > 0)
            {
                BulletedList subGroupList = new BulletedList();
                subGroupList.CssClass = "innerList";
                subGroupList.Items.AddRange(subGroupItems.ToArray());
                subGroupList.DisplayMode = BulletedListDisplayMode.HyperLink;
                column.Controls.Add(subGroupHeaderControl);
                column.Controls.Add(subGroupList);
            }
            else
            {
                HtmlGenericControl subGroupHeaderAnchor = new HtmlGenericControl("a");
                subGroupHeaderAnchor.Attributes.Add("href", subGroupHeader.Value);
                subGroupHeaderAnchor.Controls.Add(subGroupHeaderControl);
                column.Controls.Add(subGroupHeaderAnchor);
            }
        }
コード例 #10
0
        public static bool ProcessStartRepairDate(string startRepairDateTxt, BulletedList notificationMsgList,
                                                  out DateTime?startRepairDate)
        {
            startRepairDate = null;
            bool validStartRepairDate = string.IsNullOrEmpty(startRepairDateTxt) == false;

            if (validStartRepairDate == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Start repair date is required", notificationMsgList);
            }
            else
            {
                DateTime startRepairDateValue = DateTime.Now;
                validStartRepairDate = CarServiceUtility.IsValidDate(startRepairDateTxt, out startRepairDateValue);
                if (validStartRepairDate == true)
                {
                    startRepairDate = startRepairDateValue;
                }
                else
                {
                    CarServicePresentationUtility.AppendNotificationMsg("Start repair date is not in valid format", notificationMsgList);
                }
            }
            return(validStartRepairDate);
        }
コード例 #11
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        #region set top menu
        base.Page_Load(sender, e);
        BulletedList topMenu = (BulletedList)Master.FindControl("topMenu");
        topMenu.Items[0].Enabled = false;
        #endregion

        if (!IsPostBack)
        {
            //initial textbox values
            txtCourseName.Text       = "";
            txtCourseNumber.Text     = "";
            txtCourseNumber.ReadOnly = false;
        }

        //find object with value associated with string "action"-- in the table header string below
        string action = Request.Params["action"] as string;
        if (action == "edit")
        {
            //add and remove delegates when you click the word edit (makes it so newcourse_click will run on SaveChange_Click will run
            btnAddCourseInfo.Click -= btnNewCourse_Click;
            btnAddCourseInfo.Click += btnChangeCourseInfo_Click;
        }
        else
        {
            btnAddCourseInfo.Click -= btnChangeCourseInfo_Click;
            btnAddCourseInfo.Click += btnNewCourse_Click;
        }
    }
コード例 #12
0
 public static void ClearNotificationMsgList(BulletedList notificationMsgList)
 {
     if (notificationMsgList.Items.Count > 0)
     {
         notificationMsgList.Items.Clear();
     }
 }
コード例 #13
0
 public static void ShowNotificationMsgList(BulletedList notificationMsgList)
 {
     if (notificationMsgList.Items.Count > 0)
     {
         notificationMsgList.Visible = true;
     }
 }
コード例 #14
0
        protected void bltRME_Click(object sender, BulletedListEventArgs e)
        {
            BulletedList bltRME  = winExclusao.ContentContainer.FindControl("bltRME") as BulletedList;
            ListItem     lstItem = bltRME.Items[e.Index];

            Response.Redirect(string.Format("RMECad.aspx?registroManutencaoID={0}", lstItem.Value));
        }
コード例 #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LinkButton btnHome = (LinkButton)Master.FindControl("btnHome");

        btnHome.Click += (s, a) => Response.Redirect("Default.aspx");


        BulletedList topMenu = (BulletedList)Master.FindControl("topMenu");

        if (!IsPostBack)
        {
            topMenu.Items.Add(new ListItem("Add Courses"));
        }

        topMenu.Click += (s, a) => Response.Redirect("AddCourse.aspx");
        if (!IsPostBack)
        {
            using (StudentRecordEntities entityContext = new StudentRecordEntities())
            {
                List <Course> courses = entityContext.Courses.ToList <Course>();


                foreach (Course course in courses)
                {
                    ListItem item = new ListItem(course.Code + "-" + course.Title, course.Code);

                    DropDownListCourses.Items.Add(item);
                }
            }
        }
    }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <Course> addedCourses = null;

            // Initialize session
            if (Session["addedCourses"] == null)
            {
                addedCourses            = new List <Course>();
                Session["addedCourses"] = addedCourses;
            }
            else
            {
                addedCourses = (List <Course>)Session["addedCourses"];
            }


            LinkButton btnHome = (LinkButton)Master.FindControl("btnHome");

            btnHome.Click += (s, a) => Response.Redirect("Default.aspx");

            BulletedList topMenu = (BulletedList)Master.FindControl("topMenu");

            if (!IsPostBack)
            {
                // Add menu elements on page load
                topMenu.Items.Add(new ListItem("Add Student Records"));
            }
            // redirect user if button is clicked
            topMenu.Click += (s, a) => Response.Redirect("AddStudentsRecord.aspx");

            displayTable();
        }
コード例 #17
0
    /// <summary>
    /// 重写application的内容
    /// </summary>
    public static void reWriteApplication()
    {
        ListItem     li;
        BulletedList fulllist = new BulletedList();

        newClasses.superConn scnn = new newClasses.superConn("DATA.MDB");

        scnn.open();
        string _sql = "SELECT * FROM T_SUBMENU WHERE MENU_ENABLE=TRUE ORDER BY MENU_CLASSID,MENU_ORDER DESC";

        System.Data.OleDb.OleDbDataReader dr = scnn.GetDataReader(_sql);
        while (dr.Read())
        {
            li       = new ListItem();
            li.Text  = dr["menu_ttl"].ToString();
            li.Value = dr["menu_url"].ToString();
            li.Attributes.Add("classid", dr["menu_classid"].ToString());//增加一个classid属性
            fulllist.Items.Add(li);
        }

        scnn.close();

        HttpContext.Current.Application.Lock();
        HttpContext.Current.Application["submenu"] = fulllist;
        HttpContext.Current.Application.UnLock();
    }
コード例 #18
0
        private void LoadRowsContents(GridViewRowEventArgs e)
        {
            int           resID      = Convert.ToInt32(grdResourceList.DataKeys[e.Row.RowIndex].Value);
            BulletedList  bltoptions = (BulletedList)e.Row.FindControl("bltResOptions");
            OptionHandler opt        = new OptionHandler();
            List <Option> optlist    = opt.GetOptionListByResID(resID);

            bltoptions.DataSource    = optlist;
            bltoptions.DataTextField = "name";
            bltoptions.DataBind();

            RequestHandler reqH = new RequestHandler();
            GridView       grdRequestsPerResource = (GridView)e.Row.FindControl("grdRequestsPerResource");
            //DataTable reqList = reqH.GetRequestListBySessionDateResID(pcal1.Text, resID);
            DataTable reqList1 = reqH.GetRequestListBySessionDateResID1(pcal1.Text, resID);

            if (cbNotShowEmpty.Checked == true)
            {
                if (reqList1 != null)
                {
                    grdRequestsPerResource.DataSource = reqList1;
                    grdRequestsPerResource.DataBind();
                }
                else
                {
                    e.Row.Visible = false;
                }
            }
            else
            {
                grdRequestsPerResource.DataSource = reqList1;
                grdRequestsPerResource.DataBind();
            }
        }
コード例 #19
0
    private void DisplayOrClearValidationError(Exception exception)
    {
        try
        {
            if (exception == null)
            {
                this.divErrorPanel.InnerHtml = "";
                this.ShowOrHideValidationError(false);
                return;
            }

            // Build error message.
            HtmlGenericControl span = new HtmlGenericControl("span");
            span.InnerHtml = exception.Message;

            BulletedList errors = new BulletedList();
            errors.DataTextField = "Value";
            errors.DataSource    = exception.Data;
            errors.DataBind();

            // Add to error control.
            this.divErrorPanel.Controls.Clear();
            this.divErrorPanel.Controls.Add(span);
            this.divErrorPanel.Controls.Add(errors);

            // Show the control.
            this.ShowOrHideValidationError(true);
        }
        catch { throw; }
    }
コード例 #20
0
 protected void grdResourceList_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         RequestFR     req        = (RequestFR)ViewState["req"];
         int           resID      = Convert.ToInt32(grdResourceList.DataKeys[e.Row.RowIndex].Value);
         BulletedList  bltoptions = (BulletedList)e.Row.FindControl("bltResOptions");
         OptionHandler opt        = new OptionHandler();
         List <Option> optlist    = opt.GetOptionListByResID(resID);
         bltoptions.DataSource    = optlist;
         bltoptions.DataTextField = "name";
         bltoptions.DataBind();
         GridView grdApprovedRequestList = (GridView)e.Row.FindControl("grdApprovedRequestList");
         approvedreqlist = RequestBussiness.GetRequestListBySessionDate_resID_status(pcal1.Text, resID, 2);
         grdApprovedRequestList.DataSource = approvedreqlist;
         grdApprovedRequestList.DataBind();
         GridView                grdPendingRequestList = (GridView)e.Row.FindControl("grdRequestPendingList");
         List <RequestFR>        perl  = RequestBussiness.GetRequestListBySessionDate_resID_status(pcal1.Text, resID, 1);
         IEnumerable <RequestFR> perl1 = null;
         //if (perl != null)
         //{
         //    perl1 = perl.Where(item => (item.Sessionstart_time >= req.Sessionstart_time)
         //                            && (item.Sessionstart_time < req.Sessionend_time));
         //}
         grdPendingRequestList.DataSource = perl1;
         grdPendingRequestList.DataBind();
         ViewState.Add("req", req);
     }
 }
コード例 #21
0
    private void DisplayValidationMessage(Exception exception)
    {
        try
        {
            //claer the error message
            this.ClearErrorMessage(divMessage);
            // Create bullet.
            BulletedList error = new BulletedList();
            error.DataTextField = "value";
            error.DataSource    = exception.Data;
            error.DataBind();

            // Display message.
            HtmlGenericControl control = new HtmlGenericControl("span");
            control.InnerText = exception.Message;
            this.divMessage.Style.Add("Display", "block");
            this.divMessage.Controls.Add(control);
            this.divMessage.Controls.Add(error);
            this.UpdatePanel3.Update();

            System.Threading.Thread.Sleep(5000);


            // Show message control.
        }
        catch { throw; }
    }
コード例 #22
0
    protected void BulletedListPostOptions_Click(object sender, BulletedListEventArgs e)
    {
        BLPost blPost = new BLPost();

        BulletedList options = sender as BulletedList;
        RepeaterItem item    = options.Parent as RepeaterItem;
        Topic        topic   = GetTopic(int.Parse(HiddenFieldTopicId.Value));
        Post         post    = blPost.GetPostById(int.Parse((item.FindControl("HiddenFieldPostId") as HiddenField).Value));

        switch (options.Items[e.Index].Text.ToLowerInvariant())
        {
        case "quote":
        {
            Reply(topic, post);
            break;
        }

        case "delete":
        {
            blPost.Delete(post);
            Response.Redirect(Request.RawUrl);
            break;
        }

        default:
        {
            Response.Redirect(options.Items[e.Index].Value);
            break;
        }
        }
    }
コード例 #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LinkButton btnHome = (LinkButton)Master.FindControl("btnHome");

        btnHome.Click += (s, a) => Response.Redirect("Default.aspx");
        BulletedList topMenu = (BulletedList)Master.FindControl("topMenu");

        topMenu.Click += (s, a) => Response.Redirect("AddCourse.aspx");

        List <Course> courses = Session["courses"] as List <Course>;

        List <AcademicRecord> records = Session["records"] as List <AcademicRecord>;

        if (!IsPostBack)
        {
            topMenu.Items.Add(new ListItem("Add Course"));
            if (courses == null)
            {
                Response.Redirect("AddCourse.aspx");
            }
            if (courseList.Items.Count < courses.Count)
            {
                for (int i = 0; i < courses.Count; i++)
                {
                    courseList.Items.Add(new ListItem(courses[i].CourseName));
                }
            }
        }
        string sort = Request.Params["sort"];

        //ShowStudentInfo(records, sort);
        Table.Visible = false;
    }
コード例 #24
0
ファイル: AddCourse.aspx.cs プロジェクト: viclen/CST8256-Lab4
    protected void Page_Load(object sender, EventArgs e)
    {
        LinkButton btnHome = (LinkButton)Master.FindControl("btnHome");

        btnHome.Click += (object s, EventArgs ev) =>
        {
            Response.Redirect("Default.aspx");
        };

        BulletedList topMenu = (BulletedList)Master.FindControl("topMenu");

        topMenu.Click += (object s, BulletedListEventArgs ev) =>
        {
            switch (ev.Index)
            {
            case 0:
                Response.Redirect("AddStudent.aspx");
                break;
            }
        };
        topMenu.Items.Remove("Add Courses");

        if (topMenu.Items.Count < 1)
        {
            topMenu.Items.Add("Add Students");
        }

        loadTable();
    }
コード例 #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            {
                LinkButton   btnHome = (LinkButton)Master.FindControl("btnHome");   //instanciating Home Button
                BulletedList topMenu = (BulletedList)Master.FindControl("topMenu"); //instanciationg Top Menu
                if (!IsPostBack)
                {
                    topMenu.Items.Add(new ListItem("Add Courses"));             //adding dynamic buttons to Top Menu
                }
                topMenu.Click += (s, a) => Response.Redirect("AddCourse.aspx"); //adding action to Add Courses Button
                btnHome.Click += (s, a) => Response.Redirect("Default.aspx");   //adding action to Home Button

                if (!IsPostBack)
                {
                    if (Session["courseListSession"] != null)//diplaying table of courses
                    {
                        List <Course> courseList = new List <Course>();
                        courseList = (List <Course>)Session["courseListSession"];
                        foreach (Course item in courseList)
                        {
                            DropDownList1.Items.Add(item.ToString());
                        }
                    }
                }
            }
        }
コード例 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LinkButton   home      = (LinkButton)Master.FindControl("btnHome");
            BulletedList addCourse = (BulletedList)Master.FindControl("topMenu");

            addCourse.Items.Clear();
            addCourse.Items.Add(new ListItem("Add Course"));
            home.Click      += home_Click;
            addCourse.Click += addCourse_Click;
            if (Session["Courses"] == null)
            {
                Response.Redirect("AddCourse.aspx");
            }
            Courses = Session["Courses"] as List <Course>;
            if (!IsPostBack)
            {
                Courses.Sort((c1, c2) => c1.CourseNumber.CompareTo(c2.CourseNumber));
                foreach (Course course in Courses)
                {
                    ListItem item = new ListItem(course.ToString(), course.CourseNumber);
                    ddCourse.Items.Add(item);
                }
            }
            String sort = Request.Params["sort"];

            if (!String.IsNullOrEmpty(sort))
            {
                createStudentTable(Courses, sort);
            }
            else
            {
                createStudentTable(Courses);
            }
        }
コード例 #27
0
        private void DisplayBulletedList(BulletedList CurList, List <string> OldList, List <string> NewList)
        {
            CurList.Items.Clear();
            string ListedName = "";
            int    CurIndex, TotalItem;

            for (int i = 0; i < OldList.Count; i++)
            {
                ListedName = OldList[i];
                ListItem CurItem = new ListItem(ListedName);
                CurIndex = CurList.Items.IndexOf(CurItem);
                if ((ListedName != "") && (CurIndex < 0))
                {
                    CurList.Items.Add(ListedName);
                    TotalItem = CurList.Items.Count;
                    CurList.Items[TotalItem - 1].Attributes.Add("Style", "color:red");
                }
            }

            for (int i = 0; i < NewList.Count; i++)
            {
                ListedName = NewList[i];
                ListItem CurItem = new ListItem(ListedName);
                CurIndex = CurList.Items.IndexOf(CurItem);
                if ((ListedName != "") && (CurIndex < 0))
                {
                    CurList.Items.Add(ListedName);
                }
            }
        }
コード例 #28
0
ファイル: assign_matchups.aspx.cs プロジェクト: denpone/ffl
 private void listClass(BulletedList lst)
 {
     foreach (ListItem i in lst.Items)
     {
         i.Attributes.Add("class", "list-group-item");
     }
 }
コード例 #29
0
    private void DisplayValidationMessage(Exception exception)
    {
        try
        {
            // Create bullet.

            BulletedList error = new BulletedList();
            error.DataTextField = "value";
            error.DataSource    = exception.Data;
            error.DataBind();

            // Display message.
            HtmlGenericControl control = new HtmlGenericControl("span");
            control.InnerText = exception.Message;

            this.divMessage.Style.Add("display", "block");
            //this.divMessage.Visible = true;
            this.divMessage.InnerHtml = string.Empty;
            this.divMessage.Controls.Add(control);
            this.divMessage.Controls.Add(error);

            // Show message control.
        }
        catch { throw; }
    }
コード例 #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblErrNum.Text = "";
        LinkButton btnHome = (LinkButton)Master.FindControl("btnHome");

        btnHome.Click += (o, a) => Response.Redirect("Default.aspx");

        BulletedList menulist = (BulletedList)Master.FindControl("topMenu");

        if (!IsPostBack)
        {
            menulist.Items.Add(new ListItem("Add Course"));
            menulist.Items.Add(new ListItem("Add Student Records"));
        }
        menulist.Click += (o, a) => { if (a.Index == 1)
                                      {
                                          Response.Redirect("AddStudent.aspx");
                                      }
        };

        using (var entityContext = new StudentRecordEntities())
        {
            var courses = (from course in entityContext.Courses
                           orderby course.Code
                           select course).ToList();
        }

        DisplayCourses();
    }
コード例 #31
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LinkButton   btnHome    = (LinkButton)Master.FindControl("btnHome");
            BulletedList btnTopMenu = (BulletedList)Master.FindControl("topMenu");

            //bool sortCodeDesc = false;
            //bool sortTitleDesc = false;

            btnHome.Click    += (s, a) => Response.Redirect("Default.aspx");
            btnTopMenu.Click += (s, a) => Response.Redirect("AddStudent.aspx");

            if (!IsPostBack)
            {
                btnTopMenu.Items.Add(new ListItem("Add Student Records"));


                if (Session["courses"] == null)
                {
                    // create a courses session to save and display the initial data list from database
                    using (StudentRecordEntities entities = new StudentRecordEntities())
                    {
                        List <Course> courses = entities.Courses.ToList <Course>();
                        Session["courses"] = courses;
                        DisplayCourseTable(courses);
                    }
                }
                else
                {
                    // retrieve the courses list form session
                    List <Course> courses = (List <Course>)Session["courses"];
                    string        sort    = Request.Params["sort"];

                    if (!string.IsNullOrEmpty(sort))
                    {
                        SortCourses(courses, sort);
                    }

                    DisplayCourseTable(courses);
                }


                //if (Session["sortCode"] == null)
                //{
                //    Session["sortCode"] = sortCodeDesc;
                //}
                //else
                //{
                //    sortCodeDesc = (bool)Session["sortCode"];
                //}

                //if (Session["sortTitle"] == null)
                //{
                //    Session["sortTitle"] = sortTitleDesc;
                //}
                //else
                //{
                //    sortTitleDesc = (bool)Session["sortTitle"];
                //}
            }
        }
コード例 #32
0
    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        if (ViewState["Staff"] != null && (int)ViewState["Staff"] > 0)
        {
            e.Cell.HorizontalAlign = HorizontalAlign.Left;

            if (e.Day.Date <= DateTime.Today && MCSTabControl1.SelectedIndex == 0)
            {

                ImageButton ibt = new ImageButton();
                ibt.ImageUrl = "~/Images/gif/gif-0489.gif";
                ibt.BorderWidth = new Unit(0);
                ibt.ToolTip = "新增工作日志";
                ibt.OnClientClick = "javascript:NewJournal('" + e.Day.Date.DayOfYear.ToString() + "')";
                ibt.Click += new ImageClickEventHandler(ibt_Click);
                e.Cell.Controls.Add(ibt);
            }

            #region 获取该员工当天工作日志
            if (cbx_Journal.Checked)
            {
                IList<JN_Journal> journallists = JN_JournalBLL.GetModelList("'" + e.Day.Date.ToString("yyyy-MM-dd") + "' BETWEEN Convert(varchar(10),BeginTime,120) And EndTime AND Staff=" + ViewState["Staff"].ToString());
                if (journallists.Count > 0)
                {
                    BulletedList bt = new BulletedList();
                    foreach (JN_Journal j in journallists)
                    {
                        ListItem item = new ListItem();
                        item.Text = "";
                        if (j.JournalType == 1)
                        {
                            //日报
                            if (j.BeginTime.Hour != 0 && j.EndTime.Hour != 0)
                                item.Text += j.BeginTime.ToString("HH:mm") + "~" + j.EndTime.ToString("HH:mm") + " ";
                            if (j.WorkingClassify != 0)
                            {
                                item.Text += DictionaryBLL.GetDicCollections("OA_WorkingClassify")[j.WorkingClassify.ToString()].Name + " ";
                                switch (j.WorkingClassify)
                                {
                                    case 1://门店拜访
                                        if (j.RelateClient != 0)
                                        {
                                            //门店拜访
                                            CM_Client client = new CM_ClientBLL(j.RelateClient).Model;
                                            if (client != null) item.Text += client.ShortName + " ";

                                            if (j["VisitClientPurpose"] != "" && j["VisitClientPurpose"] != "0")
                                                item.Text += DictionaryBLL.GetDicCollections("OA_JN_VisitClientPurpose")[j["VisitClientPurpose"]].Name + " ";
                                        }
                                        break;
                                    case 2: //协同拜访
                                        if (j.RelateStaff != 0)
                                        {
                                            Org_Staff staff = new Org_StaffBLL(j.RelateStaff).Model;
                                            if (staff != null) item.Text += staff.RealName;
                                        }
                                        break;
                                    default:
                                        item.Text += j.Title;
                                        break;
                                }
                            }
                            else
                            {
                                item.Text += j.Title;
                            }
                        }
                        else
                        {
                            //周报、月报
                            item.Text += DictionaryBLL.GetDicCollections("OA_JournalType")[j.JournalType.ToString()].Name + " ";
                            item.Text += j.Title;
                        }
                        item.Value = "javascript:OpenJournal(" + j.ID.ToString() + ")";
                        bt.Items.Add(item);
                    }
                    bt.DisplayMode = BulletedListDisplayMode.HyperLink;
                    bt.BulletImageUrl = "~/Images/gif/gif-0162.gif";
                    bt.BulletStyle = BulletStyle.CustomImage;
                    bt.CssClass = "calaitem";
                    e.Cell.Controls.Add(bt);
                }
            }
            #endregion

            #region 获取访员工当天的工作计划
            if (cbx_Plan.Checked)
            {
                if (ViewState["PlanDetails"] == null || ((IList<JN_WorkingPlanDetail>)ViewState["PlanDetails"]).Where
                    (p => (p.BeginTime.Date <= e.Day.Date && p.EndTime.Date >= e.Day.Date)).Count() == 0)
                {
                    IList<JN_WorkingPlan> plans = JN_WorkingPlanBLL.GetModelList("'" + e.Day.Date.ToString("yyyy-MM-dd") +
                    "' BETWEEN BeginDate AND EndDate AND Staff=" + ViewState["Staff"].ToString());
                    if (plans.Count > 0)
                    {
                        IList<JN_WorkingPlanDetail> plandetails = new JN_WorkingPlanBLL(plans[0].ID).Items;
                        ViewState["PlanDetails"] = plandetails;
                    }
                    else
                        ViewState["PlanDetails"] = null;
                }

                if (ViewState["PlanDetails"] != null)
                {
                    IList<JN_WorkingPlanDetail> plandetails = (IList<JN_WorkingPlanDetail>)ViewState["PlanDetails"];

                    BulletedList bt = new BulletedList();

                    foreach (JN_WorkingPlanDetail plan in plandetails.Where(p => (p.BeginTime.Date <= e.Day.Date && p.EndTime.Date >= e.Day.Date)))
                    {
                        ListItem item = new ListItem();
                        item.Text = "";

                        if (plan.WorkingClassify == 0) continue;
                        item.Text += DictionaryBLL.GetDicCollections("OA_WorkingClassify")[plan.WorkingClassify.ToString()].Name + " ";
                        switch (plan.WorkingClassify)
                        {
                            case 1://门店拜访
                                if (plan.RelateClient != 0)
                                {
                                    //门店拜访
                                    CM_Client client = new CM_ClientBLL(plan.RelateClient).Model;
                                    if (client != null) item.Text += client.ShortName + " ";
                                }
                                break;
                            case 2: //协同拜访
                                if (plan.RelateStaff != 0)
                                {
                                    Org_Staff staff = new Org_StaffBLL(plan.RelateStaff).Model;
                                    if (staff != null) item.Text += staff.RealName + " ";
                                }
                                break;
                            default:
                                item.Text += plan.Description + " ";
                                break;
                        }
                        if (plan.OfficialCity > 1)
                            item.Text += TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", plan.OfficialCity).Replace("->", "");
                        bt.Items.Add(item);
                    }
                    bt.DisplayMode = BulletedListDisplayMode.Text;
                    bt.BulletImageUrl = "~/Images/gif/gif-0163.gif";
                    bt.BulletStyle = BulletStyle.CustomImage;
                    bt.CssClass = "calaitem";
                    e.Cell.Controls.Add(bt);
                }
            }
            #endregion
        }
    }
コード例 #33
0
        private void compileDocument()
        {
            //doc.LineSpacing = 12;
            /*
            Paragraph paragraph1 = new Paragraph();
            Stream stream = Application.GetResourceStream(new Uri(@"/RadRichTextBox-Getting-Started;component/Images/RadRichTextBox.png", UriKind.RelativeOrAbsolute)).Stream;
            Size size = new Size(236, 50);
            ImageInline imageInline = new ImageInline(stream, size, "png");
            paragraph1.Inlines.Add(imageInline);
            section.Blocks.Add(paragraph1);
            */
            // вид документа:
            // предыстория, на отдельной странице (потом разрыв)
            // имя персонажа большими буквами посередине страницы
            // описание, сюжет
            // список целей, ненумерованным списком
            // список предметов (если есть), нумерованным списком
            // правила игры

            doc = new RadDocument();
            doc.MergeSpansWithSameStyles();
            doc.ParagraphDefaultSpacingAfter = 0;
            doc.ParagraphDefaultSpacingBefore = 0;
            Padding padding = new System.Windows.Forms.Padding(0, 20, 100, 60);
            doc.SectionDefaultPageMargin = padding;
            //doc.SectionDefaultPageMargin.
            //doc.DefaultPageLayoutSettings.Width = 200;
            //doc.DefaultPageLayoutSettings.Height = 250;
            RadDocument tempDoc = new RadDocument();

            // **** Prehistory***********
            tempDoc = htmlProvider.Import(prehistory.writtenText);
            mergeDocuments(tempDoc);
            doc.CaretPosition.MoveToLastPositionInDocument();
            doc.InsertPageBreak();

            // **** Person Name ***********
            Section section = new Section();
            Paragraph paragraph1 = new Paragraph();
            paragraph1.TextAlignment = Telerik.WinControls.RichTextBox.Layout.RadTextAlignment.Center;
            Span span1 = new Span(chosenPerson.getName());
            span1.FontSize = 24;
            span1.FontStyle = TextStyle.Bold;
            span1.UnderlineType = Telerik.WinControls.RichTextBox.UI.UnderlineType.Wave;
            paragraph1.Inlines.Add(span1);
            section.Blocks.Add(paragraph1);
            doc.Sections.Add(section);

            // **** Person's description***********
            tempDoc = htmlProvider.Import(chosenPerson.description);
            mergeDocuments(tempDoc, section);

            // **** Aim list***********
            BulletedList aimList = new BulletedList(char.ConvertFromUtf32(0x25CF)[0] , doc);
            Section section2 = new Section();
            Paragraph par2 = new Paragraph();
            doc.CaretPosition.MoveToLastPositionInDocument();
            doc.InsertLineBreak();
            Span span2 = new Span("Your Aims:");
            par2.Inlines.Add(span2);
            section2.Blocks.Add(par2);

            foreach (int aimID in chosenPerson.aimsId)
            {
                CAim aim = aimManager.getAim(aimID);
                Paragraph par = new Paragraph();
                Span span = new Span(aim.getName());
                if (aim.description != "")
                    span.Text += " (" + aim.description + ")";
                par.Inlines.Add(span);
                par.LineSpacingType = LineSpacingType.AtLeast;
                aimList.AddParagraph(par);
                section2.Blocks.Add(par);
            }
            doc.Sections.Add(section2);

            // **** Item list***********
            if (chosenPerson.itemsId.Count > 0)
            {
                NumberedList itemList = new NumberedList(doc);
                Section section3 = new Section();
                Paragraph par3 = new Paragraph();
                Span span3 = new Span("Your Items:");
                par3.Inlines.Add(span3);
                section3.Blocks.Add(par3);

                foreach (int itemID in chosenPerson.itemsId)
                {
                    CItem item = itemManager.getItem(itemID);
                    Paragraph par = new Paragraph();
                    Span span = new Span(item.getName());
                    if (item.description != "")
                        span.Text += " (" + item.description + ")";
                    par.Inlines.Add(span);
                    par.LineSpacingType = LineSpacingType.AtLeast;
                    itemList.AddParagraph(par);
                    section3.Blocks.Add(par);
                }
                doc.Sections.Add(section3);
            }

            // **** Rules***********
            doc.CaretPosition.MoveToLastPositionInDocument();
            doc.InsertLineBreak();
            tempDoc = htmlProvider.Import(rules.writtenText);
            mergeDocuments(tempDoc, doc.Sections.Last);
        }