Example #1
0
    /// <summary>
    /// DataList控件绑定及分页
    /// </summary>
    /// <param name="intCount">每页显示的记录条数</param>
    /// <param name="ds">DataSet数据集</param>
    /// <param name="labPage">当前页码</param>
    /// <param name="labTPage">总页码</param>
    /// <param name="lbtnUp">上一页</param>
    /// <param name="lbtnNext">下一页</param>
    /// <param name="lbtnBack">最后一页</param>
    /// <param name="lbtnOne">第一页</param>
    /// <param name="dl">DataList控件对象</param>
    public static void dlBind(int intCount, DataSet ds, Label labPage, Label labTPage, LinkButton lbtnUp, LinkButton lbtnNext, LinkButton lbtnBack, LinkButton lbtnOne, Repeater dl)
    {
        int curpage = Convert.ToInt32(labPage.Text);
        PagedDataSource ps = new PagedDataSource();
        ps.DataSource = ds.Tables[0].DefaultView;
        ps.AllowPaging = true; //是否可以分页
        ps.PageSize = intCount; //显示的数量
        ps.CurrentPageIndex = curpage - 1; //取得当前页的页码

        lbtnNext.Visible = true;
        lbtnOne.Visible = true;
        lbtnBack.Visible = true;
        lbtnUp.Visible = true;

        lbtnNext.Enabled = true;
        lbtnBack.Enabled = true;
        lbtnOne.Enabled = true;
        if (curpage == 1)
        {
            lbtnOne.Visible = false;//不显示第一页按钮
            lbtnUp.Visible = false;//不显示上一页按钮
        }
        if (curpage == ps.PageCount)
        {
            lbtnNext.Visible = false;//不显示下一页
            lbtnBack.Visible = false;//不显示最后一页
        }
        labTPage.Text = Convert.ToString(ps.PageCount);
        dl.DataSource = ps;
           // dl.DataKeyField = "ID";
        dl.DataBind();
    }
Example #2
0
    protected void BindControl(Repeater rp, string type)
    {
        rp.DataSource = AccessHelper.ExecuteDataTable(strConnection, CommandType.Text, String.Format(
            "SELECT TOP 4 A.ID,A.Title,A.CreateTime,A.TypeCode,B.ContentType From Contents A,ContentAndType B, ContentType C "+
            "WHERE A.ID=B.ContentID AND B.TypeID= C.ID AND( C.TypeCode='{0}' OR C.ParentType='{0}')",type));

        rp.DataBind();
    }
    public void MakeEVKinput(String title)
    {
        Label lblTitel = new Label();
        lblTitel.Text = title;

        Repeater rptEVK = new Repeater();
        TextBox txtExternVakVaam = new TextBox();
    }
Example #4
0
 protected void Bind(Repeater rpt, string typeName)
 {
     var pager = new PagerInfo();
     pager.CurrenetPageIndex = 1;
     pager.PageSize = 10;
     rpt.DataSource = BLLFactory<T_ManagerInfoManager>.Instance.FindWithPager(string.Format("M_Type='{0}'", typeName), pager, "M_Time", true);
     // rpt.DataSource = BLLFactory<T_ManagerInfoManager>.Instance.Find(string.Format("M_Type='{0}'",typeName), "order by M_Time desc");
     rpt.DataBind();
 }
Example #5
0
 public void BindPersonActivities(Repeater rpToBindTo, Guid personId)
 {
     db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues);
     var personAssignmentRetreats = from p in db.jkp_PersonAssignmentRetreats
                                    where p.PAR_Per_ID == personId && p.PAR_Ret_ID == RetreatId
                                    select p;
     rpToBindTo.DataSource = personAssignmentRetreats;
     rpToBindTo.DataBind();
 }
Example #6
0
 //添加菜单checkbox到list
 public void AddCheckBox(Repeater list)
 {
     foreach (Control c in list.Controls)
     {
         CheckBox checkbox = (CheckBox)c.FindControl("MenuBox");
         string strId = ((HiddenField)c.FindControl("MenuIDHid")).Value;
         MyCheckBox cb = new MyCheckBox(checkbox, strId);
         lists.Add(cb);
     }
 }
 protected void databind2(int i, Repeater rpt1)
 {
     using (var db = new CstwebEntities())
     {
         var t = from it in db.teachers
                 where it.teacherlevel == i
                 orderby it.name
                 select it;
         rpt1.DataSource = t.ToList();
         rpt1.DataBind();
     }
 }
Example #8
0
        static void Main(string[] args)
        {
            Repeater reapeter = new Repeater();
            int ncases = int.Parse(System.Console.ReadLine());

            for (int k = 1; k <= ncases; k++)
            {
                int nstrings = int.Parse(System.Console.ReadLine());
                IList<string> strings = new List<string>();

                for (int j = 0; j < nstrings; j++)
                    strings.Add(System.Console.ReadLine().ToString());

                int moves = reapeter.Moves(strings);

                System.Console.WriteLine(string.Format("Case #{0}: {1}", k, moves < 0 ? "Fegla Won" : moves.ToString()));
            }
        }
Example #9
0
    protected void databind(int i, Repeater r1)
    {
        using (var db = new CstwebEntities())
        {
            var se = (from it in db.lesson
                      where it.lesscla == i
                      select it).ToList();

            List<course1> co = new List<course1>();
            course1 cour;
            string first = "";
            foreach (lesson less in se)
            {
                cour = new course1();
                cour.id = less.id;
                cour.lesscla = less.lesscla;
                cour.teach = less.teach;
                cour.experiment = less.experiment;
                cour.credits = less.credits;
                cour.classname = less.classname;
                var rela = (from it in db.lesrelation
                            where it.lesson == less.id
                            select it).ToList();
                foreach (lesrelation le in rela)
                {
                    first += db.lesson.First(a => a.id == le.firstlesson).classname +"、";
                }
                if (first == "")
                {
                    first = "无";
                }
                else
                    first = first.Substring(0, first.Length - 1);
                cour.first = first;
                co.Add(cour);
                first = "";

            }

            r1.DataSource = co;
            r1.DataBind();
        }
    }
 /// <summary>
 /// 获取选中checkBoxID
 /// </summary>
 /// <param name="rep"></param>
 /// <param name="ChkBoxID"></param>
 /// <returns></returns>
 public string GetDelIDList(Repeater rep, string ChkBoxID)
 {
     string idList = string.Empty;
     foreach (RepeaterItem item in rep.Items)
     {
         CheckBox chkItem = (CheckBox)item.FindControl(ChkBoxID);
         if (chkItem.Checked)
         {
             //被勾选
             if (idList.Length <= 0)
             {
                 idList = chkItem.ToolTip;
             }
             else
             {
                 idList += "," + chkItem.ToolTip;
             }
         }
     }
     return idList;
 }
Example #11
0
        void run()
        {
            xspeed = XSPEED;       // keep correct ball speed aspect
            yspeed = YSPEED;

            ball_colour = WHITE;                       // initial ball colour
            xdir = 1; ydir = 1;                       // initial ball direction
            ball_x = 20; ball_y = 20;                 // initial ball position

            LCD.drawRectangle(0, 0, screenwidth - 1, WALLWIDTH - 1, TOPCOLOUR);                         // Draw Top Wall
            LCD.drawRectangle(0, WALLWIDTH - 1, WALLWIDTH - 1, screenheight - racketHeight - 1, LEFTCOLOUR);         // Draw Left Wall
            LCD.drawRectangle(screenwidth - WALLWIDTH, WALLWIDTH - 1, screenwidth - 1, screenheight - racketHeight - 1, RIGHTCOLOUR);      // Draw Right Wall

            tophit = WALLWIDTH + BALLSIZE;
            bottomhit = screenheight - WALLWIDTH - BALLSIZE - 1;
            lefthit = WALLWIDTH + BALLSIZE;
            righthit = screenwidth - WALLWIDTH - BALLSIZE - 1;

            leftButton = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.An0, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
            rightButton = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.An1, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
            rightButton.OnInterrupt += new NativeEventHandler(rightButtonEvent);
            leftButton.OnInterrupt += new NativeEventHandler(leftButtonEvent);

            LCD.drawRectangle(racketX, racketY, racketX + racketWidth - 1, racketY + racketHeight - 1, colorRacket);

            Repeater repeat1 = new Repeater(moveBall, ballSpeed);
            new Thread(new ThreadStart(repeat1.run)).Start();

            Repeater repeat2 = new Repeater(checkAccelerometer, ballSpeed);
            new Thread(new ThreadStart(repeat2.run)).Start();

            while (true)
            {
                Thread.Sleep(100);
            }
        }
Example #12
0
    void OuterRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {

        CourseInfo course = (CourseInfo)e.Item.DataItem;

        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
          
            int intLast1Week = 0;

            
            /*
             * System.Web.UI.WebControls.Image CourseImage = (System.Web.UI.WebControls.Image)e.Item.FindControl("CourseImage");

            if (WebImage.ExistsInCustomStorage("course_image", course.Id.ToString()))
            {
                try
                {
                    CourseImage.ImageUrl = WebImage.LoadFromCustomStorage("course_image", course.Id.ToString()).Resizes["_CourseListSmall"].FileUrl;
                }
                catch (Exception ex)
                {
                    CourseImage.ImageUrl = "~/Images/nocourseimage.gif";
                }
            }
            else
            {
                CourseImage.ImageUrl = "~/Images/nocourseimage.gif";
            }

            */
            HyperLink hlCourseTitle = (HyperLink)e.Item.FindControl("hlCourseTitle");
            hlCourseTitle.Text = course.Title;
            hlCourseTitle.NavigateUrl = "ClassRoom/CourseDetail.aspx?Id=" + course.Id;

            Literal ltrLast24Hours = (Literal)e.Item.FindControl("ltrLast24Hours");
            ltrLast24Hours.Text = course.Last24Hours.ToString();
            intTotal_Last24Hours += course.Last24Hours;

            Literal ltrLast1Week = (Literal)e.Item.FindControl("ltrLast1Week");
            //intLast1Week = (course.Last24Hours + course.LastDay + course.SecondLastDay +
            //                course.ThirdLastDay + course.FourthLastDay +    
            //                course.FifthLastDay + course.SixthLastDay +
            //                course.SeventhLastDay);

            intLast1Week = course.L1W;

            ltrLast1Week.Text = intLast1Week.ToString();
            intTotal_Last1Week += intLast1Week;

            Literal ltrLast1Month = (Literal)e.Item.FindControl("ltrLast1Month");
            ltrLast1Month.Text = course.L1M.ToString();
            intTotal_Last1Month += course.L1M;

            Literal ltrLast1Year = (Literal)e.Item.FindControl("ltrLast1Year");
            ltrLast1Year.Text = course.YTD.ToString();
            intTotal_YTD += course.YTD;

            Literal ltrTypicalUser = (Literal)e.Item.FindControl("ltrTypicalUser");
            if (course.FemaleCount > course.MaleCount)
            {
                intFemaleCount += 1;
                intFemaleAgeTotal += course.FemaleAverageAge;
                ltrTypicalUser.Text = course.FemaleAverageAge.ToString() + " F";
            }

            if (course.MaleCount > course.FemaleCount)
            {
                intMaleCount += 1;
                intMaleAgeTotal += course.MaleAverageAge;
                ltrTypicalUser.Text = course.MaleAverageAge.ToString() + " M";
            }

            if (course.MaleCount == course.FemaleCount)
                ltrTypicalUser.Text = "--";


            
            //Literal ltrTypicalUserMan = (Literal)e.Item.FindControl("ltrTypicalUserMan");
            //ltrTypicalUserMan.Text = course.MaleAverageAge.ToString();
            //Literal ltrTypicalUserWomen = (Literal)e.Item.FindControl("ltrTypicalUserWomen");
            //ltrTypicalUserWomen.Text = course.FemaleAverageAge.ToString();

            
            InnerRepeater = (Repeater)e.Item.FindControl("InnerRepeater");
            if (course.Id > 0)
            {
                //Store CourseId so that we can bind inner repeater.
                //Session["BindForCourseId"] = course.Id.ToString();
                int index = 0;
                InnerRepeater.ItemDataBound +=new RepeaterItemEventHandler(InnerRepeater_ItemDataBound);
                List<CourseSKUStatsInfo> oCourseSKUStats_CourseWise = new List<CourseSKUStatsInfo>();
                for (int i = 0; i < oCoursesSKUStats.Count; i++)
                {
                    if (Convert.ToInt32(course.Id.ToString()) == Convert.ToInt32(oCoursesSKUStats[i].CourseId))
                    {
                        oCourseSKUStats_CourseWise.Insert(index, oCoursesSKUStats[i]);
                        index++;
                    }
                }
                InnerRepeater.DataSource = oCourseSKUStats_CourseWise;
                InnerRepeater.DataBind();
            }

        }
    }
    // Process Pagination ver 2.0 // Compatible with Hyperlinks
    // Compatible with both MySQL / SQL SERVER.
    // Support Advance Pagination
    public static void Process_Pagination_v2(DataList _list,Repeater _rept,HyperLink _prev,HyperLink _next,int _size, int _pagenumber, IEnumerable _source, int _totalrecords)
    {
        if (Site_Settings.Pagination_Type == 1)
        {
            // MySQL Compatible
            int total_pages = (int)Math.Ceiling((double)_totalrecords / _size);
            if (total_pages > 1)
            {
                // Previous Link Scripting
                if (_pagenumber > 1)
                {
                    _prev.Visible = true;
                    int firstbound = (((_pagenumber - 1) - 1) * _size) + 1;
                    if (firstbound < 0)
                        firstbound = 1;
                    int lastbound = firstbound + _size - 1;
                    _prev.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
                }
                else
                {
                    _prev.Visible = false;
                }
                // Next Link Scripting
                if (_pagenumber < total_pages)
                {
                    _next.Visible = true;
                    int firstbound = (((_pagenumber + 1) - 1) * _size) + 1;
                    int lastbound = firstbound + _size - 1;
                    if (lastbound > _totalrecords)
                        lastbound = _totalrecords;
                    _next.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
                }
                else
                {
                    _next.Visible = false;
                }

                // main pagination links
                ArrayList arr = Pagination_Process.Return_Pagination_Link_v2(total_pages, _pagenumber);
                _rept.Visible = true;
                _rept.DataSource = arr;
                _rept.DataBind();
            }
            else
            {
                _rept.Visible = false;
                _next.Visible = false;
                _prev.Visible = false;
            }

            _list.DataSource = _source;
            _list.DataBind();

        }
        else
        {
            // SQL SERVER Compatible
            PagedDataSource objPds = new PagedDataSource();
            objPds.DataSource = _source;
            objPds.AllowPaging = true;

            objPds.PageSize = _size;
            objPds.CurrentPageIndex = (_pagenumber - 1);

            if (!objPds.IsFirstPage)
            {
                _prev.Visible = true;
                int firstbound = (((_pagenumber - 1) - 1) * _size) + 1;
                if (firstbound < 0)
                    firstbound = 1;

                int lastbound = firstbound + _size - 1;

                _prev.ToolTip = "Showing previous " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
            }
            else
            {
                _prev.Visible = false;
            }
            if (!objPds.IsLastPage)
            {
                int firstbound = (((_pagenumber + 1) - 1) * _size) + 1;
                int lastbound = firstbound + _size - 1;
                if (lastbound > _totalrecords)
                    lastbound = _totalrecords;

                _next.ToolTip = "Showing next " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
                _next.Visible = true;
            }
            else
            {
                _next.Visible = false;
            }

            ArrayList arr = Pagination_Process.Return_Pagination_Link_v2(objPds.PageCount, _pagenumber);
            if (objPds.PageCount > 1)
            {
                _rept.Visible = true;
                _rept.DataSource = arr;
                _rept.DataBind();
            }
            else
            {
                _rept.Visible = false;
            }

            _list.DataSource = objPds;
            _list.DataBind();
        }
    }
    public static void Process_Pagination(DataList _list, Repeater _rept, LinkButton _prev, LinkButton _next, int _size, int _pagenumber, IEnumerable _source)
    {
        PagedDataSource objPds = new PagedDataSource();
        objPds.DataSource = _source;
        objPds.AllowPaging = true;

        objPds.PageSize = _size;
        objPds.CurrentPageIndex = (_pagenumber - 1);

        if (!objPds.IsFirstPage)
            _prev.Visible = true;
        else
            _prev.Visible = false;
        if (!objPds.IsLastPage)
            _next.Visible = true;
        else
            _next.Visible = false;
        ArrayList arr = Return_Pagination_Link(objPds.PageCount, 11, _pagenumber);
        if (objPds.PageCount > 1)
        {
            _rept.Visible = true;
            _rept.DataSource = arr;
            _rept.DataBind();
        }
        else
        {
            _rept.Visible = false;
        }
        _list.DataSource = objPds;
        _list.DataBind();
    }
    private void ExportToDoc(Repeater grRp, string format, string defaultFilename, string defaultTitle)
    {
        string contentType = null;
        string extentionPart = null;
        string strWrite = "";
        string strTopHeader = "";

        string strFooter = "";
        System.IO.StringWriter sw1 = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter hw1 = new HtmlTextWriter(sw1);
        System.IO.StringWriter sw2 = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter hw2 = new HtmlTextWriter(sw2);
        System.IO.StringWriter sw3 = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter hw3 = new HtmlTextWriter(sw3);
        try
        {

            strTopHeader = "Ngày thống kê:" + DateTime.Now.ToString();
            strTopHeader += "<table border=1 cellpadding=1 cellspacing=1 style=border-right: thin; border-top: thin; border-left: thin; border-bottom: thin>";
            strTopHeader += "<tr>";

            strTopHeader += "<td style=width: 100px; text-align: center rowspan=2><span style=font-size: 10pt; font-family: Arial><strong>Số Dịch Vụ</strong></span></td>";

            strTopHeader += "<td colspan=3 style=height: 21px; text-align: center><span style=font-size: 10pt; font-family: Arial><strong>GPC</strong></span></td>";
            strTopHeader += "<td colspan=3 style=height: 21px; text-align: center><span style=font-size: 10pt; font-family: Arial><strong>VMS</strong></span></td>";
            strTopHeader += "<td colspan=3 style=height: 21px; text-align: center><strong>VIETTEL</strong></td>";
            strTopHeader += "<td colspan=3 style=height: 21px; text-align: center><strong>SFONE</strong></td>";
            strTopHeader += "<td colspan=3 style=height: 21px; text-align: center>TỔNG</td>";
            strTopHeader += "</tr>";
            strTopHeader += "<tr>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MO</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MTC</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MT</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MO</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MTC</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MT</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MO</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MTC</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MT</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MO</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MTC</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MT</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MO</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MTC</td>";
            strTopHeader += "<td align=center style=font-size: 10pt; width: 100px; font-family: Arial>MT</td>";
            strTopHeader += "</tr>";
            strFooter = "</table>";
            grPr.RenderControl(hw1);
            strWrite = strTopHeader + sw1.ToString() + strFooter;
            Response.Clear();
            Response.ClearHeaders();
            Response.Buffer = true;
            Response.Charset = "UTF-8";
            switch (format)
            {
                case "Word":
                    contentType = "application/msword";
                    extentionPart = ".doc";

                    break;
                case "PDF":
                    contentType = "application/pdf";
                    extentionPart = ".pdf";
                    break;
                case "Excel":
                    contentType = "application/msexcel";
                    extentionPart = ".xls";
                    break;
            }

            Response.ContentType = contentType;
            Response.AddHeader("Content-Disposition", "attachment;filename = " + defaultFilename + extentionPart);
            Response.Write(strWrite);
            Response.End();

        }
        catch
        {
        }
    }
Example #16
0
    public static void SetupRepeater(Repeater repeater)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("Letter", typeof(string));

        string[] Letters = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K",
                     "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
                     "W", "X", "Y", "Z", "Å", "Ä", "Ö", "[ Visa alla ]"};

        for (int i = 0; i < Letters.Length; i++)
        {
            DataRow dr = dt.NewRow();
            dr[0] = Letters[i];
            dt.Rows.Add(dr);
        }

        repeater.DataSource = dt.DefaultView;
        repeater.DataBind();
    }
Example #17
0
            //-----------------------------------------------
            #endregion

            #region ---------------CatchControls---------------
            //-----------------------------------------------
            //CatchControls
            //-----------------------------------------------
            protected void CatchControls()
            {
                rList = (Repeater)this.FindControl("rList");
            }
Example #18
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ContentsDisplayInfo displayInfo)
        {
            var parsedContent = string.Empty;

            contextInfo.TitleWordNum = 0;

            var siteName  = displayInfo.OtherAttributes[Attribute_SiteName];
            var directory = displayInfo.OtherAttributes[Attribute_Directory];
            var since     = displayInfo.OtherAttributes[Attribute_Since];

            if (displayInfo.Layout == ELayout.None)
            {
                var rptContents = new Repeater();

                rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo);
                }

                rptContents.DataSource = StlDataUtility.GetSitesDataSource(siteName, directory, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.Where, displayInfo.Scope, displayInfo.OrderByString, since);
                rptContents.DataBind();

                if (rptContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(rptContents);
                }
            }
            else
            {
                var pdlContents = new ParsedDataList();

                TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo);

                pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo);
                }

                pdlContents.DataSource = StlDataUtility.GetSitesDataSource(siteName, directory, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.Where, displayInfo.Scope, displayInfo.OrderByString, since);
                pdlContents.DataBind();

                if (pdlContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(pdlContents);
                }
            }

            return(parsedContent);
        }
Example #19
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        /// <param name="args">The command-line arguments.</param>
        static async Task Main(string[] args)
        {
            Settings settings = new Settings(true);

            settings.Save();

            string Title = "AA5JC APRS Telemetry Monitor";

            Console.Title = Title;

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(Title + "\r\n");

            if (string.IsNullOrEmpty(settings.Callsign))
            {
                Console.BackgroundColor = ConsoleColor.Red;
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("Settings file not found. Creating new settings.json. Please answer the following questions to set up:");
                Console.ResetColor();

                settings.Callsign      = Settings.Ask("Callsign");
                settings.Password      = Settings.Ask("Password");
                settings.ServerAddress = Settings.Ask("ServerAddress");

                string strPort = Settings.Ask("ServerPort");
                if (!int.TryParse(strPort, out settings.ServerPort))
                {
                    settings.ServerPort = 14580;
                }

                settings.Filter = Settings.Ask("Filter");

                settings.RegExForParsingTelemetryData = "([a-zA-Z0-9]{1,3}[0123456789][a-zA-Z0-9]{0,3}[a-zA-Z].*)>APTT4,.*:T\\#(...),(...),(...),(...),(...),(...),(........)";
                settings.OutputFile = "repeaterTelemetry.json";
                settings.Save();
            }

ReadSettingsAndListen:

            Repeaters repeaters = new Repeaters(settings.OutputFile);

            Config config = new Config();

            config.Callsign        = settings.Callsign;
            config.Password        = settings.Password;
            config.Uri             = settings.ServerAddress;
            config.UseOgnAdditives = false;
            config.Port            = settings.ServerPort;
            config.SoftwareName    = Console.Title;
            config.SoftwareVersion = "1.1_05";
            config.Filter          = settings.Filter;

            Listener listener = new Listener(config);

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write(String.Format(@"
    Server: {0}:{1}
    Filter: {2}
    Login callsign: {4}
    Login password: {5}
    Output file: {6}

    * Press ESC for settings, CTRL-C to quit *


",
                                        settings.ServerAddress, settings.ServerPort, settings.Filter, settings.RegExForParsingTelemetryData, settings.Callsign, settings.Password, settings.OutputFile));
            Console.ResetColor();

            listener.Connected += (sender, e) =>
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine(" -- Connected");
                Console.ResetColor();
            };

            listener.Disconnected += (sender, e) => {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine(" -- Disconnected");
                Console.ResetColor();
            };

            listener.DataReceived += (sender, e) => {
                AprsMessage message = null;

                try {
                    message = PacketInfo.Parse(e.Data);
                } catch {
                }

                if (message == null)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(e.Data);
                    Console.ResetColor();
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(e.Data);

                    Regex regex = new Regex(settings.RegExForParsingTelemetryData);
                    if (regex.IsMatch(e.Data))
                    {
                        Match    m        = regex.Match(e.Data);
                        Repeater repeater = new Repeater(m.Groups[1].Value, m.Groups[2].Value, m.Groups[3].Value, m.Groups[4].Value, m.Groups[5].Value, m.Groups[6].Value, m.Groups[7].Value, m.Groups[8].Value);
                        repeaters.Add(repeater);
                        repeaters.Save();
                    }

                    Console.ResetColor();
                }
            };

            bool interruptReceived = false;

            Console.CancelKeyPress += delegate {
                Console.WriteLine("** Interrupt received **");
                interruptReceived = true;
                System.Environment.Exit(0);
            };

            await listener.Open();

            while (Console.ReadKey().Key != ConsoleKey.Escape)
            {
                // Just keep swimming, just keep swimming..
            }

            listener.Stop();

ShowMenu:

            Console.WriteLine("\r\n");
            Console.WriteLine(@" /--------------------------------------------------------------------------\ ");
            Console.WriteLine(@" |" + Console.Title.PadBoth(75));
            Console.WriteLine(@" |" + "MENU".PadBoth(75));
            Console.WriteLine(@" | ");
            Console.WriteLine(" |     1. Change callsign");
            Console.WriteLine(" |     2. Change password");
            Console.WriteLine(" |     3. Change server address");
            Console.WriteLine(" |     4. Change server port");
            Console.WriteLine(" |     5. Change APRS filter");
            Console.WriteLine(" |     6. Change regex for parsing telemetry");
            Console.WriteLine(" |     7. Change output file");
            Console.WriteLine(" |     S. Save and restart program");
            Console.WriteLine(" |     Q. Quit program");
            Console.WriteLine(@" | ");
            Console.WriteLine(@" \--------------------------------------------------------------------------/ ");
            Console.WriteLine("");
            Console.Write("> ");

            switch (Console.ReadKey().Key)
            {
            case ConsoleKey.D1:
                settings.Callsign = Settings.Ask("Callsign");
                break;

            case ConsoleKey.D2:
                settings.Password = Settings.Ask("Password");
                break;

            case ConsoleKey.D3:
                settings.ServerAddress = Settings.Ask("ServerAddress");
                break;

            case ConsoleKey.D4:
                string strPort = Settings.Ask("ServerPort");
                if (!int.TryParse(strPort, out settings.ServerPort))
                {
                    settings.ServerPort = 14580;
                }
                break;

            case ConsoleKey.D5:
                settings.Filter = Settings.Ask("Filter");
                break;

            case ConsoleKey.D6:
                settings.RegExForParsingTelemetryData = Settings.Ask("RegExForParsingTelemetryData");
                break;

            case ConsoleKey.D7:
                settings.OutputFile = Settings.Ask("OutputFile");
                break;

            case ConsoleKey.S:
                settings.Save();
                goto ReadSettingsAndListen;

            //break;
            case ConsoleKey.Q:
                System.Environment.Exit(0);
                break;

            default:
                break;
            }

            goto ShowMenu;
        }
Example #20
0
        private Control ProcessToken(string tokenName)
        {
            switch (tokenName.ToUpper())
            {
            case "LISTTITLE":
                Label lblTitle = new Label
                {
                    CssClass = "StoreListTitle",
                    Text     = _title
                };
                return(lblTitle);

            case "PAGENAV":
                if ((ListType == ProductListTypes.Category || ListType == ProductListTypes.SearchResults) && _productList.Count > 0)
                {
                    HyperLink btnPrevious = new HyperLink
                    {
                        Text     = Localization.GetString("Previous", LocalResourceFile),
                        CssClass = "StorePagePrevious"
                    };
                    _buttonsPrevious.Add(btnPrevious);

                    Literal lblSpace = new Literal
                    {
                        Text = "&nbsp;&nbsp;"
                    };

                    HyperLink btnNext = new HyperLink
                    {
                        Text     = Localization.GetString("Next", LocalResourceFile),
                        CssClass = "StorePageNext"
                    };
                    _buttonsNext.Add(btnNext);

                    PlaceHolder phPageList = new PlaceHolder();
                    _placeholdersPageList.Add(phPageList);

                    Label lblPageNav = new Label();
                    lblPageNav.Controls.Add(btnPrevious);
                    lblPageNav.Controls.Add(lblSpace);
                    lblPageNav.Controls.Add(phPageList);
                    lblPageNav.Controls.Add(btnNext);
                    lblPageNav.CssClass = "StorePageNav";
                    _labelsPageNav.Add(lblPageNav);
                    return(lblPageNav);
                }

                return(null);

            case "PAGEINFO":
                if (_productList.Count > 0)
                {
                    Label lblPageInfo = new Label
                    {
                        CssClass = "StorePageInfo",
                        Text     = string.Format(Localization.GetString("PageInfo", LocalResourceFile), 1, 1)
                    };
                    _labelsPageInfo.Add(lblPageInfo);
                    return(lblPageInfo);
                }

                return(null);

            case "PRODUCTS":
                if (_productList.Count > 0)
                {
                    _lstProducts = new DataList
                    {
                        ID           = "ProductsList",
                        CssClass     = _containerCssClass,
                        RepeatLayout = RepeatLayout.Table
                    };
                    switch (_direction)
                    {
                    case "V":
                        _lstProducts.RepeatDirection = RepeatDirection.Vertical;
                        break;

                    case "H":
                    default:
                        _lstProducts.RepeatDirection = RepeatDirection.Horizontal;
                        break;
                    }
                    _lstProducts.RepeatColumns  = _columnCount;
                    _lstProducts.ItemDataBound += lstProducts_ItemDataBound;
                    return(_lstProducts);
                }

                Label lblEmpty = new Label
                {
                    CssClass = "StoreEmptyList"
                };
                if (ListType == ProductListTypes.Category)
                {
                    lblEmpty.Text = Localization.GetString("CategoryEmpty", LocalResourceFile);
                }
                else if (ListType == ProductListTypes.SearchResults)
                {
                    lblEmpty.Text = Localization.GetString("SearchEmpty", LocalResourceFile);
                }
                return(lblEmpty);

            case "ULISTPRODUCTS":
                if (_productList.Count > 0)
                {
                    _rlProducts = new Repeater
                    {
                        ID             = "UnorderedProductsList",
                        HeaderTemplate = new ListTemplate("<ul>"),
                        ItemTemplate   = new ListTemplate(),
                        FooterTemplate = new ListTemplate("</ul>")
                    };
                    _rlProducts.ItemDataBound += rlProducts_ItemDataBound;
                    return(_rlProducts);
                }

                return(null);

            case "ITEMSCOUNT":
                if (_productList != null)
                {
                    Label lblItems = new Label
                    {
                        CssClass = "StoreItemsCount",
                        Text     = string.Format(Localization.GetString("ItemsCount", LocalResourceFile), _productList.Count)
                    };
                    return(lblItems);
                }

                return(null);

            case "SELECTEDCATEGORY":
                if (ListType == ProductListTypes.Category)
                {
                    if (_moduleNav.CategoryID == Null.NullInteger && _moduleSettings.General.DisplayAllProducts)
                    {
                        Label lblProductCategory = new Label
                        {
                            Text     = Localization.GetString("FullCatalog", LocalResourceFile),
                            CssClass = "StoreSelectedCategory"
                        };
                        return(lblProductCategory);
                    }

                    _categoryControler = new CategoryController();
                    CategoryInfo categoryInfo = _categoryControler.GetCategory(PortalId, CategoryID);
                    if (categoryInfo != null)
                    {
                        Label lblProductCategory = new Label
                        {
                            Text     = string.Format(Localization.GetString("SelectedCategory", LocalResourceFile), categoryInfo.Name),
                            CssClass = "StoreSelectedCategory"
                        };
                        return(lblProductCategory);
                    }
                }

                return(null);

            case "CATEGORIESBREADCRUMB":
                if (ListType == ProductListTypes.Category && CategoryID != Null.NullInteger)
                {
                    _categoryControler = new CategoryController();
                    CategoryInfo categoryInfo = _categoryControler.GetCategory(PortalId, CategoryID);
                    if (categoryInfo != null)
                    {
                        // Create label to contains all other controls
                        Label lblCategoriesBreadcrumb = new Label
                        {
                            CssClass = "StoreCategoriesBreadcrumb"
                        };
                        // Create "before" label with locale resource
                        Label lblBeforeBreadcrumb = new Label
                        {
                            Text     = Localization.GetString("BeforeCategoriesBreadcrumb", LocalResourceFile),
                            CssClass = "StoreBeforeBreadcrumb"
                        };
                        lblCategoriesBreadcrumb.Controls.Add(lblBeforeBreadcrumb);
                        // Create label to contains categories
                        Label lblBreadcrumb = new Label
                        {
                            CssClass = "StoreBreadcrumb"
                        };
                        lblCategoriesBreadcrumb.Controls.Add(lblBreadcrumb);
                        // Create literal with selected category name
                        Literal litSelectedCategory = new Literal
                        {
                            Text = categoryInfo.Name
                        };
                        lblBreadcrumb.Controls.Add(litSelectedCategory);
                        // Create "between" label with locale resource
                        Literal litBetwenBreadcrumb;
                        String  betweenBreadcrumb = Localization.GetString("BetweenCategoriesBreadcrumb", LocalResourceFile);
                        // Create catalog navigation object to compute hyperlink URL
                        CatalogNavigation categoryNav = new CatalogNavigation();
                        // Loop for parent categories (if any)
                        int parentCategoryID = categoryInfo.ParentCategoryID;
                        while (parentCategoryID != Null.NullInteger)
                        {
                            // Get parent category
                            categoryInfo = _categoryControler.GetCategory(PortalId, parentCategoryID);
                            if (categoryInfo != null)
                            {
                                // Insert separator
                                litBetwenBreadcrumb = new Literal
                                {
                                    Text = betweenBreadcrumb
                                };
                                lblBreadcrumb.Controls.AddAt(0, litBetwenBreadcrumb);
                                // Create hyperlink with the parent category
                                HyperLink hlCategory = new HyperLink
                                {
                                    Text = categoryInfo.Name
                                };
                                categoryNav.CategoryID = categoryInfo.CategoryID;
                                if (StoreSettings.SEOFeature)
                                {
                                    categoryNav.Category = categoryInfo.SEOName;
                                }
                                hlCategory.NavigateUrl = categoryNav.GetNavigationUrl();
                                lblBreadcrumb.Controls.AddAt(0, hlCategory);
                                parentCategoryID = categoryInfo.ParentCategoryID;
                            }
                            else
                            {
                                parentCategoryID = Null.NullInteger;
                            }
                        }
                        // Create "after" label with locale resource
                        Label lblAfterBreadcrumb = new Label
                        {
                            Text     = Localization.GetString("AfterCategoriesBreadcrumb", LocalResourceFile),
                            CssClass = "StoreAfterBreadcrumb"
                        };
                        lblCategoriesBreadcrumb.Controls.Add(lblAfterBreadcrumb);
                        return(lblCategoriesBreadcrumb);
                    }
                }

                return(null);

            case "SORTBY":
                if (_moduleSettings.SortProducts.SortColumns != 0 && (ListType == ProductListTypes.Category || ListType == ProductListTypes.SearchResults))
                {
                    // Create label to contains all other controls
                    Label lblSortBy = new Label
                    {
                        CssClass = "StoreSortBy"
                    };
                    // Create literal text with locale resource
                    Literal litSortBy = new Literal
                    {
                        Text = Localization.GetString("SortBy", LocalResourceFile)
                    };
                    lblSortBy.Controls.Add(litSortBy);
                    // Create DropDownList with column names
                    DropDownList ddlSortBy = new DropDownList
                    {
                        AutoPostBack = true,
                        CssClass     = "StoreSortByColumns"
                    };
                    int sortColumns = _moduleSettings.SortProducts.SortColumns;
                    if ((sortColumns & (int)SortColumn.Manufacturer) != 0)
                    {
                        ddlSortBy.Items.Add(new ListItem(Localization.GetString("SortManufacturer", LocalResourceFile), "0"));
                    }
                    if ((sortColumns & (int)SortColumn.ModelNumber) != 0)
                    {
                        ddlSortBy.Items.Add(new ListItem(Localization.GetString("SortModelNumber", LocalResourceFile), "1"));
                    }
                    if ((sortColumns & (int)SortColumn.ModelName) != 0)
                    {
                        ddlSortBy.Items.Add(new ListItem(Localization.GetString("SortModelName", LocalResourceFile), "2"));
                    }
                    if ((sortColumns & (int)SortColumn.UnitPrice) != 0)
                    {
                        ddlSortBy.Items.Add(new ListItem(Localization.GetString("SortUnitPrice", LocalResourceFile), "3"));
                    }
                    if ((sortColumns & (int)SortColumn.Date) != 0)
                    {
                        ddlSortBy.Items.Add(new ListItem(Localization.GetString("SortCreatedDate", LocalResourceFile), "4"));
                    }
                    string sortColumn;
                    // Define sort column
                    if (_moduleNav.SortID != Null.NullInteger)
                    {
                        // Currently selected sort column
                        sortColumn = _moduleNav.SortID.ToString();
                    }
                    else
                    {
                        // Default sort column
                        sortColumn = _moduleSettings.SortProducts.SortBy.ToString();
                    }
                    ListItem itemSortColumn = ddlSortBy.Items.FindByValue(sortColumn);
                    if (itemSortColumn != null)
                    {
                        itemSortColumn.Selected = true;
                    }
                    ddlSortBy.SelectedIndexChanged += ddlSortBy_SelectedIndexChanged;
                    if (_productList.Count == 0)
                    {
                        ddlSortBy.Enabled = false;
                    }
                    lblSortBy.Controls.Add(ddlSortBy);
                    // Create Sort Order image button
                    ImageButton btnSortDir = new ImageButton
                    {
                        CssClass = "StoreSortByLinkButton"
                    };
                    string sortDir;
                    if (_moduleNav.SortDir != Null.NullString)
                    {
                        // Currently selected sort direction
                        sortDir = _moduleNav.SortDir;
                    }
                    else
                    {
                        // Default sort direction
                        sortDir = _moduleSettings.SortProducts.SortDir;
                    }
                    string imageName;
                    string altText;
                    if (sortDir.ToUpper() == "ASC")
                    {
                        imageName = "arrow_up.png";
                        altText   = Localization.GetString("SortAscending", LocalResourceFile);
                    }
                    else
                    {
                        imageName = "arrow_down.png";
                        altText   = Localization.GetString("SortDescending", LocalResourceFile);
                    }
                    btnSortDir.CommandArgument = sortDir;
                    btnSortDir.AlternateText   = altText;
                    if (StoreSettings.PortalTemplates)
                    {
                        btnSortDir.ImageUrl = PortalSettings.HomeDirectory + "Store/Templates/Images/" + imageName;
                    }
                    else
                    {
                        btnSortDir.ImageUrl = TemplateSourceDirectory + "/Templates/Images/" + imageName;
                    }
                    btnSortDir.Click += btnSortDir_Click;
                    if (_productList.Count == 0)
                    {
                        btnSortDir.Enabled = false;
                    }
                    lblSortBy.Controls.Add(btnSortDir);
                    return(lblSortBy);
                }

                return(null);

            default:
                LiteralControl litText = new LiteralControl(tokenName);
                return(litText);
            }
        }
 private void InitializeAttributeRepeater(Repeater control, IEnumerable <EntityAttributeModel> attributeModels)
 {
     control.DataSource = attributeModels;
     control.DataBind();
 }
Example #22
0
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
     {
         Repeater  repeater  = (Repeater)e.Item.FindControl("rptSubList");
         OrderInfo orderInfo = OrderHelper.GetOrderInfo(DataBinder.Eval(e.Item.DataItem, "OrderID").ToString());
         if ((orderInfo != null) && (orderInfo.LineItems.Count > 0))
         {
             repeater.DataSource = orderInfo.LineItems.Values;
             repeater.DataBind();
         }
         OrderStatus status = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
         string      str    = "";
         if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
         {
             str = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
         }
         int             num              = (DataBinder.Eval(e.Item.DataItem, "GroupBuyId") != DBNull.Value) ? ((int)DataBinder.Eval(e.Item.DataItem, "GroupBuyId")) : 0;
         HtmlInputButton button           = (HtmlInputButton)e.Item.FindControl("btnModifyPrice");
         HtmlInputButton button2          = (HtmlInputButton)e.Item.FindControl("btnSendGoods");
         Button          button3          = (Button)e.Item.FindControl("btnPayOrder");
         Button          button4          = (Button)e.Item.FindControl("btnConfirmOrder");
         HtmlInputButton button5          = (HtmlInputButton)e.Item.FindControl("btnCloseOrderClient");
         HtmlAnchor      anchor1          = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
         HtmlAnchor      anchor2          = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReturn");
         HtmlAnchor      anchor3          = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReplace");
         Literal         literal          = (Literal)e.Item.FindControl("WeiXinNickName");
         Literal         literal2         = (Literal)e.Item.FindControl("litOtherInfo");
         int             totalPointNumber = orderInfo.GetTotalPointNumber();
         MemberInfo      member           = MemberProcessor.GetMember(orderInfo.UserId, true);
         if (member != null)
         {
             literal.Text = "买家:" + member.UserName;
         }
         StringBuilder builder = new StringBuilder();
         decimal       total   = orderInfo.GetTotal();
         if (total > 0M)
         {
             builder.Append("<strong>¥" + total.ToString("F2") + "</strong>");
             builder.Append("<small>(含运费¥" + orderInfo.AdjustedFreight.ToString("F2") + ")</small>");
         }
         if (totalPointNumber > 0)
         {
             builder.Append("<small>" + totalPointNumber.ToString() + "积分</small>");
         }
         if (orderInfo.PaymentType == "货到付款")
         {
             builder.Append("<span class=\"setColor bl\"><strong>货到付款</strong></span>");
         }
         if (string.IsNullOrEmpty(builder.ToString()))
         {
             builder.Append("<strong>¥" + total.ToString("F2") + "</strong>");
         }
         literal2.Text = builder.ToString();
         if (status == OrderStatus.WaitBuyerPay)
         {
             button.Visible = true;
             button.Attributes.Add("onclick", "DialogFrame('../trade/EditOrder.aspx?OrderId=" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'修改订单价格',900,450)");
             button5.Attributes.Add("onclick", "CloseOrderFun('" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "')");
             button5.Visible = true;
             if (str != "hishop.plugins.payment.podrequest")
             {
                 button3.Visible = true;
             }
         }
         if (num > 0)
         {
             GroupBuyStatus status2 = (GroupBuyStatus)DataBinder.Eval(e.Item.DataItem, "GroupBuyStatus");
             button2.Visible = (status == OrderStatus.BuyerAlreadyPaid) && (status2 == GroupBuyStatus.Success);
         }
         else
         {
             button2.Visible = (status == OrderStatus.BuyerAlreadyPaid) || ((status == OrderStatus.WaitBuyerPay) && (str == "hishop.plugins.payment.podrequest"));
         }
         button2.Attributes.Add("onclick", "DialogFrame('../trade/SendOrderGoods.aspx?OrderId=" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'订单发货',750,220)");
         button4.Visible = status == OrderStatus.SellerAlreadySent;
     }
 }
 protected override void AttachChildControls()
 {
     this.listOrders = (Repeater)this.FindControl("listOrders");
     this.listOrders.ItemDataBound += this.listOrders_ItemDataBound;
     this.listOrders.ItemCommand   += this.listOrders_RowCommand;
 }
Example #24
0
 // Use this for initialization
 void Start()
 {
     ourRepeater = new Repeater(30f);
        ourLastCycle = ourRepeater.Cycle();
 }
Example #25
0
    //public void loadState()
    //{
    //    info = new ListInfo();
    //    int page = 0;
    //    if (!CurPage.Value.Equals(""))
    //        page = Int32.Parse(CurPage.Value);
    //    info.loadState(Request, page);
    //    info.order = Order.Value.Equals("True");
    //    info.orderby = OrderBy.Value;
    //    if (info.orderby == "")
    //        info.orderby = null;
    //    info.recordPerPage = -1;
    //}
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        //ESSAuthorizationProcess authorization = new ESSAuthorizationProcess(dbConn);
        //List<EAuthorizationGroup> authGroupList = authorization.GetAuthorizerAuthorizationGroupList(CurID);

        //if (authGroupList.Count > 0)
        //{
        // Start 0000064, Miranda, 2014-09-19
        // Start 0000124, Miranda, 2014-11-10
        DBFilter filter = binding.createFilter();
        // End 0000124, Miranda, 2014-11-10
        // End 0000064, Miranda, 2014-09-19
        DateTime dtPeriodFr, dtPeriodTo;

        if (DateTime.TryParse(EmpRequestFromDate.Value, out dtPeriodFr))
        {
            filter.add(new Match("EmpRequestApprovalHistoryCreateDateTime", ">=", dtPeriodFr));
        }
        if (DateTime.TryParse(EmpRequestToDate.Value, out dtPeriodTo))
        {
            filter.add(new Match("EmpRequestApprovalHistoryCreateDateTime", "<", dtPeriodTo.AddDays(1)));
        }

        // Start 0000064, Miranda, 2014-09-19
        // Start 0000124, Miranda, 2014-11-10
        filter.add(new MatchField("R.EmpID", "E.EmpID"));
        // End 0000124, Miranda, 2014-11-10
        // End 0000064, Miranda, 2014-09-19
        filter.add(new MatchField("rah.EmpRequestID", "R.EmpRequestID"));
        // Start 0000208, Miranda, 2015-06-12
        //filter.add(new Match("rah.EmpRequestApprovalHistoryActionByEmpID", CurID));
        DBFilter m_filter = new DBFilter();

        m_filter.add(new Match("a.EmpID", CurID));
        DataTable m_table  = AppUtils.runSelectSQL("a.AuthorizationGroupID", "From " + EAuthorizer.db.dbclass.tableName + " a", m_filter, dbConn);
        DBFilter  a_filter = new DBFilter();

        if (m_table.Rows != null)
        {
            ArrayList list = new ArrayList();
            foreach (DataRow row in m_table.Rows)
            {
                list.Add(row[0].ToString());
            }
            String[] values = (String[])list.ToArray(typeof(String));
            a_filter.add(new IN("a.AuthorizationGroupID", values));
        }
        DataTable a_table = AppUtils.runSelectSQL("distinct a.EmpID", "From " + EAuthorizer.db.dbclass.tableName + " a", a_filter, dbConn);

        if (a_table.Rows != null)
        {
            ArrayList list = new ArrayList();
            foreach (DataRow row in a_table.Rows)
            {
                list.Add(row[0].ToString());
            }
            String[] values = (String[])list.ToArray(typeof(String));
            filter.add(new IN("rah.EmpRequestApprovalHistoryActionByEmpID", values));
        }
        // End 0000208, Miranda, 2015-06-12
        // Start 0000180, KuangWei, 2015-03-25
        // Start 0000064, Miranda, 2014-09-19
        // Start 0000124, Miranda, 2014-11-10
        string select = "R.*, rah.*, E.EmpNo, E.EmpEngSurname, E.EmpEngOtherName, E.EmpChiFullName, E.EmpAlias, E.EmpGender, E.EmpHKID, E.EmpPassportNo, L.LeaveCode, L.LeaveCodeDesc  ";
        string from   = "from " + db.dbclass.tableName + " R , " + EEmpRequestApprovalHistory.db.dbclass.tableName + " rah "
                        + ", " + EEmpPersonalInfo.db.dbclass.tableName + " E  " + ", " + ERequestLeaveApplication.db.dbclass.tableName + " C, " + ELeaveCode.db.dbclass.tableName + " L";

        // End 0000124, Miranda, 2014-11-10
        // End 0000064, Miranda, 2014-09-19
        filter.add(new MatchField("C.RequestLeaveAppID", "R.EmpRequestRecordID"));
        filter.add(new MatchField("L.LeaveCodeID", "C.RequestLeaveCodeID"));
        // End 0000180, KuangWei, 2015-03-25

        // Start 0000124, Miranda, 2014-11-10
        DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());

        empInfoFilter.add(new MatchField("E.EmpID", "ee.EmpID"));
        filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter));
        // End 0000124, Miranda, 2014-11-10

        //DBFilter authorizerFilter = new DBFilter();
        //authorizerFilter.add(new Match("EmpID", CurID));

        //OR orFirstGrpStatusTerms = new OR();
        //orFirstGrpStatusTerms.add(new Match("R.EmpRequestStatus", EEmpRequest.STATUS_SUBMITTED));

        //DBFilter firstGrpFilter = new DBFilter();
        //firstGrpFilter.add(orFirstGrpStatusTerms);
        //firstGrpFilter.add(orAuthorizationGrpApplicationTerms);
        //firstGrpFilter.add(new IN("AuthorizationGroupID", "Select AuthorizationGroupID from " + EAuthorizer.db.dbclass.tableName, authorizerFilter));


        //OR orSecondGrpStatusTerms = new OR();
        //orSecondGrpStatusTerms.add(new Match("R.EmpRequestStatus", EEmpRequest.STATUS_SUBMITTED));
        //orSecondGrpStatusTerms.add(new Match("R.EmpRequestStatus", EEmpRequest.STATUS_ACCEPTED));

        //DBFilter secondGrpFilter = new DBFilter();
        //secondGrpFilter.add(orSecondGrpStatusTerms);
        //secondGrpFilter.add(orAuthorizationGrpApplicationTerms);
        //secondGrpFilter.add(new IN("AuthorizationGroupID", "Select AuthorizationGroupID from " + EAuthorizer.db.dbclass.tableName, authorizerFilter));

        //OR orAuthorizationGrpFilter = new OR();
        //orAuthorizationGrpFilter.add(new IN("EP.EmpFirstAuthorizationGp", "Select AuthorizationGroupID from " + EAuthorizationGroup.db.dbclass.tableName, firstGrpFilter));
        //orAuthorizationGrpFilter.add(new IN("EP.EmpSecondAuthorizationGp", "Select AuthorizationGroupID from " + EAuthorizationGroup.db.dbclass.tableName, secondGrpFilter));
        //filter.add(orAuthorizationGrpFilter);

        // Start 0000124, Miranda, 2014-11-10
        DataTable table = filter.loadData(dbConn, null, select, from);

        table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);
        // Start 0000064, Miranda, 2014-09-19
        //if (table.Rows.Count > 0)
        //    table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, new ListInfo());
        // End 0000064, Miranda, 2014-09-19
        // End 0000124, Miranda, 2014-11-10


        view = new DataView(table);

        ListFooter.Refresh();

        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }
        return(view);
        //}
        //else
        //    return null;
    }
Example #26
0
        /// <summary>
        /// Bound từng ngày
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void rptBookingList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Control ctrl = e.Item.FindControl("plhPeriodExpense");

            if (ctrl != null)
            {
                ctrl.Visible = PeriodExpenseAvg;
            }

            if (e.Item.DataItem is SailExpense)
            {
                #region -- Tính toán chi phí & hiển thị --

                SailExpense expense = ExpenseCalculate(e);

                Plus(_currentCostMap); // Cộng bảng chi phí

                #region -- Show info --
                Repeater rptServices = (Repeater)e.Item.FindControl("rptServices");
                rptServices.DataSource = AllCostTypes;
                rptServices.DataBind();

                Literal litTotal = e.Item.FindControl("litTotal") as Literal;
                if (litTotal != null)
                {
                    litTotal.Text = _currentTotal.ToString("#,0.#");
                }

                HyperLink hplDate = e.Item.FindControl("hplDate") as HyperLink;
                if (hplDate != null)
                {
                    hplDate.Text = expense.Date.ToString("dd/MM/yyyy");
                }

                #endregion

                return;

                #endregion
            }

            #region -- Header --
            if (e.Item.ItemType == ListItemType.Header)
            {
                Repeater rptServices = (Repeater)e.Item.FindControl("rptServices");
                rptServices.DataSource = AllCostTypes;
                rptServices.DataBind();
            }
            #endregion

            #region -- Footer --
            if (e.Item.ItemType == ListItemType.Footer)
            {
                Repeater rptServices = (Repeater)e.Item.FindControl("rptServices");
                rptServices.DataSource = AllCostTypes;
                rptServices.DataBind();

                double total = 0;
                foreach (CostType type in AllCostTypes)
                {
                    total += _grandTotal[type];
                }

                total += _month;
                total += _year;

                Literal litMonth = e.Item.FindControl("litMonth") as Literal;
                if (litMonth != null)
                {
                    litMonth.Text = _month.ToString("#,0.#");
                }

                Literal litYear = e.Item.FindControl("litYear") as Literal;
                if (litYear != null)
                {
                    litYear.Text = _year.ToString("#,0.#");
                }

                Literal litTotal = e.Item.FindControl("litTotal") as Literal;
                if (litTotal != null)
                {
                    litTotal.Text = total.ToString("#,0.#");
                }
            }
            #endregion
        }
Example #27
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ListInfo listInfo)
        {
            var parsedContent = string.Empty;

            var titleWordNum = contextInfo.TitleWordNum;

            contextInfo.TitleWordNum = listInfo.TitleWordNum;

            var dataSource = GetDataSource(pageInfo, contextInfo, listInfo);

            if (listInfo.Layout == ELayout.None)
            {
                var rptContents = new Repeater
                {
                    ItemTemplate =
                        new RepeaterTemplate(listInfo.ItemTemplate, listInfo.SelectedItems,
                                             listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat,
                                             pageInfo, EContextType.Content, contextInfo)
                };

                if (!string.IsNullOrEmpty(listInfo.HeaderTemplate))
                {
                    rptContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(listInfo.FooterTemplate))
                {
                    rptContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate))
                {
                    rptContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate))
                {
                    rptContents.AlternatingItemTemplate = new RepeaterTemplate(listInfo.AlternatingItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo);
                }

                rptContents.DataSource = dataSource;
                rptContents.DataBind();

                if (rptContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(rptContents);
                }
            }
            else
            {
                var pdlContents = new ParsedDataList();

                TemplateUtility.PutListInfoToMyDataList(pdlContents, listInfo);

                pdlContents.ItemTemplate = new DataListTemplate(listInfo.ItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo);
                if (!string.IsNullOrEmpty(listInfo.HeaderTemplate))
                {
                    pdlContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(listInfo.FooterTemplate))
                {
                    pdlContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate))
                {
                    pdlContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate))
                {
                    pdlContents.AlternatingItemTemplate = new DataListTemplate(listInfo.AlternatingItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo);
                }

                pdlContents.DataSource   = dataSource;
                pdlContents.DataKeyField = ContentAttribute.Id;
                pdlContents.DataBind();

                if (pdlContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(pdlContents);
                }
            }

            contextInfo.TitleWordNum = titleWordNum;

            return(parsedContent);
        }
Example #28
0
    void setup()
    {
        om = (IOrderManager)RemoteNew.New(typeof(IOrderManager));

        //Listen to any order that has changed
        orderRepeater = new Repeater();
        orderRepeater.orderChanged += new orderChangedDelegate(orderChangedHandler);
        om.orderChangedEvent += new orderChangedDelegate(orderRepeater.orderChangedRepeater);

        //Listen to new kitchen orders
        orderRepeater.newOrderKitchen += new newOrderKitchenDelegate(newOrderHandler);
        om.newOrderKitchenEvent += new newOrderKitchenDelegate(orderRepeater.newOrderKitchenRepeater);

        //Listen to new bar orders
        orderRepeater.newOrderBar += new newOrderBarDelegate(newOrderHandler);
        om.newOrderBarEvent += new newOrderBarDelegate(orderRepeater.newOrderKitchenRepeater);

        //Listen to removed orders
        orderRepeater.tableRemoved += new tableRemovedDelegate(removedTableHandler);
        om.tableRemovedEvent += new tableRemovedDelegate(orderRepeater.tableRemovedRepeater);

        setupTables(om.getAllOrders());
        if (Program.debug) Console.WriteLine("Setup was made");
    }
        /// <summary>
        /// Handles the ItemDataBound event of the rptrGroups control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterItemEventArgs"/> instance containing the event data.</param>
        protected void rptrGroups_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var group = e.Item.DataItem as Group;
                if (group != null)
                {
                    HyperLink hlEditGroup = e.Item.FindControl("hlEditGroup") as HyperLink;
                    if (hlEditGroup != null)
                    {
                        hlEditGroup.Visible = _allowEdit;
                        var pageParams = new Dictionary <string, string>();
                        pageParams.Add("PersonId", Person.Id.ToString());
                        pageParams.Add("GroupId", group.Id.ToString());
                        hlEditGroup.NavigateUrl = LinkedPageUrl("GroupEditPage", pageParams);
                    }

                    var lReorderIcon = e.Item.FindControl("lReorderIcon") as Control;
                    lReorderIcon.Visible = _showReorderIcon;

                    Repeater rptrMembers = e.Item.FindControl("rptrMembers") as Repeater;
                    if (rptrMembers != null)
                    {
                        // use the _bindGroupsRockContext that is created/disposed in BindFamilies()
                        var members = new GroupMemberService(_bindGroupsRockContext).Queryable("GroupRole,Person", true)
                                      .Where(m =>
                                             m.GroupId == group.Id &&
                                             m.PersonId != Person.Id)
                                      .OrderBy(m => m.GroupRole.Order)
                                      .ToList();

                        var groupHeaderLava = GetAttributeValue("GroupHeaderLava");
                        var groupFooterLava = GetAttributeValue("GroupFooterLava");

                        if (groupHeaderLava.IsNotNullOrWhitespace() || groupFooterLava.IsNotNullOrWhitespace())
                        {
                            // add header and footer information
                            var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields(this.RockPage, CurrentPerson);
                            mergeFields.Add("Group", group);
                            mergeFields.Add("GroupMembers", members);

                            Literal lGroupHeader = e.Item.FindControl("lGroupHeader") as Literal;
                            Literal lGroupFooter = e.Item.FindControl("lGroupFooter") as Literal;

                            lGroupHeader.Text = groupHeaderLava.ResolveMergeFields(mergeFields);
                            lGroupFooter.Text = groupHeaderLava.ResolveMergeFields(mergeFields);
                        }

                        var orderedMembers = new List <GroupMember>();

                        if (_IsFamilyGroupType)
                        {
                            // Add adult males
                            orderedMembers.AddRange(members
                                                    .Where(m => m.GroupRole.Guid.Equals(new Guid(Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT)) &&
                                                           m.Person.Gender == Gender.Male)
                                                    .OrderByDescending(m => m.Person.Age));

                            // Add adult females
                            orderedMembers.AddRange(members
                                                    .Where(m => m.GroupRole.Guid.Equals(new Guid(Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT)) &&
                                                           m.Person.Gender != Gender.Male)
                                                    .OrderByDescending(m => m.Person.Age));

                            // Add non-adults
                            orderedMembers.AddRange(members
                                                    .Where(m => !m.GroupRole.Guid.Equals(new Guid(Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT)))
                                                    .OrderByDescending(m => m.Person.Age));
                        }
                        else
                        {
                            orderedMembers = members
                                             .OrderBy(m => m.GroupRole.Order)
                                             .ThenBy(m => m.Person.LastName)
                                             .ThenBy(m => m.Person.NickName)
                                             .ToList();
                        }
                        rptrMembers.ItemDataBound += rptrMembers_ItemDataBound;
                        rptrMembers.DataSource     = orderedMembers;
                        rptrMembers.DataBind();
                    }

                    Repeater rptrAddresses = e.Item.FindControl("rptrAddresses") as Repeater;
                    if (rptrAddresses != null)
                    {
                        rptrAddresses.ItemDataBound += rptrAddresses_ItemDataBound;
                        rptrAddresses.ItemCommand   += rptrAddresses_ItemCommand;
                        rptrAddresses.DataSource     = new GroupLocationService(_bindGroupsRockContext).Queryable("Location,GroupLocationTypeValue")
                                                       .Where(l => l.GroupId == group.Id)
                                                       .OrderBy(l => l.GroupLocationTypeValue.Order)
                                                       .ToList();
                        rptrAddresses.DataBind();
                    }

                    Panel       pnlGroupAttributes    = e.Item.FindControl("pnlGroupAttributes") as Panel;
                    HyperLink   hlShowMoreAttributes  = e.Item.FindControl("hlShowMoreAttributes") as HyperLink;
                    PlaceHolder phGroupAttributes     = e.Item.FindControl("phGroupAttributes") as PlaceHolder;
                    PlaceHolder phMoreGroupAttributes = e.Item.FindControl("phMoreGroupAttributes") as PlaceHolder;

                    if (pnlGroupAttributes != null && hlShowMoreAttributes != null && phGroupAttributes != null && phMoreGroupAttributes != null)
                    {
                        hlShowMoreAttributes.Visible = false;
                        phGroupAttributes.Controls.Clear();
                        phMoreGroupAttributes.Controls.Clear();

                        group.LoadAttributes();
                        var attributes = group.GetAuthorizedAttributes(Authorization.VIEW, CurrentPerson)
                                         .Select(a => a.Value)
                                         .OrderBy(a => a.Order)
                                         .ToList();

                        foreach (var attribute in attributes)
                        {
                            if (attribute.IsAuthorized(Authorization.VIEW, CurrentPerson))
                            {
                                string value = attribute.DefaultValue;
                                if (group.AttributeValues.ContainsKey(attribute.Key) && group.AttributeValues[attribute.Key] != null)
                                {
                                    value = group.AttributeValues[attribute.Key].ValueFormatted;
                                }

                                if (!string.IsNullOrWhiteSpace(value))
                                {
                                    var literalControl = new RockLiteral();
                                    literalControl.ID    = string.Format("familyAttribute_{0}", attribute.Id);
                                    literalControl.Label = attribute.Name;
                                    literalControl.Text  = value;

                                    var div = new HtmlGenericControl("div");
                                    div.AddCssClass("col-md-3 col-sm-6");
                                    div.Controls.Add(literalControl);

                                    if (attribute.IsGridColumn)
                                    {
                                        phGroupAttributes.Controls.Add(div);
                                    }
                                    else
                                    {
                                        hlShowMoreAttributes.Visible = true;
                                        phMoreGroupAttributes.Controls.Add(div);
                                    }
                                }
                            }
                        }

                        pnlGroupAttributes.Visible = phGroupAttributes.Controls.Count > 0 || phMoreGroupAttributes.Controls.Count > 0;
                    }
                }
            }
        }
 public void Load_img_news(int take, int skip, ref Repeater rp)
 {
     rp.DataSource = pro_detail.Load_Product_Detail(_sNewsSeoUrl);
     rp.DataBind();
 }
    protected void rptOperations_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        OperationWithRoleAuth opAuth = (OperationWithRoleAuth)e.Item.DataItem;

        int    opId                   = opAuth.OpId;
        string opSubject              = opAuth.OpSubject;
        bool   canRead                = opAuth.CanRead;
        bool   canEdit                = opAuth.CanEdit;
        bool   canReadSubItemOfSelf   = opAuth.CanReadSubItemOfSelf;
        bool   canEditSubItemOfSelf   = opAuth.CanEditSubItemOfSelf;
        bool   canAddSubItemOfSelf    = opAuth.CanAddSubItemOfSelf;
        bool   canDelSubItemOfSelf    = opAuth.CanDelSubItemOfSelf;
        bool   canReadSubItemOfCrew   = opAuth.CanReadSubItemOfCrew;
        bool   canEditSubItemOfCrew   = opAuth.CanEditSubItemOfCrew;
        bool   canDelSubItemOfCrew    = opAuth.CanDelSubItemOfCrew;
        bool   canReadSubItemOfOthers = opAuth.CanReadSubItemOfOthers;
        bool   canEditSubItemOfOthers = opAuth.CanEditSubItemOfOthers;
        bool   canDelSubItemOfOthers  = opAuth.CanDelSubItemOfOthers;

        if (c.seCultureNameOfBackend == "en")
        {
            opSubject = opAuth.EnglishSubject;
        }

        string   lastMdfAccount = "";
        DateTime?lastMdfDate    = null;

        if (opAuth.MdfDate.HasValue)
        {
            lastMdfAccount = opAuth.MdfAccount;
            lastMdfDate    = opAuth.MdfDate;
        }
        else if (opAuth.PostDate.HasValue)
        {
            lastMdfAccount = opAuth.PostAccount;
            lastMdfDate    = opAuth.PostDate;
        }

        HtmlTableRow OpArea = (HtmlTableRow)e.Item.FindControl("OpArea");

        OpArea.Attributes.Add("opid", opId.ToString());

        Literal ltrSeqno = (Literal)e.Item.FindControl("ltrSeqno");

        if (sender == rptOperations)
        {
            OpArea.Attributes["class"] += " lv1";
            tempLv1Seqno  = e.Item.ItemIndex + 1;
            ltrSeqno.Text = tempLv1Seqno.ToString();
        }
        else
        {
            OpArea.Attributes["class"] += " lv2";
            ltrSeqno.Text = string.Format("{0}-{1}", tempLv1Seqno, e.Item.ItemIndex + 1);
        }

        HtmlImage imgOpItem = (HtmlImage)e.Item.FindControl("imgOpItem");

        imgOpItem.Alt = opSubject;
        imgOpItem.Src = "~/BPimages/icon/data.gif";
        string iconImageFile = opAuth.IconImageFile;

        if (!string.IsNullOrEmpty(iconImageFile))
        {
            imgOpItem.Src = string.Format("~/BPimages/icon/{0}", iconImageFile);
        }

        Literal ltrOpItemSubject = (Literal)e.Item.FindControl("ltrOpItemSubject");

        ltrOpItemSubject.Text = opSubject;

        if (lastMdfDate.HasValue)
        {
            Literal ltrLastUpdateInfo = (Literal)e.Item.FindControl("ltrLastUpdateInfo");

            string modificationInfo = string.Format(
                "<span class='mdf-info text-info' title='{0}: {1}, {2:yyyy-MM-dd HH:mm:ss}'><i class='fa fa-info-circle'></i></span>",
                Resources.Lang.Col_LastUpdate, lastMdfAccount, lastMdfDate);
            ltrLastUpdateInfo.Text = " " + modificationInfo;
        }

        Literal         ltrPvgOfItem = (Literal)e.Item.FindControl("ltrPvgOfItem");
        HtmlInputHidden hidPvgOfItem = (HtmlInputHidden)e.Item.FindControl("hidPvgOfItem");
        int             pvgOfItem    = 0;

        if (!canRead)
        {
            ltrPvgOfItem.Text += tagHtmlNotAllowed;
        }

        if (canRead)
        {
            ltrPvgOfItem.Text += tagHtmlRead;
            pvgOfItem         |= 1;
            hidPvgOfItem.Value = pvgOfItem.ToString();
        }

        if (canEdit)
        {
            ltrPvgOfItem.Text += tagHtmlEdit;
            pvgOfItem         |= 2;
            hidPvgOfItem.Value = pvgOfItem.ToString();
        }

        Literal         ltrPvgOfSubitemSelf = (Literal)e.Item.FindControl("ltrPvgOfSubitemSelf");
        HtmlInputHidden hidPvgOfSubitemSelf = (HtmlInputHidden)e.Item.FindControl("hidPvgOfSubitemSelf");
        int             pvgOfSubitemSelf    = 0;

        if (!canReadSubItemOfSelf)
        {
            ltrPvgOfSubitemSelf.Text += tagHtmlNotAllowed;
        }

        if (canReadSubItemOfSelf)
        {
            ltrPvgOfSubitemSelf.Text += tagHtmlRead;
            pvgOfSubitemSelf         |= 1;
            hidPvgOfSubitemSelf.Value = pvgOfSubitemSelf.ToString();
        }

        if (canEditSubItemOfSelf)
        {
            ltrPvgOfSubitemSelf.Text += tagHtmlEdit;
            pvgOfSubitemSelf         |= 2;
            hidPvgOfSubitemSelf.Value = pvgOfSubitemSelf.ToString();
        }

        if (canAddSubItemOfSelf)
        {
            ltrPvgOfSubitemSelf.Text += tagHtmlAdd;
            pvgOfSubitemSelf         |= 4;
            hidPvgOfSubitemSelf.Value = pvgOfSubitemSelf.ToString();
        }

        if (canDelSubItemOfSelf)
        {
            ltrPvgOfSubitemSelf.Text += tagHtmlDelete;
            pvgOfSubitemSelf         |= 8;
            hidPvgOfSubitemSelf.Value = pvgOfSubitemSelf.ToString();
        }

        Literal         ltrPvgOfSubitemCrew = (Literal)e.Item.FindControl("ltrPvgOfSubitemCrew");
        HtmlInputHidden hidPvgOfSubitemCrew = (HtmlInputHidden)e.Item.FindControl("hidPvgOfSubitemCrew");
        int             pvgOfSubitemCrew    = 0;

        if (!canReadSubItemOfCrew)
        {
            ltrPvgOfSubitemCrew.Text += tagHtmlNotAllowed;
        }

        if (canReadSubItemOfCrew)
        {
            ltrPvgOfSubitemCrew.Text += tagHtmlRead;
            pvgOfSubitemCrew         |= 1;
            hidPvgOfSubitemCrew.Value = pvgOfSubitemCrew.ToString();
        }

        if (canEditSubItemOfCrew)
        {
            ltrPvgOfSubitemCrew.Text += tagHtmlEdit;
            pvgOfSubitemCrew         |= 2;
            hidPvgOfSubitemCrew.Value = pvgOfSubitemCrew.ToString();
        }

        if (canDelSubItemOfCrew)
        {
            ltrPvgOfSubitemCrew.Text += tagHtmlDelete;
            pvgOfSubitemCrew         |= 8;
            hidPvgOfSubitemCrew.Value = pvgOfSubitemCrew.ToString();
        }

        Literal         ltrPvgOfSubitemOthers = (Literal)e.Item.FindControl("ltrPvgOfSubitemOthers");
        HtmlInputHidden hidPvgOfSubitemOthers = (HtmlInputHidden)e.Item.FindControl("hidPvgOfSubitemOthers");
        int             pvgOfSubitemOthers    = 0;

        if (!canReadSubItemOfOthers)
        {
            ltrPvgOfSubitemOthers.Text += tagHtmlNotAllowed;
        }

        if (canReadSubItemOfOthers)
        {
            ltrPvgOfSubitemOthers.Text += tagHtmlRead;
            pvgOfSubitemOthers         |= 1;
            hidPvgOfSubitemOthers.Value = pvgOfSubitemOthers.ToString();
        }

        if (canEditSubItemOfOthers)
        {
            ltrPvgOfSubitemOthers.Text += tagHtmlEdit;
            pvgOfSubitemOthers         |= 2;
            hidPvgOfSubitemOthers.Value = pvgOfSubitemOthers.ToString();
        }

        if (canDelSubItemOfOthers)
        {
            ltrPvgOfSubitemOthers.Text += tagHtmlDelete;
            pvgOfSubitemOthers         |= 8;
            hidPvgOfSubitemOthers.Value = pvgOfSubitemOthers.ToString();
        }

        Repeater rptSubOperations = (Repeater)e.Item.FindControl("rptSubOperations");

        if (rptSubOperations != null)
        {
            rptSubOperations.DataSource = opAuth.SubItems;
            rptSubOperations.DataBind();
        }
    }
    public static void Process_Pagination(DataList _list, Repeater _rept, LinkButton _prev, LinkButton _next, int _size, int _pagenumber, IEnumerable _source, int _totalrecords)
    {
        int total_pages = (int)Math.Ceiling((double)_totalrecords / _size);
        if (total_pages > 1)
        {
            // Previous Link Scripting
            if (_pagenumber > 1)
            {
                _prev.Visible = true;
                int firstbound = (((_pagenumber - 1) - 1) * _size) + 1;
                if (firstbound < 0)
                    firstbound = 1;
                int lastbound = firstbound + _size - 1;
                _prev.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
            }
            else
            {
                _prev.Visible = false;
            }
            // Next Link Scripting
            if (_pagenumber < total_pages)
            {
                _next.Visible = true;
                int firstbound = (((_pagenumber + 1) - 1) * _size) + 1;
                int lastbound = firstbound + _size - 1;
                if (lastbound > _totalrecords)
                    lastbound = _totalrecords;
                _next.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
            }
            else
            {
                _next.Visible = false;
            }

            // main pagination links
            ArrayList arr = Return_Pagination_Link_v2(total_pages, _pagenumber);
            _rept.Visible = true;
            _rept.DataSource = arr;
            _rept.DataBind();
        }
        else
        {
            _rept.Visible = false;
            _next.Visible = false;
            _prev.Visible = false;
        }

        _list.DataSource = _source;
        _list.DataBind();
    }
Example #33
0
    protected void rptAtividadesSugeridas_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            Repeater rptAtividadesSugeridasInterna = (Repeater)e.Item.FindControl("rptAtividadesSugeridasInterna");
            Literal  ltrIdLocal = (Literal)e.Item.FindControl("ltrIdLocal");
            Katapoka.DAO.Atividade.TipoAtividade item = (Katapoka.DAO.Atividade.TipoAtividade)e.Item.DataItem;

            Katapoka.DAO.Usuario_Tb usuarioAssociado = item.IdTipoAtividade != null ? new Katapoka.BLL.Atividade.AtividadeBLL()
                                                       .GetUsuariosPermitidos(item.IdTipoAtividade.Value)
                                                       .FirstOrDefault() : null;
            if (usuarioAssociado != null)
            {
                IList <Katapoka.DAO.UsuarioCompleto> usuarioCompleto = new List <Katapoka.DAO.UsuarioCompleto>();
                usuarioCompleto.Add(new Katapoka.DAO.UsuarioCompleto()
                {
                    DsNome    = usuarioAssociado.DsNome,
                    IdUsuario = usuarioAssociado.IdUsuario
                });
                usuariosSugeridos.Add(IdIncremento, usuarioCompleto);
            }

            ltrIdLocal.Text = IdIncremento.ToString();
            IdIncremento++;

            #region PREENCHE OS DADOS
            HtmlInputText txtTituloAtividade = (HtmlInputText)e.Item.FindControl("txtTituloAtividade");
            if (txtTituloAtividade != null)
            {
                txtTituloAtividade.Value = !string.IsNullOrWhiteSpace(item.DsTituloAtividade) ? item.DsTituloAtividade : "Título da atividade";
            }

            HtmlInputText txtQtTempoEstimado = (HtmlInputText)e.Item.FindControl("txtQtTempoEstimado");
            if (txtQtTempoEstimado != null)
            {
                TimeSpan tempoEstimado = TimeSpan.FromHours((double)item.QtTempoEstimado);
                txtQtTempoEstimado.Value = string.Format("{0:000}:{1:00}", Math.Floor(tempoEstimado.TotalHours), tempoEstimado.Minutes);
            }

            HtmlInputText txtQtTempoExecutado = (HtmlInputText)e.Item.FindControl("txtQtTempoExecutado");
            if (txtQtTempoExecutado != null)
            {
                txtQtTempoExecutado.Value = "000:00";
            }

            HtmlInputText txtVrCompletoPorcentagem = (HtmlInputText)e.Item.FindControl("txtVrCompletoPorcentagem");
            txtVrCompletoPorcentagem.Value = "0";

            HtmlInputText txtDtInicio = (HtmlInputText)e.Item.FindControl("txtDtInicio");
            txtDtInicio.Value = DateTime.Now.ToString("dd/MM/yyyy");

            HtmlInputText txtDtTermino = (HtmlInputText)e.Item.FindControl("txtDtTermino");
            txtDtTermino.Value = DateTime.Now.Add(TimeSpan.FromHours((double)item.QtTempoEstimado)).ToString("dd/MM/yyyy");

            HtmlTextArea txtDescricaoAtividade = (HtmlTextArea)e.Item.FindControl("txtDescricaoAtividade");
            txtDescricaoAtividade.InnerText = item.DsAtividade;
            #endregion

            rptAtividadesSugeridasInterna.ItemTemplate            = rptAtividadesSugeridas.ItemTemplate;
            rptAtividadesSugeridasInterna.AlternatingItemTemplate = rptAtividadesSugeridas.AlternatingItemTemplate;
            rptAtividadesSugeridasInterna.ItemDataBound          += rptAtividadesSugeridas_ItemDataBound;
            rptAtividadesSugeridasInterna.DataSource = atividadesSugeridas
                                                       .Where(p => p.IdTipoAtividadePredecessora == item.IdTipoAtividade)
                                                       .ToList();
            rptAtividadesSugeridasInterna.DataBind();
        }
    }
 private void BindCourse(string strGrade, Label lblCredits, Repeater rptCourse, string portfolioID)
 {
     strSQL = " select a.CourseCode,a.CourseName,a.Credits,isnull(a.MarkReceived,'') MarkReceived,a.CourseLength,s.StatusDescr" + SuffixCode() + " as CourseStatus ";
     strSQL += " from Port_PLPCoursesStudent a join ClusterPOSGrid b on a.GridID=b.POSGridID JOIN Port_PLPCourseStatusLookup s on a.Status = s.StatusID where b.POSGrade = " + strGrade + " and CourseID is null and PortfolioID=" + portfolioID;
     strSQL += " UNION ALL";
     strSQL += " select c.CourseCode,c.CourseName,c.Credits,isnull(a.MarkReceived,'') MarkReceived,c.CourseLength,s.StatusDescr" + SuffixCode() + " as CourseStatus ";
     strSQL += " from Port_PLPCoursesStudent a join ClusterPOSGrid b on a.GridID=b.POSGridID Join Port_PLPCoursesSchool c on a.CourseID = c.CourseID JOIN Port_PLPCourseStatusLookup s on a.Status = s.StatusID where b.POSGrade = " + strGrade + " and PortfolioID=" + portfolioID;
     strSQL += " ; WITH CTE AS (select a.Credits ";
     strSQL += " from Port_PLPCoursesStudent a join ClusterPOSGrid b on a.GridID=b.POSGridID JOIN Port_PLPCourseStatusLookup s on a.Status = s.StatusID where b.POSGrade = " + strGrade + " and CourseID is null and Status != 4 and PortfolioID=" + portfolioID;
     strSQL += " UNION ALL";
     strSQL += " select c.Credits";
     strSQL += " from Port_PLPCoursesStudent a join ClusterPOSGrid b on a.GridID=b.POSGridID Join Port_PLPCoursesSchool c on a.CourseID = c.CourseID JOIN Port_PLPCourseStatusLookup s on a.Status = s.StatusID where b.POSGrade = " + strGrade + " and Status != 4 and PortfolioID=" + portfolioID;
     strSQL += " ) select isnull(sum(Credits),0) TTLCredits from CTE ";
     dtsSource = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTables(strSQL);
     dtCourse = dtsSource[0];
     dtCredits = dtsSource[1];
     rptCourse.DataSource = dtCourse;
     rptCourse.DataBind();
     lblCredits.Text = dtCredits.Rows[0]["TTLCredits"].ToString();
     decTTLCredits += Convert.ToDecimal(dtCredits.Rows[0]["TTLCredits"]);
 }
Example #35
0
    protected void rptAtividades_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            Repeater rptInterno            = (Repeater)e.Item.FindControl("rptAtividadesInterna");
            Katapoka.DAO.Atividade_Tb item = (Katapoka.DAO.Atividade_Tb)e.Item.DataItem;
            Literal ltrIdLocal             = (Literal)e.Item.FindControl("ltrIdLocal");

            //Adiciona as tags
            tags.Add(item.IdAtividade, item.AtividadeTag_Tb.Select(p => new Katapoka.DAO.Tag.TagCompleta()
            {
                DsTag = p.Tag_Tb.DsTag,
                IdTag = p.IdTag
            }).ToList());

            //Adiciona os usuários designados
            usuarios.Add(item.IdAtividade, item.AtividadeUsuario_Tb.Select(p => new Katapoka.DAO.UsuarioCompleto()
            {
                IdUsuario = p.IdUsuario,
                DsNome    = p.Usuario_Tb.DsNome
            }).ToList());

            ltrIdLocal.Text = IdIncremento.ToString();
            IdIncremento++;

            #region PREENCHE OS DADOS
            Literal       ltrTituloAtividade = (Literal)e.Item.FindControl("ltrTituloAtividade");
            HtmlInputText txtTituloAtividade = (HtmlInputText)e.Item.FindControl("txtTituloAtividade");
            if (txtTituloAtividade != null)
            {
                txtTituloAtividade.Value = !string.IsNullOrWhiteSpace(item.DsTituloAtividade) ? item.DsTituloAtividade : "Título da atividade";
            }
            ltrTituloAtividade.Text = txtTituloAtividade.Value;

            HtmlInputText txtQtTempoEstimado = (HtmlInputText)e.Item.FindControl("txtQtTempoEstimado");
            if (txtQtTempoEstimado != null)
            {
                if (item.QtTempoEstimado != null)
                {
                    TimeSpan tempoEstimado = TimeSpan.FromHours((double)item.QtTempoEstimado.Value);
                    txtQtTempoEstimado.Value = string.Format("{0:000}:{1:00}", Math.Floor(tempoEstimado.TotalHours), tempoEstimado.Minutes);
                }
            }

            HtmlInputText txtQtTempoExecutado = (HtmlInputText)e.Item.FindControl("txtQtTempoExecutado");
            if (txtQtTempoExecutado != null)
            {
                TimeSpan tempoExecutado = TimeSpan.FromHours((double)item.QtTempoExecutado);
                txtQtTempoExecutado.Value = string.Format("{0:000}:{1:00}", Math.Floor(tempoExecutado.TotalHours), tempoExecutado.Minutes);
            }

            HtmlInputText txtVrCompletoPorcentagem = (HtmlInputText)e.Item.FindControl("txtVrCompletoPorcentagem");
            if (txtVrCompletoPorcentagem != null && item.VrCompletoPorcentagem != null)
            {
                txtVrCompletoPorcentagem.Value = item.VrCompletoPorcentagem.ToString();
            }

            HtmlInputText txtDtInicio = (HtmlInputText)e.Item.FindControl("txtDtInicio");
            if (txtDtInicio != null && item.DtInicio != null)
            {
                txtDtInicio.Value = item.DtInicio.Value.ToString("dd/MM/yyyy");
            }

            HtmlInputText txtDtTermino = (HtmlInputText)e.Item.FindControl("txtDtTermino");
            if (txtDtTermino != null && item.DtTermino != null)
            {
                txtDtTermino.Value = item.DtTermino.Value.ToString("dd/MM/yyyy");
            }

            HtmlTextArea txtDescricaoAtividade = (HtmlTextArea)e.Item.FindControl("txtDescricaoAtividade");
            txtDescricaoAtividade.InnerText = item.DsAtividade;
            #endregion

            //rptInterno.HeaderTemplate = rptAtividades.HeaderTemplate;
            //rptInterno.FooterTemplate = rptAtividades.FooterTemplate;
            rptInterno.ItemTemplate            = rptAtividades.ItemTemplate;
            rptInterno.AlternatingItemTemplate = rptAtividades.AlternatingItemTemplate;
            rptInterno.ItemDataBound          += rptAtividades_ItemDataBound;
            rptInterno.DataSource = atividades.Where(p => p.IdAtividadePredecessora == item.IdAtividade).ToList();
            rptInterno.DataBind();
        }
    }
Example #36
0
 void rightButtonEvent(uint port, uint state, DateTime time)
 {
     lock (this)
     {
         if (repeatRight == null)
         {
             Repeater repeat = new Repeater(rightButtonFire, racketSpeed);
             repeatRight = new Thread(new ThreadStart(repeat.run));
             repeatRight.Start();
             rightButtonFire(port, state, time);
         }
         else
         {
             repeatRight.Abort();
             repeatRight = null;
         }
     }
 }
        /// <summary>
        /// Dùng cho sự kiện data bound của một danh sách booking room
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="module"></param>
        /// <param name="customPrice"></param>
        /// <param name="policies"></param>
        /// <param name="page"></param>
        /// <param name="roomTypes"></param>
        public static void rptRoomList_itemDataBound(object sender, RepeaterItemEventArgs e, SailsModule module, bool customPrice, IList policies, SailsAdminBasePage page, ListItemCollection roomTypes)
        {
            if (e.Item.ItemType != ListItemType.Header)
            {
                BookingRoom item = e.Item.DataItem as BookingRoom;
                if (item != null)
                {
                    #region -- Thông tin thường --

                    Label lblRoomName = (Label)e.Item.FindControl("lblRoomName");
                    if (item.Room != null)
                    {
                        Label label_RoomId = (Label)e.Item.FindControl("label_RoomId");
                        label_RoomId.Text = item.Room.Id.ToString();
                        if (item.Room != null)
                        {
                            lblRoomName.Text = string.Format("{2}: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{0} {1}",
                                                             item.RoomClass.Name, item.RoomType.Name,
                                                             item.Room.Name);
                        }
                        else
                        {
                            lblRoomName.Text = string.Format("{0} {1}",
                                                             item.RoomClass.Name, item.RoomType.Name);
                        }
                    }
                    else
                    {
                        lblRoomName.Text = string.Format("Room {2}: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{0} {1}",
                                                         item.RoomClass.Name, item.RoomType.Name,
                                                         e.Item.ItemIndex + 1);
                    }

                    HiddenField hiddenRoomClassId = (HiddenField)e.Item.FindControl("hiddenRoomClassId");
                    HiddenField hiddenRoomTypeId  = (HiddenField)e.Item.FindControl("hiddenRoomTypeId");

                    hiddenRoomClassId.Value = item.RoomClass.Id.ToString();
                    hiddenRoomTypeId.Value  = item.RoomType.Id.ToString();

                    if (item.Booked == 1 && item.RoomType.Id == SailsModule.TWIN)
                    {
                        e.Item.FindControl("trCustomer2").Visible = false;
                        e.Item.FindControl("trExtra").Visible     = false;
                    }

                    CheckBox    checkBoxAddChild = (CheckBox)e.Item.FindControl("checkBoxAddChild");
                    HtmlControl trChild          = (HtmlControl)e.Item.FindControl("trChild");
                    HtmlControl trChildServices  = (HtmlControl)e.Item.FindControl("trChildServices");

                    string scriptChild = string.Format(@"toggleVisible('{0}');toggleVisible('{1}');",
                                                       trChild.ClientID, trChildServices.ClientID);
                    checkBoxAddChild.Attributes.Add("onclick", scriptChild);

                    CheckBox    checkBoxAddBaby = (CheckBox)e.Item.FindControl("checkBoxAddBaby");
                    HtmlControl trBaby          = (HtmlControl)e.Item.FindControl("trBaby");
                    HtmlControl trBabyServices  = (HtmlControl)e.Item.FindControl("trBabyServices");
                    string      scriptBaby      = string.Format(@"toggleVisible('{0}');toggleVisible('{1}');", trBaby.ClientID,
                                                                trBabyServices.ClientID);
                    checkBoxAddBaby.Attributes.Add("onclick", scriptBaby);

                    CheckBox    checkBoxSingle      = (CheckBox)e.Item.FindControl("checkBoxSingle");
                    HtmlControl trCustomer2         = (HtmlControl)e.Item.FindControl("trCustomer2");
                    HtmlControl trCustomer2Services = (HtmlControl)e.Item.FindControl("trCustomer2Services");
                    string      scriptCustomer      = string.Format(@"toggleVisible('{0}');toggleVisible('{1}');",
                                                                    trCustomer2.ClientID, trCustomer2Services.ClientID);
                    checkBoxSingle.Attributes.Add("onclick", scriptCustomer);

                    #endregion

                    #region -- (back-end) --

                    bool isSecond = false;
                    // Load customer info đã có

                    #region -- customer info --

                    foreach (Customer customer in item.Customers)
                    {
                        if (customer.Type == CustomerType.Adult)
                        {
                            if (!isSecond)
                            {
                                CustomerInfoInput customer1   = e.Item.FindControl("customer1") as CustomerInfoInput;
                                Repeater          rptService1 = e.Item.FindControl("rptServices1") as Repeater;
                                if (customer1 != null && rptService1 != null)
                                {
                                    customer1.GetCustomer(customer, module);
                                    if (page.DetailService)
                                    {
                                        CustomerServiceRepeaterHandler handler =
                                            new CustomerServiceRepeaterHandler(customer, module);
                                        rptService1.DataSource     = module.CustomerServices;
                                        rptService1.ItemDataBound += handler.ItemDataBound;
                                        rptService1.DataBind();
                                    }
                                    else
                                    {
                                        rptService1.Visible = false;
                                    }
                                    isSecond = true;
                                }
                            }
                            else
                            {
                                CustomerInfoInput customer2   = e.Item.FindControl("customer2") as CustomerInfoInput;
                                Repeater          rptService2 = e.Item.FindControl("rptServices2") as Repeater;
                                if (customer2 != null && rptService2 != null)
                                {
                                    customer2.GetCustomer(customer, module);
                                    if (page.DetailService)
                                    {
                                        CustomerServiceRepeaterHandler handler =
                                            new CustomerServiceRepeaterHandler(customer, module);
                                        rptService2.DataSource     = module.CustomerServices;
                                        rptService2.ItemDataBound += handler.ItemDataBound;
                                        rptService2.DataBind();
                                    }
                                    else
                                    {
                                        rptService2.Visible = false;
                                    }
                                }
                            }
                        }


                        if (customer.Type == CustomerType.Children)
                        {
                            CustomerInfoInput customerChild =
                                e.Item.FindControl("customerChild") as CustomerInfoInput;
                            Repeater rptServicesChild = e.Item.FindControl("rptServicesChild") as Repeater;
                            if (customerChild != null && rptServicesChild != null)
                            {
                                customerChild.GetCustomer(customer, module);
                                if (page.DetailService)
                                {
                                    CustomerServiceRepeaterHandler handler = new CustomerServiceRepeaterHandler(
                                        customer, module);
                                    rptServicesChild.DataSource     = module.CustomerServices;
                                    rptServicesChild.ItemDataBound += handler.ItemDataBound;
                                    rptServicesChild.DataBind();
                                }
                                else
                                {
                                    rptServicesChild.Visible = false;
                                }
                            }
                        }

                        if (customer.Type == CustomerType.Baby)
                        {
                            CustomerInfoInput customerBaby    = e.Item.FindControl("customerBaby") as CustomerInfoInput;
                            Repeater          rptServicesBaby = e.Item.FindControl("rptServicesBaby") as Repeater;
                            if (customerBaby != null && rptServicesBaby != null)
                            {
                                customerBaby.GetCustomer(customer, module);
                                if (page.DetailService)
                                {
                                    CustomerServiceRepeaterHandler handler = new CustomerServiceRepeaterHandler(
                                        customer, module);
                                    rptServicesBaby.DataSource     = module.CustomerServices;
                                    rptServicesBaby.ItemDataBound += handler.ItemDataBound;
                                    rptServicesBaby.DataBind();
                                }
                                else
                                {
                                    rptServicesBaby.Visible = false;
                                }
                            }
                        }
                    }

                    #endregion

                    #region -- Check box và visible --

                    if (item.VirtualAdult == 1)
                    {
                        e.Item.FindControl("trCustomer2").Visible  = false;
                        e.Item.FindControl("rptServices2").Visible = false;
                    }

                    if (item.HasChild)
                    {
                        trChild.Attributes.CssStyle["display"]         = "";
                        trChildServices.Attributes.CssStyle["display"] = "";
                        checkBoxAddChild.Checked = true;
                    }
                    else
                    {
                        Repeater rptServicesChild = e.Item.FindControl("rptServicesChild") as Repeater;
                        if (rptServicesChild != null)
                        {
                            rptServicesChild.DataSource = module.CustomerServices;
                            rptServicesChild.DataBind();
                        }
                    }

                    if (item.HasBaby)
                    {
                        trBaby.Attributes.CssStyle["display"]         = "";
                        trBabyServices.Attributes.CssStyle["display"] = "";
                        checkBoxAddBaby.Checked = true;
                    }
                    else
                    {
                        Repeater rptServicesBaby = e.Item.FindControl("rptServicesBaby") as Repeater;
                        if (rptServicesBaby != null)
                        {
                            rptServicesBaby.DataSource = module.CustomerServices;
                            rptServicesBaby.DataBind();
                        }
                    }

                    if (item.IsSingle)
                    {
                        trCustomer2.Attributes.CssStyle["display"]         = "none";
                        trCustomer2Services.Attributes.CssStyle["display"] = "none";
                        checkBoxSingle.Checked = true;
                    }

                    #endregion

                    // Load room available

                    #region -- available --

                    DropDownList ddlRooms = e.Item.FindControl("ddlRooms") as DropDownList;
                    if (ddlRooms != null)
                    {
                        // Danh sách phòng được chọn bao gồm: toàn bộ các phòng chưa được chọn và phòng trong book hiện tại
                        IList datasouce = module.RoomGetAvailable(item.Book.Cruise, item, (item.Book.EndDate - item.Book.StartDate).Days,
                                                                  item.Book);
                        Room room = new Room("", false, null, null);
                        datasouce.Insert(0, room);
                        ddlRooms.DataSource     = datasouce;
                        ddlRooms.DataTextField  = Room.NAME;
                        ddlRooms.DataValueField = "Id";
                        ddlRooms.DataBind();

                        if (item.Room != null)
                        {
                            ListItem listItem = ddlRooms.Items.FindByValue(item.Room.Id.ToString());
                            if (listItem != null)
                            {
                                listItem.Selected = true;
                            }
                        }
                    }

                    #endregion

                    #region -- room price --

                    if (customPrice)
                    {
                        TextBox txtPrice = e.Item.FindControl("txtPrice") as TextBox;
                        if (txtPrice != null)
                        {
                            if (item.Total <= 0)
                            {
                                if (module.ModuleSettings(SailsModule.CUSTOMER_PRICE) == null || Convert.ToBoolean(module.ModuleSettings(SailsModule.CUSTOMER_PRICE)))
                                {
                                    txtPrice.Visible = false;
                                }
                                else
                                {
                                    txtPrice.Visible = true;
                                }
                                item.Total = item.Calculate(module, policies, page.ChildPrice, page.AgencySupplement, null);
                            }
                            txtPrice.Text = item.Total.ToString("0.#");
                        }
                    }
                    else
                    {
                        PlaceHolder plhRoomPrice = e.Item.FindControl("plhRoomPrice") as PlaceHolder;
                        if (plhRoomPrice != null)
                        {
                            plhRoomPrice.Visible = false;
                        }
                    }

                    #endregion

                    DropDownList ddlRoomTypes = e.Item.FindControl("ddlRoomTypes") as DropDownList;
                    if (ddlRoomTypes != null)
                    {
                        if (item.VirtualAdult == 2)
                        {
                            ddlRoomTypes.DataSource     = roomTypes; //module.RoomTypexGetAll();
                            ddlRoomTypes.DataValueField = "Value";
                            ddlRoomTypes.DataTextField  = "Text";
                            ddlRoomTypes.DataBind();

                            ListItem listitem =
                                ddlRoomTypes.Items.FindByValue(string.Format("{0}|{1}", item.RoomClass.Id,
                                                                             item.RoomType.Id));

                            if (listitem != null)
                            {
                                listitem.Selected = true;
                            }
                            else
                            {
                                ddlRoomTypes.Items.Add(new ListItem(item.RoomClass.Name + " " + item.RoomType.Name,
                                                                    string.Format("{0}|{1}", item.RoomClass.Id,
                                                                                  item.RoomType.Id)));
                                ddlRoomTypes.SelectedValue = string.Format("{0}|{1}", item.RoomClass.Id,
                                                                           item.RoomType.Id);
                            }
                        }
                        else
                        {
                            ddlRoomTypes.Visible = false;
                            e.Item.FindControl("labelRoomTypes").Visible = false;
                        }
                    }

                    #endregion
                }
            }
        }
Example #38
0
        public void rptProfilePeriod_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                try
                {
                    EHS_PROFILE_MEASURE metric = (EHS_PROFILE_MEASURE)e.Item.DataItem;
                    Label      lbl;
                    LinkButton lnk;
                    TextBox    tb;

                    //bool enabled = LocalProfile().InputPeriod.IsPeriodInputClosed(metric.PRMR_ID) == true ? false : true;
                    bool enabled = true;

                    if (string.IsNullOrEmpty(metric.MEASURE_PROMPT))
                    {
                        lbl      = (Label)e.Item.FindControl("lblMetricName");
                        lbl.Text = metric.EHS_MEASURE.MEASURE_NAME.Trim();
                    }

                    ImageButton ib = (ImageButton)e.Item.FindControl("ibAddInput");
                    ib.Enabled = enabled;
                    if (enabled)
                    {
                        ib.ImageUrl = "~/images/plus.png";
                    }
                    else
                    {
                        ib.ImageUrl = "~/images/status/checked.png";
                    }

                    Image img = (Image)e.Item.FindControl("imgHazardType");
                    System.Web.UI.HtmlControls.HtmlTableCell cell1 = (System.Web.UI.HtmlControls.HtmlTableCell)e.Item.FindControl("tdMetricName");
                    if (metric.EHS_MEASURE.MEASURE_CATEGORY == "ENGY" || metric.EHS_MEASURE.MEASURE_CATEGORY == "EUTL")
                    {
                        cell1.Attributes.Add("Class", "rptInputTable energyColor");
                        img.ImageUrl = "~/images/status/energy.png";
                    }
                    else if (metric.EHS_MEASURE.MEASURE_CATEGORY == "PROD" || metric.EHS_MEASURE.MEASURE_CATEGORY == "SAFE" || metric.EHS_MEASURE.MEASURE_CATEGORY == "FACT")
                    {
                        img.ImageUrl = "~/images/status/inputs.png";
                        img.ToolTip  = WebSiteCommon.GetXlatValueLong("measureCategoryEHS", metric.EHS_MEASURE.MEASURE_CATEGORY);
                        ib           = (ImageButton)e.Item.FindControl("ibAddInput");
                        ib.Visible   = false;
                    }
                    else
                    {
                        cell1.Attributes.Add("Class", "rptInputTable wasteColor");
                        if (metric.REG_STATUS == "HZ")
                        {
                            img.ImageUrl = "~/images/status/hazardous.png";
                        }
                        else
                        {
                            img.ImageUrl = "~/images/status/waste.png";
                        }
                        img.ToolTip = WebSiteCommon.GetXlatValueLong("regulatoryStatus", metric.REG_STATUS);
                        if (!string.IsNullOrEmpty(metric.UN_CODE))
                        {
                            img.ToolTip += (".  " + SessionManager.DisposalCodeList.FirstOrDefault(l => l.UN_CODE == metric.UN_CODE).DESCRIPTION);
                        }
                    }

                    cell1 = (System.Web.UI.HtmlControls.HtmlTableCell)e.Item.FindControl("tdMetricReqd");
                    if ((bool)metric.IS_REQUIRED)
                    {
                        cell1.Attributes.Add("Class", "rptInputTable required");
                    }

                    if (LocalProfile().InputPeriod.CountPeriodInputList(metric.PRMR_ID) == 0)
                    {
                        LocalProfile().CreatePeriodInput(LocalProfile().InputPeriod, metric, false);
                    }

                    Repeater rpt = (Repeater)e.Item.FindControl("rptProfileInput");
                    rpt.DataSource = LocalProfile().InputPeriod.GetPeriodInputList(metric.PRMR_ID);
                    rpt.DataBind();
                }
                catch
                {
                }
            }
        }
Example #39
0
 /// <summary>
 /// 绑定DataTable:Repeater控件
 /// </summary>
 /// <param name="dt">DataTable</param>
 /// <param name="dropdownlists">控件名称</param>
 public static void BindRepeaterList(DataTable dt, Repeater repeater)
 {
     repeater.DataSource = dt;
     repeater.DataBind();
 }
Example #40
0
 /// <summary>
 /// 绑定IList<T>:Repeater控件
 /// </summary>
 /// <param name="dt">DataTable</param>
 /// <param name="dropdownlists">控件名称</param>
 public static void BindRepeaterList <T>(IList <T> list, Repeater repeater)
 {
     repeater.DataSource = list;
     repeater.DataBind();
 }
Example #41
0
        private int SaveInputs(decimal targetPrmrID, bool commitChanges)
        {
            int              status = 0;
            LinkButton       lnk;
            HiddenField      hf;
            TextBox          tbValue, tbCost, tbCredit;
            CheckBox         cbDelete;
            decimal          decimalValue;
            DateTime         dateValue;
            decimal          prmrID;
            bool             hasReqdInputs  = true;
            bool             hasSaveWarning = false;
            bool             hasSaveError   = false;
            EHSProfileStatus saveStatus     = EHSProfileStatus.Normal;

            try
            {
                foreach (RepeaterItem item in rptProfilePeriod.Items)
                {
                    lnk    = (LinkButton)item.FindControl("lnkMetricCD");
                    prmrID = Convert.ToDecimal(lnk.CommandArgument);
                    EHS_PROFILE_MEASURE metric = LocalProfile().GetMeasure((decimal)prmrID);

                    if (prmrID == targetPrmrID || commitChanges)
                    {
                        Repeater rpt      = (Repeater)item.FindControl("rptProfileInput");
                        int      numInput = 0;
                        foreach (RepeaterItem inputItem in rpt.Items)
                        {
                            hf = (HiddenField)inputItem.FindControl("hfInputDate");
                            EHS_PROFILE_INPUT input = LocalProfile().InputPeriod.GetPeriodInput(prmrID, Convert.ToDateTime(hf.Value));
                            if (input != null)
                            {
                                RadDatePicker dtpFrom = (RadDatePicker)inputItem.FindControl("radDateFrom");
                                RadDatePicker dtpTo   = (RadDatePicker)inputItem.FindControl("radDateTo");
                                tbValue  = (TextBox)inputItem.FindControl("tbMetricValue");
                                tbCost   = (TextBox)inputItem.FindControl("tbMetricCost");
                                tbCredit = (TextBox)inputItem.FindControl("tbMetricCredit");
                                cbDelete = (CheckBox)inputItem.FindControl("cbDelete");
                                hf       = (HiddenField)inputItem.FindControl("hfStatus");
                                Control tr = new Control();

                                EHSProfileStatus inputStatus = EHSProfileStatus.Normal;
                                switch (metric.EHS_MEASURE.MEASURE_CATEGORY)
                                {
                                case "PROD":
                                case "SAFE":
                                case "FACT":
                                    if (dtpFrom.SelectedDate == null || dtpTo.SelectedDate == null)
                                    {
                                        inputStatus = EHSProfileStatus.Incomplete;
                                    }
                                    else if (string.IsNullOrEmpty(tbValue.Text.Trim()))
                                    {
                                        inputStatus = EHSProfileStatus.NoInputs;
                                    }
                                    break;

                                default:
                                    if (string.IsNullOrEmpty(tbValue.Text.Trim()))
                                    {
                                        if (string.IsNullOrEmpty(tbCost.Text.Trim() + tbCredit.Text.Trim()))
                                        {
                                            inputStatus = EHSProfileStatus.NoInputs;
                                        }
                                        else
                                        {
                                            inputStatus = EHSProfileStatus.Incomplete;
                                        }
                                    }
                                    else if (string.IsNullOrEmpty(tbCost.Text.Trim() + tbCredit.Text.Trim()))
                                    {
                                        inputStatus = EHSProfileStatus.Incomplete;
                                    }
                                    else if (dtpFrom.SelectedDate == null || dtpTo.SelectedDate == null)
                                    {
                                        inputStatus = EHSProfileStatus.Incomplete;
                                    }

                                    if (metric.EHS_PROFILE_MEASURE_EXT != null && (metric.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT.HasValue || metric.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT.HasValue))
                                    {
                                        if (inputStatus == EHSProfileStatus.Incomplete && (dtpFrom.SelectedDate == null || dtpTo.SelectedDate == null))
                                        {
                                            inputStatus = EHSProfileStatus.NoInputs;
                                        }
                                    }

                                    break;
                                }

                                if (inputStatus == EHSProfileStatus.NoInputs)
                                {
                                    LocalProfile().InputPeriod.DeletePeriodInput(input);
                                }
                                else if (inputStatus == EHSProfileStatus.Incomplete)
                                {
                                    hasSaveError = true;
                                    saveStatus   = EHSProfileStatus.Incomplete;
                                    dtpFrom.DateInput.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    dtpTo.DateInput.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    tbValue.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    if (tbCost.Enabled)
                                    {
                                        tbCost.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    }
                                    if (tbCredit.Enabled)
                                    {
                                        tbCredit.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    }
                                }

                                //if ((string.IsNullOrEmpty(tbValue.Text) || dtpFrom.SelectedDate == null || dtpTo.SelectedDate == null) || (string.IsNullOrEmpty(tbCost.Text + tbCredit.Text) && metric.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && metric.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && metric.EHS_MEASURE.MEASURE_CATEGORY != "FACT"))
                                //{
                                //    LocalProfile().InputPeriod.DeletePeriodInput(input);
                                //}
                                else
                                {
                                    ++numInput;

                                    if (cbDelete.Checked)
                                    {
                                        input.STATUS = "D";
                                    }
                                    else if (input.STATUS == "D")
                                    {
                                        input.STATUS = "A";
                                    }

                                    if (input.EFF_FROM_DT > DateTime.MinValue || input.EFF_FROM_DT != dtpFrom.SelectedDate)
                                    {
                                        input.EFF_FROM_DT = (DateTime)dtpFrom.SelectedDate;
                                    }

                                    if (input.EFF_TO_DT > DateTime.MinValue || input.EFF_TO_DT != dtpTo.SelectedDate)
                                    {
                                        input.EFF_TO_DT = (DateTime)dtpTo.SelectedDate;
                                    }

                                    if (SQMBasePage.ParseToDecimal(tbValue.Text, out decimalValue))
                                    {
                                        if (input.MEASURE_VALUE != decimalValue)
                                        {
                                            input.MEASURE_VALUE = decimalValue;
                                        }
                                    }
                                    if (!string.IsNullOrEmpty(tbCredit.Text))
                                    {
                                        SQMBasePage.ParseToDecimal(tbCredit.Text, out decimalValue);
                                        decimalValue = Math.Abs(decimalValue) * -1;
                                        if (!input.MEASURE_COST.HasValue || input.MEASURE_COST != decimalValue)
                                        {
                                            input.MEASURE_COST = decimalValue;
                                        }
                                    }
                                    else
                                    {
                                        SQMBasePage.ParseToDecimal(tbCost.Text, out decimalValue);
                                        decimalValue = Math.Abs(decimalValue);
                                        if (!input.MEASURE_COST.HasValue || input.MEASURE_COST != decimalValue)
                                        {
                                            input.MEASURE_COST = decimalValue;
                                        }
                                    }

                                    if (commitChanges && metric.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && metric.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && metric.EHS_MEASURE.MEASURE_CATEGORY != "FACT" && LocalProfile().CurrentStatus != EHSProfileStatus.OutOFRange)
                                    {
                                        if (!EHSModel.IsMeasureValueInRange(metric, (double)input.MEASURE_VALUE, 1.0))
                                        {
                                            hasSaveWarning = true;
                                            saveStatus     = EHSProfileStatus.OutOFRange;
                                            tbValue.Style.Add("BACKGROUND-COLOR", "CORNSILK");
                                        }
                                    }
                                }
                            }
                            if (metric != null && (bool)metric.IS_REQUIRED && numInput == 0)
                            {
                                hasReqdInputs = false;
                            }
                        }
                    }
                }

                if (commitChanges)
                {
                    if (hasSaveError)
                    {
                        MessageDisplay(saveStatus);
                        return(0);
                    }

                    if (hasSaveWarning)
                    {
                        MessageDisplay(saveStatus);
                        return(0);
                    }

                    // deleted inputs after approval
                    if ((!string.IsNullOrEmpty(hfNumDelete.Value) && hfNumDelete.Value != "0") && LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT.HasValue)
                    {
                        cbFinalApproval.Checked = false;
                    }
                    // changed inputs after approval
                    if ((!string.IsNullOrEmpty(hfNumChanged.Value) && hfNumChanged.Value != "0") && LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT.HasValue)
                    {
                        cbFinalApproval.Checked = false;
                    }

                    status = LocalProfile().UpdatePeriod(true, "", cbFinalApproval.Checked, SessionManager.UserContext.UserName());

                    if (status >= 0)
                    {
                        // option to finalize metrics
                        SETTINGS sets = SQMSettings.GetSetting("EHS", "INPUTFINALIZE");
                        if (sets != null)
                        {
                            bool     doRollup = false;
                            DateTime lastUpdateDate;
                            LocalProfile().PeriodStatus(new string[0] {
                            }, false, out lastUpdateDate);
                            switch (sets.VALUE.ToUpper())
                            {
                            case "ANY":         // finalize any inputs
                                doRollup = true;
                                break;

                            case "ANY_CURRENCY":           // finalize any inputs and if the exchange rate for the period exists
                                if (LocalProfile().InputPeriod.PeriodExchangeRate(LocalProfile().Plant) != null)
                                {
                                    doRollup = true;
                                }
                                break;

                            case "REQD":        // finalize only when all required inputs have been entered
                                if (LocalProfile().InputPeriod.IsRequiredComplete())
                                {
                                    doRollup = true;
                                }
                                break;

                            case "REQD_CURRENCY":           // finalize only when all required inputs are entered and exchange rate for the period exists
                                if (LocalProfile().InputPeriod.IsRequiredComplete() && LocalProfile().InputPeriod.PeriodExchangeRate(LocalProfile().Plant) != null)
                                {
                                    doRollup = true;
                                }
                                break;

                            default:
                                break;
                            }
                            if (doRollup && LocalProfile().ValidPeriod())
                            {
                                status = LocalProfile().UpdateMetricHistory(LocalProfile().InputPeriod.PeriodDate);  // new roll-up logic
                            }
                        }
                    }

                    if (status >= 0)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveSuccess');", true);
                        hasSaveWarning = false;  // cancel warning to allow re-save
                        MessageDisplay(0);
                        LoadProfileInput(LocalProfile().InputPeriod.PeriodDate, EHSProfileStatus.Normal);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveError');", true);
                        MessageDisplay(0);
                        ClearInput();
                    }
                }
            }
            catch (Exception ex)
            {
                //   SQMLogger.LogException(ex);
                status = -1;
            }

            BindSharedCalendars();

            return(status);
        }
Example #42
0
    private void ShowSiteActivity()
    {
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        DataTable dt = new DataTable();
        //Dim dr As DataRow
        Repeater rptFolders = new Repeater();
        Repeater rptContents = new Repeater();
        int iTotalUpdated = 0;
        int iPagesUpdated = 0;
        int iTotalPages = 0;
        string sReport = "";
        StringBuilder sbHtml = new StringBuilder();
        int i = 0;
        int j = 0;
        Collection data; //ContentData()
        Table main;
        Table[] tblrep;
        Table[] Pageinnertbl;
        Table[] folderinnertbl;
        TableRow rowMain;
        TableCell cellMain;
        TableRow[] rowPath;
        TableCell[] cellPath;
        TableRow[] rowfolder;
        TableCell[] cellfolder;
        TableRow[] rowPage;
        TableCell[] cellPage;

        TableRow[] rowtbl12;
        TableRow[] rowtbl22;
        TableCell[] celltbl211;
        TableCell[] celltbl212;
        TableCell[] celltbl213;
        TableCell[] celltbl221;
        TableCell[] celltbl222;
        TableCell[] celltbl223;
        TableRow[] rowtbl31;
        TableCell[] celltbl311;
        TableCell[] celltbl312;
        TableCell[] celltbl313;
        TableCell[] celltbl314;

        TableRow[] rowtbl3;
        TableCell[] celltbl31;
        TableCell[] celltbl32;
        TableCell[] celltbl33;
        TableCell[] celltbl34;

        Label lbltbl2 = new Label();
        Label lbltbl3 = new Label();
        Label[] lblPath;

        Label[] lblFolderHeader1;
        Label[] lblFolderHeader2;
        Label[] lblFolderHeader3;
        Label[] lblTotalUpdated;
        Label[] lblPagesUpdated;
        Label[] lblTotalPages;
        Label[] lblPgHeader1;
        Label[] lblPgHeader2;
        Label[] lblPgHeader3;
        Label[] lblPgHeader4;
        Label[] lblPg1;
        Label[] lblPg2;
        Label[] lblPg3;
        Label[] lblPg4;

        ArrayList aPath = new ArrayList();
        ArrayList aTotalUpdated = new ArrayList();
        ArrayList aPagesUpdated = new ArrayList();
        ArrayList aTotalPages = new ArrayList();
        ArrayList aPageData = new ArrayList();
        ArrayList aFolder = new ArrayList();
        string sTempHolder = "";
        int iFolderCount = 0;
        string pathName;

        //ReportDataGrid
        _ReportTableHtml = ""; //clear the table for export
        if (!(_SiteData == null))
        {
            main = new Table();
            main.Controls.Clear();
            main.ID = "UpdateActivityTbl";
            rowMain = new TableRow();
            main.Controls.Add(rowMain);
            cellMain = new TableCell();

            data = _SiteData;
            for (i = 1; i <= data.Count; i++)
            {
                //loop through the data to create a collection of array for the information needed to display
                //((Collection)((ArrayList)aFolder[j - 1])[i])["FolderName"]
                //if (((Collection)((ArrayList)aFolder[j - 1])[i])["FolderName"] != aPath[j - 1])
                sReport = (string)((Collection)data[i])["FolderName"];
                if (sTempHolder != sReport)
                {
                    if (sTempHolder != "")
                    {
                        aPath.Add(sTempHolder);
                        aTotalUpdated.Add(iTotalUpdated);
                        aPagesUpdated.Add(iPagesUpdated);
                        aTotalPages.Add(iTotalPages);
                        aFolder.Add(aPageData);
                        iTotalUpdated = 0;
                        iPagesUpdated = 0;
                        iTotalPages = 0;
                        aPageData = null;
                        aPageData = new ArrayList();
                    }
                    sTempHolder = sReport;
                }
                iTotalUpdated = iTotalUpdated + Convert.ToInt32(((Collection)data[i])["Updates"]);
                //((Collection)data[i])["Updates"]
                if (Convert.ToInt32(((Collection)data[i])["Updates"]) > 0)
                {
                    iPagesUpdated++;
                }
                iTotalPages++;
                aPageData.Add(data[i]);
            }
            //add the last set of data to the arrays
            aPath.Add(sReport);
            aTotalUpdated.Add(iTotalUpdated);
            aPagesUpdated.Add(iPagesUpdated);
            aTotalPages.Add(iTotalPages);
            aFolder.Add(aPageData);

            if (1 == aPath.Count && Strings.Len(aPath[0]) == 0)
            {
                lblPath = new Label[2];
                lblPath[0] = new Label();
                lblPath[0].Text = "<p>" + _MessageHelper.GetMessage("no page found") + "</p>";
                cellMain.Controls.Add(lblPath[0]);
                rowMain.Controls.Add(cellMain);
            }
            else
            {
                iFolderCount = aPath.Count;
                tblrep = new Table[iFolderCount + 1];
                rowPath = new TableRow[iFolderCount + 1];
                cellPath = new TableCell[iFolderCount + 1];
                lblPath = new Label[iFolderCount + 1];
                rowfolder = new TableRow[iFolderCount + 1];
                cellfolder = new TableCell[iFolderCount + 1];
                rowPage = new TableRow[iFolderCount + 1];
                cellPage = new TableCell[iFolderCount + 1];
                Pageinnertbl = new Table[iFolderCount + 1];
                folderinnertbl = new Table[iFolderCount + 1];
                rowtbl12 = new TableRow[iFolderCount + 1];
                celltbl211 = new TableCell[iFolderCount + 1];
                celltbl212 = new TableCell[iFolderCount + 1];
                celltbl213 = new TableCell[iFolderCount + 1];
                rowtbl22 = new TableRow[iFolderCount + 1];
                celltbl221 = new TableCell[iFolderCount + 1];
                celltbl222 = new TableCell[iFolderCount + 1];
                celltbl223 = new TableCell[iFolderCount + 1];
                rowtbl31 = new TableRow[iFolderCount + 1];
                celltbl311 = new TableCell[iFolderCount + 1];
                celltbl312 = new TableCell[iFolderCount + 1];
                celltbl313 = new TableCell[iFolderCount + 1];
                celltbl314 = new TableCell[iFolderCount + 1];
                lblPgHeader1 = new Label[iFolderCount + 1];
                lblPgHeader2 = new Label[iFolderCount + 1];
                lblPgHeader3 = new Label[iFolderCount + 1];
                lblPgHeader4 = new Label[iFolderCount + 1];
                lblFolderHeader1 = new Label[iFolderCount + 1];
                lblFolderHeader2 = new Label[iFolderCount + 1];
                lblFolderHeader3 = new Label[iFolderCount + 1];
                lblTotalUpdated = new Label[iFolderCount + 1];
                lblPagesUpdated = new Label[iFolderCount + 1];
                lblTotalPages = new Label[iFolderCount + 1];
                for (j = 1; j <= iFolderCount; j++)
                {
                    //!!!--Important---!!!
                    //Var Definations:
                    //j: Outter loop, for the folders selected.
                    //i: mid-lv loop, same number of j, but used to seek the correct dataset.
                    //k: inner loop, generate the inner table for items being updated.
                    //____________________________________________________________________________________________________________________
                    //| <b>aPath(j-1)</b> "Folder Path"                                                                                   |
                    //|___________________________________________________________________________________________________________________|
                    //| Total Updates                            # Pages Updated                                       Total Pages        |
                    //| aTotalUpdated(j-1)	                    aPagesUpdated(j-1)                                    aTotalPages(j-1)   |
                    //|___________________________________________________________________________________________________________________|
                    //| _________________________________________________________________________________________________________________ |
                    //|| Page Name              | Updates                  | Last Updated                 | User Name                    ||
                    //|| aFolder(j)(i)("Title") | aFolder(j)(i)("Updates") | aFolder(j)(i)("LastUpdated") | aFolder(j)(i)("UserNames")   ||
                    //||________________________|__________________________|______________________________|______________________________||
                    //|___________________________________________________________________________________________________________________|

                    //folder table
                    tblrep[j] = new Table();
                    tblrep[j].CssClass = "ektronGrid";
                    tblrep[j].Controls.Clear();

                    //folder path cell
                    rowPath[j] = new TableRow();
                    tblrep[j].Controls.Add(rowPath[j]);
                    cellPath[j] = new TableCell();
                    lblPath[j] = new Label();

                    pathName = (string)(aPath[j - 1].ToString().Substring(1, Strings.Len(aPath[j - 1]) - 1));
                    if ("" == pathName || "/" == pathName)
                    {
                        pathName = _ContentApi.GetFolderById(0).Name;
                    }

                    if ("ev" == _ReportDisplay) // show expand link in executive view
                    {
                        lblPath[j].Text = "<a href=\"javascript://\" onclick=\"showDetails(\'" + j + "\');\"><b>" + pathName + "</b></a>";
                    }
                    else
                    {
                        lblPath[j].Text = pathName;
                    }
                    lblPath[j].Font.Size = FontUnit.Point(14);

                    //folder activity cell
                    rowfolder[j] = new TableRow();
                    tblrep[j].Controls.Add(rowfolder[j]);
                    cellfolder[j] = new TableCell();
                    //folder activity table, gives the summary of the folder activity.
                    folderinnertbl[j] = new Table();
                    folderinnertbl[j].ID = (string)("folderActivity_" + j);
                    folderinnertbl[j].Controls.Clear();
                    folderinnertbl[j].Width = 500;
                    if ("dv" == _ReportDisplay) // not show in detail view
                    {
                        folderinnertbl[j].Visible = false;
                    }
                    else
                    {
                        folderinnertbl[j].Visible = true;
                    }
                    rowtbl12[j] = new TableRow();
                    folderinnertbl[j].Controls.Add(rowtbl12[j]);
                    celltbl211[j] = new TableCell();
                    celltbl212[j] = new TableCell();
                    celltbl213[j] = new TableCell();
                    celltbl211[j].HorizontalAlign = HorizontalAlign.Center;
                    celltbl212[j].HorizontalAlign = HorizontalAlign.Center;
                    celltbl213[j].HorizontalAlign = HorizontalAlign.Center;
                    lblFolderHeader1[j] = new Label();
                    lblFolderHeader2[j] = new Label();
                    lblFolderHeader3[j] = new Label();
                    lblFolderHeader1[j].Text = _MessageHelper.GetMessage("lbl total updates");
                    lblFolderHeader2[j].Text = _MessageHelper.GetMessage("lbl pages updated");
                    lblFolderHeader3[j].Text = _MessageHelper.GetMessage("lbl total pages");
                    rowtbl22[j] = new TableRow();
                    folderinnertbl[j].Controls.Add(rowtbl22[j]);
                    celltbl221[j] = new TableCell();
                    celltbl222[j] = new TableCell();
                    celltbl223[j] = new TableCell();
                    celltbl221[j].HorizontalAlign = HorizontalAlign.Center;
                    celltbl222[j].HorizontalAlign = HorizontalAlign.Center;
                    celltbl223[j].HorizontalAlign = HorizontalAlign.Center;
                    lblTotalUpdated[j] = new Label();
                    lblPagesUpdated[j] = new Label();
                    lblTotalPages[j] = new Label();
                    lblTotalUpdated[j].Text = aTotalUpdated[j - 1].ToString();
                    lblPagesUpdated[j].Text = aPagesUpdated[j - 1].ToString();
                    lblTotalPages[j].Text = aTotalPages[j - 1].ToString();

                    //page activity cell
                    cellPage[j] = new TableCell();
                    rowPage[j] = new TableRow();
                    rowPage[j].BackColor = System.Drawing.Color.White;
                    tblrep[j].Controls.Add(rowPage[j]);
                    //page activity table, give the details of the page activity in this folder.
                    Pageinnertbl[j] = new Table();
                    Pageinnertbl[j].Controls.Clear();
                    Pageinnertbl[j].BorderWidth = 1;
                    Pageinnertbl[j].Width = 560;
                    //this Id is need for the JavaScript to hide and show it in executive view
                    Pageinnertbl[j].ID = (string)("PageActivity_" + j);
                    rowtbl31[j] = new TableRow();
                    Pageinnertbl[j].Controls.Add(rowtbl31[j]);
                    celltbl311[j] = new TableCell();
                    celltbl312[j] = new TableCell();
                    celltbl313[j] = new TableCell();
                    celltbl314[j] = new TableCell();
                    celltbl311[j].BackColor = System.Drawing.Color.Black;
                    celltbl311[j].ForeColor = System.Drawing.Color.White;
                    celltbl312[j].BackColor = System.Drawing.Color.Black;
                    celltbl312[j].ForeColor = System.Drawing.Color.White;
                    celltbl313[j].BackColor = System.Drawing.Color.Black;
                    celltbl313[j].ForeColor = System.Drawing.Color.White;
                    celltbl314[j].BackColor = System.Drawing.Color.Black;
                    celltbl314[j].ForeColor = System.Drawing.Color.White;
                    lblPgHeader1[j] = new Label();
                    lblPgHeader2[j] = new Label();
                    lblPgHeader3[j] = new Label();
                    lblPgHeader4[j] = new Label();
                    lblPgHeader1[j].Text = "<b>" + _MessageHelper.GetMessage("lbl page name") + "</b>";
                    lblPgHeader2[j].Text = "<b>" + _MessageHelper.GetMessage("lbl updates") + "</b>";
                    lblPgHeader3[j].Text = "<b>" + _MessageHelper.GetMessage("lbl last updated") + "</b>";
                    lblPgHeader4[j].Text = "<b>" + _MessageHelper.GetMessage("lbl user name") + "</b>";
                    celltbl311[j].Controls.Add(lblPgHeader1[j]);
                    celltbl312[j].Controls.Add(lblPgHeader2[j]);
                    celltbl313[j].Controls.Add(lblPgHeader3[j]);
                    celltbl314[j].Controls.Add(lblPgHeader4[j]);
                    Pageinnertbl[j].Controls.Add(rowtbl31[j]);
                    rowtbl31[j].Controls.Add(celltbl311[j]);
                    rowtbl31[j].Controls.Add(celltbl312[j]);
                    rowtbl31[j].Controls.Add(celltbl313[j]);
                    rowtbl31[j].Controls.Add(celltbl314[j]);

                    //rowtbl3 = new TableRow[j - 1];
                    //celltbl31 = new TableCell[j - 1];
                    //celltbl32 = new TableCell[j - 1];
                    //celltbl33 = new TableCell[j - 1];
                    //celltbl34 = new TableCell[j - 1];
                    //lblPg1 = new Label[j - 1];
                    //lblPg2 = new Label[j - 1];
                    //lblPg3 = new Label[j - 1];
                    //lblPg4 = new Label[j - 1];

                    //looping through the inner table for the page activity

                    for (i = 0; i < aTotalPages.Count ; i++)
                    {

                        rowtbl3 = new TableRow[(int)aTotalPages[i]];
                        celltbl31 = new TableCell[(int)aTotalPages[i]];
                        celltbl32 = new TableCell[(int)aTotalPages[i]];
                        celltbl33 = new TableCell[(int)aTotalPages[i]];
                        celltbl34 = new TableCell[(int)aTotalPages[i]];
                        lblPg1 = new Label[(int)aTotalPages[i]];
                        lblPg2 = new Label[(int)aTotalPages[i]];
                        lblPg3 = new Label[(int)aTotalPages[i]];
                        lblPg4 = new Label[(int)aTotalPages[i]];
                        for (int k = 0; k < (int)aTotalPages[i]; k++)
                        {
                            try
                            {
                                string name1 = ((Collection)((ArrayList)aFolder[i])[k])["FolderName"].ToString();
                                string name2 = aPath[j - 1].ToString();

                                //if (((Collection)((ArrayList)aFolder[j - 1])[i])["FolderName"] != aPath[j - 1])
                                if (name1 != name2)
                                {
                                    break;
                                }
                            }
                            catch
                            {
                                break;
                            }

                            rowtbl3[k] = new TableRow();
                            Pageinnertbl[j].Controls.Add(rowtbl3[k]);
                            celltbl31[k] = new TableCell();
                            celltbl32[k] = new TableCell();
                            celltbl33[k] = new TableCell();
                            celltbl34[k] = new TableCell();

                            if (Convert.ToBoolean((Convert.ToInt32(k) % 2)))
                            {
                                celltbl31[k].BackColor = System.Drawing.Color.LavenderBlush;
                                celltbl32[k].BackColor = System.Drawing.Color.LavenderBlush;
                                celltbl33[k].BackColor = System.Drawing.Color.LavenderBlush;
                                celltbl34[k].BackColor = System.Drawing.Color.LavenderBlush;
                            }
                            else
                            {
                                celltbl31[k].BackColor = System.Drawing.Color.LightCyan;
                                celltbl32[k].BackColor = System.Drawing.Color.LightCyan;
                                celltbl33[k].BackColor = System.Drawing.Color.LightCyan;
                                celltbl34[k].BackColor = System.Drawing.Color.LightCyan;
                            }
                            lblPg1[k] = new Label();
                            lblPg2[k] = new Label();
                            lblPg3[k] = new Label();
                            lblPg4[k] = new Label();
                            //lblPg1(i).Text = aFolder.Item(j - 1).item(i)("PageName")  'data(i)("PageName")
                            //if (((Collection)((ArrayList)aFolder[j - 1])[i])["FolderName"] != aPath[j - 1])

                            lblPg1[k].Text = (((Collection)((ArrayList)aFolder[j - 1])[k])["PageName"]).ToString(); //data(i)("PageName")
                            lblPg2[k].Text = (((Collection)((ArrayList)aFolder[j - 1])[k])["Updates"]).ToString(); //data(i)("Updates")
                            lblPg3[k].Text = (string)("&#160;" + ((Collection)((ArrayList)aFolder[j - 1])[k])["LastUpdated"]).ToString(); //data(i)("LastUpdated")
                            lblPg4[k].Text = (string)("&#160;" + ((Collection)((ArrayList)aFolder[j - 1])[k])["UserName"]).ToString(); //data(i)("UserName")
                            celltbl31[k].Controls.Add(lblPg1[k]);
                            celltbl32[k].Controls.Add(lblPg2[k]);
                            celltbl33[k].Controls.Add(lblPg3[k]);
                            celltbl34[k].Controls.Add(lblPg4[k]);

                            rowtbl3[k].Controls.Add(celltbl31[k]);
                            rowtbl3[k].Controls.Add(celltbl32[k]);
                            rowtbl3[k].Controls.Add(celltbl33[k]);
                            rowtbl3[k].Controls.Add(celltbl34[k]);
                        }
                    }

                    cellPage[j].Controls.Add(Pageinnertbl[j]);
                    rowPage[j].Controls.Add(cellPage[j]);

                    celltbl211[j].Controls.Add(lblFolderHeader1[j]);
                    celltbl212[j].Controls.Add(lblFolderHeader2[j]);
                    celltbl213[j].Controls.Add(lblFolderHeader3[j]);
                    celltbl221[j].Controls.Add(lblTotalUpdated[j]);
                    celltbl222[j].Controls.Add(lblPagesUpdated[j]);
                    celltbl223[j].Controls.Add(lblTotalPages[j]);
                    folderinnertbl[j].Controls.Add(rowtbl12[j]);
                    rowtbl12[j].Controls.Add(celltbl211[j]);
                    rowtbl12[j].Controls.Add(celltbl212[j]);
                    rowtbl12[j].Controls.Add(celltbl213[j]);
                    folderinnertbl[j].Controls.Add(rowtbl22[j]);
                    rowtbl22[j].Controls.Add(celltbl221[j]);
                    rowtbl22[j].Controls.Add(celltbl222[j]);
                    rowtbl22[j].Controls.Add(celltbl223[j]);
                    cellfolder[j].Controls.Add(folderinnertbl[j]);
                    rowfolder[j].Controls.Add(cellfolder[j]);

                    cellPath[j].Controls.Add(lblPath[j]);
                    rowPath[j].Controls.Add(cellPath[j]);

                    cellMain.Controls.Add(tblrep[j]);
                    rowMain.Controls.Add(cellMain);

                }
            }
            //tables of reports added to the placeholder phUpdateActivity
            phUpdateActivity.Controls.Clear();
            phUpdateActivity.Controls.Add(main);
            phUpdateActivity.Visible = true;
            tr_phUpdateActivity.Visible = true;

            //read the tables of reports in HTML.
            //store it in the member variable for export task.
            //store in the hidden field for email task.
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            System.IO.StringWriter stringWrite = new System.IO.StringWriter(sb);
            HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
            string siteRptHtml = "";
            main.RenderControl(htmlWrite);
            _ReportTableHtml = sb.ToString();
            siteRptHtml = "<input id=\"siteRptHtml\" type=\"hidden\" name=\"siteRptHtml\" value=\"" + Ektron.Cms.Common.EkFunctions.HtmlEncode(_ReportTableHtml) + "\"/>";
            siteRptHtml = siteRptHtml + "<script type=\"text/javascript\">setDisplayMode(\'" + _ReportDisplay + "\');</script>";
            SiteActivityHtml.Text = siteRptHtml;
        }
    }
Example #43
0
        // multiple dates nested repeater databound
        protected void MultipleDates_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            // declaare our varibles
            Repeater catsRates = e.Item.FindControl("MultipleDates") as Repeater;

            Literal      CSSClassRmCat   = e.Item.FindControl("romatlblCssClass") as Literal;
            LinkButton   DeleteRmCatRate = e.Item.FindControl("DelRoomCatRate") as LinkButton;
            TextBox      TheCategoryBox  = e.Item.FindControl("Hotel_room_category") as TextBox;
            TextBox      RatesTextBox    = e.Item.FindControl("Hotel_room_category_Rate") as TextBox;
            HiddenField  RmCatHiddenID   = e.Item.FindControl("roomCatID") as HiddenField;
            HiddenField  RmRateHiddenID  = e.Item.FindControl("roomRateID") as HiddenField;
            DropDownList CurCode         = e.Item.FindControl("currencyCodes") as DropDownList;

            //RequiredFieldValidator firtRowValidTwoInner = e.Item.FindControl("RMCatEndDte_Start_Val") as RequiredFieldValidator;


            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                RatesTextBox.Attributes.Add("onkeydown", "javascript:return jsDecimals(event);");
                RmCatHiddenID.Value  = DataBinder.Eval(e.Item.DataItem, "LID").ToString();
                RmRateHiddenID.Value = DataBinder.Eval(e.Item.DataItem, "LID").ToString();

                // bind and rebind currency drop down in inner repeater - rebind is for on selected index changed we up db and need to rebind
                DataSet ds = new DataSet();
                ds.ReadXml(MapPath("~/Resources/countryCurrency.xml"));

                //get the dataview of table "Country", which is default table name
                DataView dv = ds.Tables["CurrencyRegion"].DefaultView;
                //or we can use:
                //DataView dv = ds.Tables[0].DefaultView;

                //Now sort the DataView vy column name "Name"
                dv.Sort = "Name";

                //now define datatext field and datavalue field of dropdownlist
                CurCode.DataTextField  = "Name";
                CurCode.DataValueField = "ID";

                //now bind the dropdownlist to the dataview
                CurCode.DataSource = dv;
                CurCode.DataBind();

                // select default value of USD for american dollar
                CurCode.SelectedValue = "USD";

                CurCode.SelectedValue = DataBinder.Eval(e.Item.DataItem, "szCurCode").ToString();
                //CurCode.
                //CurCode.Attributes.Add("onMouseOver", "Open_ddl('" + CurCode.ClientID + "');");
                //CurCode.Attributes.Add("onMouseOut", "Close_ddl('" + CurCode.ClientID + "');");

                //ListItemCollection lic = new ListItemCollection();
                //lic = CurCode.Items;
                //foreach (ListItem li in lic)
                //{
                //    // here you can set any css property
                //    li.Attributes.Add("Style", "height:1px");

                //}


                if (e.Item.ItemIndex == 0)
                {
                    CSSClassRmCat.Text = "innerreapterRoomCat";

                    if (Lastseason.Value.ToString() == DataBinder.Eval(e.Item.DataItem, "LSID").ToString())
                    {
                        DeleteRmCatRate.Visible = false;
                    }
                    else
                    {
                        // this is the first record that shows automatically
                        // with season so don't show delete category or rate button

                        //DeleteRmCatRate.Enabled = false;
                    }

                    DeleteRmCatRate.Attributes.Add("onClick", "confirmLinkDeleteSeason(this); return false;");
                    DeleteRmCatRate.CommandName = "DeletewholeSeason";
                }
                else if (e.Item.ItemIndex > 0)
                {
                    // we have more then index = 0 now show delete button
                    CSSClassRmCat.Text          = "innerreapterRoomCatExtraEntry";
                    DeleteRmCatRate.CommandName = "DeleteRMCategory";
                    DeleteRmCatRate.Attributes.Add("onClick", "confirmLinkDeleteRmRt(this); return false;");
                    //DeleteRmCatRate.Enabled = true;
                }
            }
        }
        YamlObject FromRepeater(Repeater content, YamlMap superclassContent)
        {
            var result = superclassContent;

            return(result);
        }
Example #45
0
 /// <summary>
 /// 简单列表绑定
 /// </summary>
 /// <param name="rep">列表对象</param>
 public void Bind(Repeater rep)
 {
     rep.DataSource = this.EnumList;
     rep.DataBind();
 }
Example #46
0
 public static Control FindFooterControl(this Repeater repeater, string controlID)
 {
     return(repeater.Controls[repeater.Controls.Count - 1].FindControl(controlID));
 }
Example #47
0
        void AddAnotherRoomAndRate(RepeaterCommandEventArgs e)
        {
            // declare our repeater to rebind to
            Repeater DatesRates = e.Item.FindControl("MultipleDates") as Repeater;

            // first insert or add the new category and rate
            using (SqlConnection addnewRmCatRate_Conn = new SqlConnection(RFPDBconnStr))
            {
                // start cmd object
                using (SqlCommand addnewRmCatRate_cmd = new SqlCommand("dbo.sp_RFP_AddRmCatRate", addnewRmCatRate_Conn))
                {
                    addnewRmCatRate_cmd.CommandText    = "dbo.sp_RFP_AddRmCatRate";
                    addnewRmCatRate_cmd.CommandType    = CommandType.StoredProcedure;
                    addnewRmCatRate_cmd.CommandTimeout = 0;

                    // first paraemter
                    SqlParameter addnewRmCatRate_Param = addnewRmCatRate_cmd.CreateParameter();
                    addnewRmCatRate_Param.ParameterName = "@LRFPID";
                    addnewRmCatRate_Param.Direction     = ParameterDirection.Input;
                    addnewRmCatRate_Param.SqlDbType     = SqlDbType.Int;
                    addnewRmCatRate_Param.Value         = Decrypt(HttpContext.Current.Request.QueryString["ORFP"], "trappOvation");

                    addnewRmCatRate_cmd.Parameters.Add(addnewRmCatRate_Param);

                    // second parameter
                    addnewRmCatRate_Param = addnewRmCatRate_cmd.CreateParameter();
                    addnewRmCatRate_Param.ParameterName = "@LSID";
                    addnewRmCatRate_Param.Direction     = ParameterDirection.Input;
                    addnewRmCatRate_Param.SqlDbType     = SqlDbType.Int;
                    addnewRmCatRate_Param.Value         = e.CommandArgument.ToString();

                    addnewRmCatRate_cmd.Parameters.Add(addnewRmCatRate_Param);

                    addnewRmCatRate_Conn.Open();

                    // execute entry
                    addnewRmCatRate_cmd.ExecuteNonQuery();
                }
            }

            //// now do a select and rebind what we just inserted
            using (SqlConnection InnerRepeatRmCat_Conn = new SqlConnection(RFPDBconnStr))
            {
                using (SqlCommand InnerRepeatRmCat_cmd = new SqlCommand("dbo.sp_RFP_GetRmCatRebind", InnerRepeatRmCat_Conn))
                {
                    InnerRepeatRmCat_cmd.CommandText    = "dbo.sp_RFP_GetRmCatRebind";
                    InnerRepeatRmCat_cmd.CommandType    = CommandType.StoredProcedure;
                    InnerRepeatRmCat_cmd.CommandTimeout = 0;

                    // first paraemter
                    SqlParameter InnerRepeatRmCat_Param = InnerRepeatRmCat_cmd.CreateParameter();
                    InnerRepeatRmCat_Param.ParameterName = "@LSID";
                    InnerRepeatRmCat_Param.Direction     = ParameterDirection.Input;
                    InnerRepeatRmCat_Param.SqlDbType     = SqlDbType.Int;
                    InnerRepeatRmCat_Param.Value         = e.CommandArgument.ToString();

                    InnerRepeatRmCat_cmd.Parameters.Add(InnerRepeatRmCat_Param);


                    // second paraemter
                    InnerRepeatRmCat_Param = InnerRepeatRmCat_cmd.CreateParameter();
                    InnerRepeatRmCat_Param.ParameterName = "@LRFPID";
                    InnerRepeatRmCat_Param.Direction     = ParameterDirection.Input;
                    InnerRepeatRmCat_Param.SqlDbType     = SqlDbType.Int;
                    InnerRepeatRmCat_Param.Value         = Decrypt(HttpContext.Current.Request.QueryString["ORFP"], "trappOvation");

                    InnerRepeatRmCat_cmd.Parameters.Add(InnerRepeatRmCat_Param);

                    InnerRepeatRmCat_Conn.Open();

                    using (SqlDataReader InnerRepeatRmCat_Reader = InnerRepeatRmCat_cmd.ExecuteReader())
                    {
                        DatesRates.DataSource = InnerRepeatRmCat_Reader;
                        DatesRates.DataBind();
                    }
                }
            }
        }
Example #48
0
 public void Loadmenu(int pos, ref Repeater rp)
 {
     rp.DataSource = per.Loadmenu_footer(pos);
     rp.DataBind();
 }
Example #49
0
 public void DrawInspector(Repeater node)
 {
     EditorGUILayout.LabelField(new GUIContent("Repeater"), TitleStyle);
     EditorGUILayout.Space ();
     string message = "Repeater decorator sends the tick signal to its child every time that its child returns a SUCCESS or FAILURE.";
     EditorGUILayout.HelpBox(message, MessageType.Info);
     EditorGUILayout.HelpBox("Not yet implemented!", MessageType.Error);
 }
Example #50
0
 //+
 //- @InstantiateIn -//
 public void InstantiateIn(System.Web.UI.Control container)
 {
     System.Web.UI.WebControls.PlaceHolder pane = new System.Web.UI.WebControls.PlaceHolder();
     switch (type)
     {
     case ListItemType.Item:
         pane.DataBinding += new EventHandler(delegate(Object sender, System.EventArgs ea)
         {
             RepeaterItem item = (RepeaterItem)pane.NamingContainer;
             //+
             System.Web.UI.WebControls.Literal dtHeader = new System.Web.UI.WebControls.Literal();
             dtHeader.Text = "<dl class=\"index-section-list\"><dt>";
             pane.Controls.Add(dtHeader);
             //+
             System.Web.UI.WebControls.Literal image = new System.Web.UI.WebControls.Literal();
             Themelia.Template template  = new Themelia.Template(Themelia.Template.Common.Image);
             Themelia.Map map            = new Themelia.Map();
             BlogEntryType blogEntryType = FindBlogEntryType((String)DataBinder.Eval(item.DataItem, "TypeGuid"));
             if (blogEntryType != null && !String.IsNullOrEmpty(blogEntryType.Extra))
             {
                 map.Add("Source", blogEntryType.Extra);
                 map.Add("Text", blogEntryType.Name);
                 image.Text = template.Interpolate(map);
                 pane.Controls.Add(image);
             }
             //+
             System.Web.UI.WebControls.Literal dtddConnection = new System.Web.UI.WebControls.Literal();
             dtddConnection.Text = "</dt><dd>";
             pane.Controls.Add(dtddConnection);
             //+
             System.Web.UI.WebControls.Literal link = new System.Web.UI.WebControls.Literal();
             template = new Themelia.Template(Themelia.Template.Common.Link);
             map      = new Themelia.Map();
             map.Add("Link", (String)DataBinder.Eval(item.DataItem, "Url"));
             map.Add("Text", (String)DataBinder.Eval(item.DataItem, "Title"));
             link.Text = template.Interpolate(map);
             pane.Controls.Add(link);
             //+
             List <Minima.Service.Label> labelList = (List <Minima.Service.Label>)DataBinder.Eval(item.DataItem, "LabelList");
             if (labelList != null && labelList.Count > 0)
             {
                 Repeater rptLabel   = new Repeater();
                 rptLabel.DataSource = labelList.Select(label => new
                 {
                     Title = label.Title,
                     Url   = LabelHelper.GetLabelUrl(label)
                 });
                 rptLabel.HeaderTemplate = new IndexLabelListTemplate(ListItemType.Header);
                 rptLabel.ItemTemplate   = new IndexLabelListTemplate(ListItemType.Item);
                 rptLabel.FooterTemplate = new IndexLabelListTemplate(ListItemType.Footer);
                 pane.Controls.Add(rptLabel);
             }
             //+
             System.Web.UI.WebControls.Literal ddFooter = new System.Web.UI.WebControls.Literal();
             ddFooter.Text = "</dd></dl>";
             pane.Controls.Add(ddFooter);
         });
         break;
     }
     container.Controls.Add(pane);
 }
Example #51
0
    public void AddPictures(Object sender, GridViewRowEventArgs e)
    {
        if (e != null && e.Row.RowType == DataControlRowType.DataRow)
        {
            Aircraft ac = (Aircraft)e.Row.DataItem;

            // Refresh the images
            if (!IsAdminMode)
            {
                ((Controls_mfbHoverImageList)e.Row.FindControl("mfbHoverThumb")).Refresh();
            }

            // Show aircraft capabilities too.
            Controls_popmenu popup = (Controls_popmenu)e.Row.FindControl("popmenu1");
            switch (ac.RoleForPilot)
            {
            case Aircraft.PilotRole.None:
                ((RadioButton)popup.FindControl("rbRoleNone")).Checked = true;
                break;

            case Aircraft.PilotRole.CFI:
                ((RadioButton)popup.FindControl("rbRoleCFI")).Checked = true;
                break;

            case Aircraft.PilotRole.SIC:
                ((RadioButton)popup.FindControl("rbRoleSIC")).Checked = true;
                break;

            case Aircraft.PilotRole.PIC:
                ((RadioButton)popup.FindControl("rbRolePIC")).Checked = true;
                break;
            }
            ((CheckBox)popup.FindControl("ckShowInFavorites")).Checked = !ac.HideFromSelection;
            ((CheckBox)popup.FindControl("ckAddNameAsPIC")).Checked    = ac.CopyPICNameWithCrossfill;

            ((Label)popup.FindControl("lblOptionHeader")).Text = String.Format(CultureInfo.CurrentCulture, Resources.Aircraft.optionHeader, ac.DisplayTailnumber);

            if (!IsAdminMode)
            {
                List <LinkedString> lst = new List <LinkedString>();

                if (ac.Stats != null)
                {
                    lst.Add(ac.Stats.UserStatsDisplay);
                }
                MakeModel mm = MakeModel.GetModel(ac.ModelID);
                if (mm != null)
                {
                    if (!String.IsNullOrEmpty(mm.FamilyName))
                    {
                        lst.Add(new LinkedString(ModelQuery.ICAOPrefix + mm.FamilyName));
                    }

                    foreach (string sz in mm.AttributeList(ac.AvionicsTechnologyUpgrade, ac.GlassUpgradeDate))
                    {
                        lst.Add(new LinkedString(sz));
                    }
                }

                Repeater rpt = (Repeater)e.Row.FindControl("rptAttributes");
                rpt.DataSource = lst;
                rpt.DataBind();
            }

            Controls_mfbSelectTemplates selectTemplates = (Controls_mfbSelectTemplates)popup.FindControl("mfbSelectTemplates");
            foreach (int i in ac.DefaultTemplates)
            {
                selectTemplates.AddTemplate(i);
            }

            selectTemplates.Refresh();

            if (IsAdminMode)
            {
                HyperLink lnkRegistration = (HyperLink)e.Row.FindControl("lnkRegistration");
                string    szURL           = ac.LinkForTailnumberRegistry();
                lnkRegistration.Visible     = szURL.Length > 0;
                lnkRegistration.NavigateUrl = szURL;
            }
        }
    }
Example #52
0
 void Awake()
 {
     myRepeater = new Repeater(1f);
 }
Example #53
0
 public static Control FindHeaderControl(this Repeater repeater, string controlID)
 {
     return(repeater.Controls[0].FindControl(controlID));
 }
Example #54
0
        protected override void rptBookingList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                Repeater rptCruisesRow = e.Item.FindControl("rptCruisesRow") as Repeater;
                if (rptCruisesRow != null)
                {
                    rptCruisesRow.DataSource = AllCruises;
                    rptCruisesRow.DataBind();
                }

                Repeater rptCruiseRoom = e.Item.FindControl("rptCruiseRoom") as Repeater;
                if (rptCruiseRoom != null)
                {
                    rptCruiseRoom.DataSource = AllCruises;
                    rptCruiseRoom.DataBind();
                }
            }

            #region -- Item --
            if (e.Item.DataItem is DateTime)
            {
                Literal litTr = e.Item.FindControl("litTr") as Literal;
                if (litTr != null)
                {
                    if (e.Item.ItemType == ListItemType.Item)
                    {
                        litTr.Text = "<tr>";
                    }
                    else
                    {
                        litTr.Text = @"<tr style=""background-color:#E9E9E9"">";
                    }
                }

                DateTime date      = (DateTime)e.Item.DataItem;
                Label    labelDate = (Label)e.Item.FindControl("labelDate");
                if (labelDate != null)
                {
                    labelDate.Text = date.ToString("dd/MM/yyyy");
                }

                HyperLink hplDate = (HyperLink)e.Item.FindControl("hplDate");
                if (hplDate != null)
                {
                    hplDate.Text        = date.ToString("dd/MM/yyyy");
                    hplDate.NavigateUrl = string.Format("BookingReport.aspx?NodeId={0}&SectionId={1}&Date={2}", Node.Id,
                                                        Section.Id, date.ToOADate());
                }

                #region -- Counting --
                int count;
                // Điều kiện bắt buộc
                ICriterion criterion = Expression.And(Expression.Eq("Deleted", false),
                                                      Expression.Eq("Status", StatusType.Approved));
                // Không bao gồm booking transfer
                criterion      = Expression.And(criterion, Expression.Not(Expression.Eq("IsTransferred", true)));
                criterion      = Module.AddDateExpression(criterion, date);
                _util.Bookings = Module.GetBookingListInPeriod(false, StatusType.Approved, false, date);

                Repeater rptCruiseRoom = e.Item.FindControl("rptCruiseRoom") as Repeater;
                if (rptCruiseRoom != null)
                {
                    rptCruiseRoom.DataSource = AllCruises;
                    rptCruiseRoom.DataBind();
                }
                #endregion
            }
            #endregion
        }