Esempio n. 1
0
    protected void rptTickets_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            Guid actId = Guid.Parse(Request.QueryString["actId"]);
            TourActivity ta = bllTourActivity.GetOne(actId);
            Ticket ticket = e.Item.DataItem as Ticket;
            IList<ActivityTicketAssign> listTa = ta.GetActivityAssignForTicket(ticket.ProductCode).ToList();
            int Amount = 0;
            foreach (var ata in listTa)
            {
                Amount += ata.SoldAmount;
            }
            ticketSolidTotal += Amount;
            Literal laSolidAmount = e.Item.FindControl("laSolidAmount") as Literal;
            laSolidAmount.Text = Amount.ToString();

            Literal laCheckAmount = e.Item.FindControl("laCheckAmount") as Literal;
            int checkAmount = 0;
            IList<TicketAssign> listTicketAssign= bllOd.GetTaForIdCardInActivity(ta.ActivityCode,ticket.Id);
            foreach (var item in listTicketAssign)
            {
                checkAmount++;
            }
            ticketCheckTotal += checkAmount;
            laCheckAmount.Text = checkAmount.ToString();
        }
        if (e.Item.ItemType == ListItemType.Footer)
        {
            Literal laSolidTotalAmount = e.Item.FindControl("laSolidTotalAmount") as Literal;
            Literal laCheckTotalAmount = e.Item.FindControl("laCheckTotalAmount") as Literal;
            laSolidTotalAmount.Text = ticketSolidTotal.ToString();
            laCheckTotalAmount.Text = ticketCheckTotal.ToString();
        }
    }
    protected void rpJobList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item is RepeaterItem)
        {
            RepeaterItem dataitem = (RepeaterItem)e.Item;
            Label lblstatus = (Label)dataitem.FindControl("lblstatus");
            HyperLink Hystatus = (HyperLink)dataitem.FindControl("Hystatus");

            HtmlControl licolor = (HtmlControl)dataitem.FindControl("licolor");

            if (lblstatus.Text.ToUpper() == "YES")
            {
                Hystatus.CssClass = "txt_black";
                Hystatus.Enabled = true;
                licolor.Attributes.Add("class", "txt_black");
            }
            else
            {
                Hystatus.CssClass = "txt_gray";
                Hystatus.ToolTip = "No Jobs";
                Hystatus.Enabled = false;
                licolor.Attributes.Add("class", "txt_gray");
            }
        }
    }
Esempio n. 3
0
    public void EventsListing_OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            Monks.jkp_Retreat ret = (Monks.jkp_Retreat)e.Item.DataItem;
            HyperLink lblEventName = (HyperLink)e.Item.FindControl("lblEventName");
            Label lblStartDate = (Label)e.Item.FindControl("lblStartDate");
            Label lblEndDate = (Label)e.Item.FindControl("lblEndDate");
            Label lblDescription = (Label)e.Item.FindControl("lblDescription");

            // Hyperlink to Event Registration
            lblEventName.Text = ret.Ret_Name;
            lblEventName.NavigateUrl += ret.Ret_ID.ToString();

            // Start Date
            lblStartDate.Text = ret.Ret_StartDate.ToShortDateString();

            // End Date
            lblEndDate.Text = ret.Ret_EndDate.ToShortDateString();

            // Event Description
            lblDescription.Text = ShortenString(RemoveHTMLFromText(ret.Ret_Description.ToString()), 250);

        }
    }
Esempio n. 4
0
    protected void RptPageType_DataBound(object source, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {

            Repeater RptPageList = (Repeater)e.Item.FindControl("RptPageList");
            DataRowView rowv = (DataRowView)e.Item.DataItem;//找到分类Repeater关联的数据项

            string _strManagerID = LCmn.Func.GetManageID();
            if (string.IsNullOrEmpty(_strManagerID)) return;

            string _strRoleID = Cmn.DB.getFieldValue("select roleID from adm_manager where managerID='" + _strManagerID + "';");
            if (_strRoleID.Equals("1"))
            {
                _strSql = "select ManagePageDesc,ManagePageUrl,ManagePageType from adm_managePage where ManagePageType=" + rowv[0] + " order by SortID desc";
            }
            else
            {
                _strSql = @"select ManagePageDesc,ManagePageUrl,ManagePageType from adm_managePage mp
                                inner join adm_authority a on mp.ManagePageID=a.ManagePageID
                                where roleId='" + _strRoleID + " and  ManagePageType=" + rowv[0] + " ' " + @"
                                order by SortID desc";
            }
            RptPageList.DataSource = Cmn.DB.getDataTable(_strSql);
            RptPageList.DataBind();
        }
    }
Esempio n. 5
0
 protected void rptTeams_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     DropDownList drpStanding = (DropDownList)e.Item.FindControl("drpStanding");
     int year = cf.getMaxYear();
     SortedList teams = new SortedList();
     int cnt = 0;
     if (Session["user"] != null)
     {
         user u = (user)Session["user"];
         teams = u.get_teams();
         rptTeams.DataSource = null;
     }
     if (teams == null)
     {
         teams = cf.getTeams(year);
     }
     cnt = teams.Count;
     for (int i = 0; i < cnt; i++)
     {
         int s = i + 1;
         drpStanding.Items.Add(new ListItem(s.ToString(), s.ToString()));
     }
     try
     {
         drpStanding.SelectedIndex = e.Item.ItemIndex;
     }
     catch (Exception ex)
     {
         cf.logError(ex);
     }
 }
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         HtmlItemInfo htmlItem = e.Item.DataItem as HtmlItemInfo;
         HyperLink hlnkName = e.Item.FindControl("hlnkName") as HyperLink;
         Image imgNew = e.Item.FindControl("imgNew") as Image;
         Label lblUpdateTime = e.Item.FindControl("lblUpdateTime") as Label;
         hlnkName.Text = htmlItem.Name;
         string p = "";
         if (!string.IsNullOrEmpty(Request["m1"]))
         {
             p += "&m1=" + Request["m1"];
         }
         if (!string.IsNullOrEmpty(Request["m2"]))
         {
             p += "&m2=" + Request["m2"];
         }
         hlnkName.NavigateUrl = string.Format("ShowContent.aspx?id={0}{1}", htmlItem.Id, p);
         if (htmlItem.LastUpdateTime.AddDays(7) > DateTime.Now)
         {
             imgNew.ToolTip = "new";
             imgNew.ImageUrl = "Images/new.gif";
         }
         else
         {
             imgNew.Visible = false;
         }
         lblUpdateTime.Text = htmlItem.LastUpdateTime.ToString("(yyyy-MM-dd HH:mm:ss)");
     }
 }
Esempio n. 7
0
   void m_repMapRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
   {
      TadImage oImageInfo = e.Item.DataItem as TadImage;

      LinkButton oLink = e.Item.FindControl("m_lbName") as LinkButton;
      oLink.Text = oImageInfo.Title;
      oLink.PostBackUrl = "ViewMap.aspx?ImageId=" + oImageInfo.Id;

      Label oLabel = e.Item.FindControl("m_lblDescription") as Label;
      oLabel.Text = oImageInfo.Description;

      Image oImage = e.Item.FindControl("m_imgImage") as Image;
      oImage.Width = 80;
      oImage.Height = 80;

      PostBackOptions options = new PostBackOptions(oLink, "", "ViewMap.aspx?ImageId=" + oImageInfo.Id, true, false, false, true, false, "");
      
      HtmlControl oDiv = e.Item.FindControl("ListItem") as HtmlControl;
      oDiv.Attributes.Add("onClick", ClientScript.GetPostBackEventReference(options));
      oDiv.Attributes.Add("onMouseOver", "this.style.background = '#FFFFCC';");
      oDiv.Attributes.Add("onMouseOut", "this.style.background = '#FFFFFF';");

      ThreeSharpWrapper s3 = new ThreeSharpWrapper(S3Storage.AccessKey, S3Storage.SecretAccessKey);
      oImage.ImageUrl = s3.GetUrl(S3Storage.BucketName, "Square_" + oImageInfo.StorageKey);
      //oImage.ImageUrl = "http://" + S3Storage.BucketName + ".s3.amazonaws.com/Square_" + oImageInfo.StorageKey;
   }
Esempio n. 8
0
 protected void gvSpcl_RowDataBound(object sender,RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         //
     }
 }
    protected void BindQuestionText(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            bool isSubQuestion = Convert.ToBoolean(((Label)e.Item.FindControl("lblIsSubQuestion")).Text);

            Label questionLabel = (Label)e.Item.FindControl("lblQuestionText");

            string unformattedQuestionText = questionLabel.Text;

            string formattedQuestionText = null;

            if (isSubQuestion)
            {
                formattedQuestionText = unformattedQuestionText;
            }
            else
            {
                formattedQuestionText = "<b>" + (questionNumber + 1).ToString() + ". " + unformattedQuestionText + "</b>";
                questionNumber++;
            }

            questionLabel.Text = formattedQuestionText;
        }
    }
Esempio n. 10
0
 protected void rptETMonthDetail_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         DJ_GroupConsumRecord record = e.Item.DataItem as DJ_GroupConsumRecord;
         Literal laCountInfo = e.Item.FindControl("laCountInfo") as Literal;
         if (blldjent.GetDJS8id(entid.ToString())[0].Type == EnterpriseType.景点)
         {
             totalmonth_audlt += record.AdultsAmount;
             totalmonth_child += record.ChildrenAmount;
             totalyear_child += record.ChildrenAmount;
             totalyear_adult += record.AdultsAmount;
             laCountInfo.Text = "成人" + record.AdultsAmount.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;" + "儿童" + record.ChildrenAmount.ToString();
         }
         if (blldjent.GetDJS8id(entid.ToString())[0].Type == EnterpriseType.宾馆)
         {
             totalmonth_audlt += record.AdultsAmount * record.LiveDay;
             totalmonth_child += record.ChildrenAmount * record.LiveDay;
             totalyear_adult += record.AdultsAmount * record.LiveDay;
             totalyear_child += record.ChildrenAmount * record.LiveDay;
             laCountInfo.Text = "成人" + (record.AdultsAmount * record.LiveDay).ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;" + "儿童" + (record.ChildrenAmount * record.LiveDay).ToString();
         }
         Literal laMonthTotal = e.Item.Parent.Parent.FindControl("laMonthTotal") as Literal;
         laMonthTotal.Text = "成人" + totalmonth_audlt.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;" + "儿童" + totalmonth_child.ToString();
     }
 }
    protected void rptrNewsInHome_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            {
                Label lblIDNews = e.Item.FindControl("lblIDNews") as Label;
                HyperLink lnkTitle = e.Item.FindControl("lnkTitle") as HyperLink;
                HyperLink lnkImage = e.Item.FindControl("lnkImage") as HyperLink;
                Image imgMinhhoa = e.Item.FindControl("imgMinhhoa") as Image;
                Label lblDesc = e.Item.FindControl("lblDesc") as Label;
                HyperLink lnkChitiet = e.Item.FindControl("lnkChitiet") as HyperLink;
                if (lnkTitle != null && imgMinhhoa != null && lnkChitiet != null && lnkImage != null && lblDesc != null)
                {
                    NewsEntity newsEntity = new NewsEntity();
                    newsEntity = NewsBRL.GetOne(Convert.ToInt32(lblIDNews.Text));
                    lnkTitle.NavigateUrl = "~/Content.aspx?sID=" + newsEntity.iNewsID;
                    lnkChitiet.NavigateUrl = "~/Content.aspx?sID=" + newsEntity.iNewsID;
                    lnkTitle.Text = INVI.INVILibrary.INVIString.GetCuttedString(newsEntity.sTitle, 70);
                    if (File.Exists(Server.MapPath(ConfigurationManager.AppSettings["UploadPath"] + newsEntity.sImage)))
                        imgMinhhoa.ImageUrl = ConfigurationManager.AppSettings["UploadPath"] + newsEntity.sImage;
                    else
                    {
                        Panel pnAnh = e.Item.FindControl("pnAnh") as Panel;
                        pnAnh.Visible = false;
                    }
                    lblDesc.Text = INVI.INVILibrary.INVIString.GetCuttedString(newsEntity.sDesc, 150);
                }

            }
        }
    }
Esempio n. 12
0
    protected void RptFAQ_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
        {
            Label lblQuestion = (Label)e.Item.FindControl("lblQuestion");
            LinkButton lnkEdit = (LinkButton)e.Item.FindControl("lnkEdit");
            LinkButton lnkDelete = (LinkButton)e.Item.FindControl("lnkDelete");

            int nID = ConvertData.ConvertToInt(DataBinder.Eval(e.Item.DataItem, "FAQID"));
            int nCategoryID = ConvertData.ConvertToInt(DataBinder.Eval(e.Item.DataItem, "FAQCategoryId"));
            int nStatus = ConvertData.ConvertToInt(DataBinder.Eval(e.Item.DataItem, "Status"));

            string sItemTitle = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "Question"));
            if (sItemTitle == "")
                sItemTitle = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "Question_default"));
            if (sItemTitle.Length > 80)
                sItemTitle = ConvertData.TruncateString(sItemTitle, 80) + Constants.DOT;
            lblQuestion.Text = sItemTitle;

            lnkDelete.CommandArgument = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "FAQID"));
            lnkDelete.OnClientClick = Support.CreateConfirmBoxClient(MessagesAlert.DELETE_ALERT);
            lnkEdit.CommandArgument = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "FAQID"));

        }
    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            int id = int.Parse(((Label)e.Item.FindControl("lb_ID")).Text);
            QNA_QuestionBLL q = new QNA_QuestionBLL(id);

            RadioButtonList rbl_Result = (RadioButtonList)e.Item.FindControl("rbl_Result");
            CheckBoxList cbl_Result = (CheckBoxList)e.Item.FindControl("cbl_Result");
            TextBox tbx_Result = (TextBox)e.Item.FindControl("tbx_Result");

            if (q.Model != null)
            {
                switch (q.Model.OptionMode)
                {
                    case 1:                 //单选
                        rbl_Result.DataSource = q.Items;
                        rbl_Result.DataBind();
                        rbl_Result.Visible = true;
                        break;
                    case 2:                 //多选
                        cbl_Result.DataSource = q.Items;
                        cbl_Result.DataBind();
                        cbl_Result.Visible = true;
                        break;
                    case 3:                 //输入文本
                        tbx_Result.Visible = true;
                        break;
                }
            }
        }
    }
Esempio n. 14
0
    //===============================================================
    // Function: trackedEventsRepeater_ItemDataBound
    //===============================================================
    protected void trackedEventsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.DataItem != null &&
            (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem))
        {
            DataRowView row = e.Item.DataItem as DataRowView;

            int eventID = int.Parse(row["EventID"].ToString());
            SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);

            HyperLink eventNameLabel = e.Item.FindControl("eventNameLabel") as HyperLink;
            eventNameLabel.NavigateUrl = "viewEvent.aspx?EID=" + row["EventID"].ToString();
            eventNameLabel.Text = row["EventName"].ToString();

            HyperLink userNameLabel = e.Item.FindControl("userNameLabel") as HyperLink;
            userNameLabel.Text = row["FirstName"].ToString() + " " + row["LastName"].ToString();
            userNameLabel.NavigateUrl = "userTimeline.aspx?UID=" + sedogoEvent.userID.ToString();

            Image eventImage = e.Item.FindControl("eventImage") as Image;
            string eventPicThumbnail = row["EventPicThumbnail"].ToString();
            if (eventPicThumbnail == "")
            {
                eventImage.ImageUrl = "~/images/eventThumbnailBlank.png";
            }
            else
            {
                var _event = new SedogoEvent(string.Empty, eventID);
                eventImage.ImageUrl = ImageHelper.GetRelativeImagePath(_event.eventID, _event.eventGUID, ImageType.EventThumbnail);
            }
        }
    }
Esempio n. 15
0
    protected void repDeptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        random++;
        Model.T_Department dept = (Model.T_Department)e.Item.DataItem;
        Literal liDeptID = e.Item.FindControl("liDeptID") as Literal;
        liDeptID.Text = dept.Id.ToString();

        Literal liDeptName = e.Item.FindControl("liDeptName") as Literal;
        liDeptName.Text = dept.DeptName;

        RadioButtonList rblist = e.Item.FindControl("rblist") as RadioButtonList;
        List<int> vdList = new List<int>();

        //生成随机列
        for (int i = 0; i <= 3; i++)
        {
            Random rad = new Random(random);
            int v1 = rad.Next(0, 4);
            while (vdList.Where(v => v == v1).Count() > 0)
            {
                v1 = rad.Next(0, 4);
            };
            vdList.Add(v1);

            ListItem li = liList[v1];
            li.Attributes.Add("onclick", "clickRB(this)");
            rblist.Items.Add(liList[v1]);
        }
    }
Esempio n. 16
0
 protected void rptETMonthDetail_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         DJ_GroupConsumRecord record = e.Item.DataItem as DJ_GroupConsumRecord;
         Literal laVisitedCount = e.Item.FindControl("laVisitedCount") as Literal;
         Literal laLiveCount = e.Item.FindControl("laLiveCount") as Literal;
         if (record.LiveDay > 0)
         {
             totalLmonth_audlt += record.AdultsAmount * record.LiveDay;
             totalLmonth_child += record.ChildrenAmount * record.LiveDay;
             totalLyear_child += record.ChildrenAmount * record.LiveDay;
             totalLyear_adult += record.AdultsAmount * record.LiveDay;
             laLiveCount.Text = "成人" + (record.AdultsAmount * record.LiveDay).ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;" + "儿童" + (record.ChildrenAmount * record.LiveDay).ToString();
             laVisitedCount.Text = "成人0" + "&nbsp;&nbsp;&nbsp;&nbsp;" + "儿童0";
         }
         else
         {
             totalVmonth_audlt += record.AdultsAmount;
             totalVmonth_child += record.ChildrenAmount;
             totalVyear_adult += record.AdultsAmount;
             totalVyear_child += record.ChildrenAmount;
             laVisitedCount.Text = "成人" + record.AdultsAmount.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;" + "儿童" + record.ChildrenAmount.ToString();
             laLiveCount.Text = "成人0" + "&nbsp;&nbsp;&nbsp;&nbsp;" + "儿童0";
         }
         Literal laMonthVTotal = e.Item.Parent.Parent.FindControl("laMonthVTotal") as Literal;
         Literal laMonthLTotal = e.Item.Parent.Parent.FindControl("laMonthLTotal") as Literal;
         laMonthVTotal.Text = "成人" + totalVmonth_audlt.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;" + "儿童" + totalVmonth_child.ToString();
         laMonthLTotal.Text = "成人" + totalLmonth_audlt.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;" + "儿童" + totalLmonth_child.ToString();
     }
 }
Esempio n. 17
0
 protected void rptTgRecord_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         DJ_GroupConsumRecord record = e.Item.DataItem as DJ_GroupConsumRecord;
         Literal laIsChecked = e.Item.FindControl("laIsChecked") as Literal;
         if (record.Id.Equals(Guid.Empty))
         {
             laIsChecked.Text = "未验证";
         }
         else
             laIsChecked.Text = "已验证";
     }
     if (e.Item.ItemType == ListItemType.Footer)
     {
         Literal laGuiderCount = e.Item.FindControl("laGuiderCount") as Literal;
         Literal laAdultCount = e.Item.FindControl("laAdultCount") as Literal;
         Literal laChildrenCount = e.Item.FindControl("laChildrenCount") as Literal;
         int groupcount, adultcount, childrencount;
         bllrecord.GetCountInfoByETid(Master.Scenic.Id, out groupcount, out adultcount, out childrencount, ListRecord);
         laGuiderCount.Text = groupcount.ToString();
         laAdultCount.Text = adultcount.ToString();
         laChildrenCount.Text = childrencount.ToString();
     }
 }
    protected void rptProducts_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
        {
            Label lblPrice = (Label)e.Item.FindControl("lblPrice");
            Label lblID = (Label)e.Item.FindControl("lblID");
            Label lblNameProductTootip = (Label)e.Item.FindControl("lblNameProductTootip");
            HyperLink lnkProductName = (HyperLink)e.Item.FindControl("lnkProductName");
            Label lblInit = (Label)e.Item.FindControl("lblInit");
            HtmlContainerControl div_item = (HtmlContainerControl)e.Item.FindControl("div_item");

            int nIDProduct = ConvertData.ConvertToInt(DataBinder.Eval(e.Item.DataItem, "ProductID"));
            string sTitle = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "ProductName"));
            string sPrice = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "Price"));
            string sIniContent2 = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "InitContent2"));

            string sUrl = "~/ProductDetails.aspx?pid=" + ConvertData.ConvertToString(nIDProduct);// "/" + ConvertData.ReplaceURL(sTitle);

            lblID.Text = ConvertData.ConvertToString(nIDProduct);
            lblNameProductTootip.Text = sTitle;
            lblPrice.Text = sPrice;
            lnkProductName.Text = sTitle;
            lnkProductName.NavigateUrl = sUrl;
            lblInit.Text = sIniContent2;

            left_count +=255;
            string left = "left";
            string left_px = left_count + "px";
            div_item.Style.Add(left, left_px);
        }
    }
Esempio n. 19
0
    protected void AllCenters_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        try
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblAgnetSales = (Label)e.Item.FindControl("lblCenterSales");
                HiddenField hdnAgentSalesCount = (HiddenField)e.Item.FindControl("hdnCenterSalesCount");
                HiddenField hdnAgentAmount = (HiddenField)e.Item.FindControl("hdnCenterAmount");
                HiddenField hdnAgentDiscount = (HiddenField)e.Item.FindControl("hdnCenterDiscount");

                lblAgnetSales.Text = hdnAgentSalesCount.Value + " ($" + string.Format("{0:0.00}", hdnAgentAmount.Value.ToString()).ToString() + ")";
                    if(hdnAgentDiscount.Value!="0.00")
                   lblAgnetSales.Text +=  "- ($"+ string.Format("{0:0.00}", hdnAgentDiscount.Value.ToString()).ToString() +")";

                Label lblVSales = (Label)e.Item.FindControl("lblCenterVSales");
                HiddenField hdnVSalesCount = (HiddenField)e.Item.FindControl("hdnCenterVSalesCount");
                HiddenField hdnVAmount = (HiddenField)e.Item.FindControl("hdnCenterVAmount");
                HiddenField hdnVDiscount = (HiddenField)e.Item.FindControl("hdnCenterVDiscount");
                lblVSales.Text = hdnVSalesCount.Value + "($" + string.Format("{0:0.00}", hdnVAmount.Value.ToString()) + ")";
                  if(hdnVDiscount.Value!="0.00")
                   lblVSales.Text += "- ($" + string.Format("{0:0.00}", hdnVDiscount.Value.ToString()) + ")";
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Esempio n. 20
0
 protected void RepBigType_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         Repeater RepChild = (Repeater)e.Item.FindControl("RepSmallType");
         DataRowView rowv = (DataRowView)e.Item.DataItem;
         int id = 1;
         if (int.TryParse(rowv["id"].ToString(), out id))
         {
             string sql = string.Format("select * from ProductType where isshow = 1 and tid = {0} order by sort,id", id);
             DataTable Info = DB_Help.ExecuteSql(sql);
             if (ShareInfoFactory.CheckTableIsNullOrEmpty(Info))
             {
                 Info.Columns.Add("typeid", typeof(int));
                 for (int i = 0; i < 4; i++)
                 {
                     for (int j = 0; j < Info.Rows.Count; j++)
                     {
                         if (id == int.Parse(Info.Rows[j]["tid"].ToString()))
                         {
                             Info.Rows[j]["typeid"] = id.ToString();
                         }
                     }
                 }
             }
             ShareInfoFactory.ViewInfoToRepeater(Info, RepChild);
         }
     }
 }
Esempio n. 21
0
    protected void repMensagens_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        try
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                //Limpar a mensagem de erro.
                litMensagemErro.Text = string.Empty;
                //Pegar o Container.DataItem e converter para o tipo Message.
                Message mensagem = (Message)e.Item.DataItem;
                //Encontrar os Literals no Repeater
                Literal litDe = (Literal)e.Item.FindControl("litDe");
                Literal litTitulo = (Literal)e.Item.FindControl("litTitulo");
                Literal litMensagem = (Literal)e.Item.FindControl("litMensagem");
                //Popular os literals com os dados do Container.DataItem
                //DisplayName = Nome de quem enviou
                //Address = e-mail de quem enviou
                litDe.Text = string.Format("{0} ({1})", mensagem.Headers.From.DisplayName, mensagem.Headers.From.Address);
                //Subject = Pegar o título da mensagem
                litTitulo.Text = mensagem.Headers.Subject;
                //Pegar o texto da mensagem
                //Verifica se o conteúdo é texto
                MessagePart mpText = mensagem.FindFirstPlainTextVersion();
                MessagePart mpHtml = mensagem.FindFirstHtmlVersion();
                if (mpText != null)
                    litMensagem.Text = mpText.GetBodyAsText();
                else if (mpHtml != null)
                    litMensagem.Text = mpHtml.GetBodyAsText();
            }
        }
        catch
        {

        }
    }
Esempio n. 22
0
    protected void RptExport_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
        {
            Label lblName = (Label)e.Item.FindControl("lblName");
            Label lblPrice = (Label)e.Item.FindControl("lblPrice");
            //Label lblQuantity = (Label)e.Item.FindControl("lblQuantity");
            //Label lblProductTotal = (Label)e.Item.FindControl("lblProductTotal");

            int nQuantity = 1;
            int nProductID = ConvertData.ConvertToInt(DataBinder.Eval(e.Item.DataItem, "ProductID2"));

            Products objProduct = new Products();
            objProduct.LoadById(nProductID);

            string sNameProduct = ConvertData.ConvertToString(objProduct.Data.ProductName);
            int nPrice = ConvertData.ConvertToInt(objProduct.Data.Price);

            lblName.Text = sNameProduct;
            lblPrice.Text = ConvertData.ConvertToString(Support.FormatCurrency(nPrice)) + " " + "vn₫";

            //lblQuantity.Text = ConvertData.ConvertToString(nQuantity);

            int nTotal = nPrice * nQuantity;

            //lblProductTotal.Text = ConvertData.ConvertToString(Support.FormatCurrency(nTotal)) + " " + "vn₫";

            int nTotalOrder = nTotal;
            fSubTotal += ConvertData.ConvertToDouble(nTotal);
        }
        lblTotal.Text = ConvertData.ConvertToString(Support.FormatCurrency(fSubTotal)) + " " + "vn₫";
    }
Esempio n. 23
0
 protected void CartsContainer_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     HiddenField hiddenField = e.Item.FindControl("hiddenReceiptId") as HiddenField;
     Helper.ExecScript(@"
         jsHiddenReceiptId[" + e.Item.ItemIndex + "] = '" + string.Format("#{0}", hiddenField.ClientID) + @"';
     ");
 }
Esempio n. 24
0
    protected void rptNewsList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
        {
            HyperLink lnkimgList = (HyperLink)e.Item.FindControl("lnkimgList");
            Image imgNewsList = (Image)e.Item.FindControl("imgNewsList");
            HyperLink lnkNewName = (HyperLink)e.Item.FindControl("lnkNewName");
            Label lblInitContent = (Label)e.Item.FindControl("lblInitContent");

            int nID = ConvertData.ConvertToInt(DataBinder.Eval(e.Item.DataItem, "NewsID"));
            string sTitle = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "Title"));
            string sURL = Constants.ROOT + Pages.FrontEnds.NEWS + "?" + Constants.NEWS_ID + "=" + nID;
            string sInitContent = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "InitContent"));
            string strImages = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "Image"));

            lnkNewName.Text = sTitle;
            lnkNewName.NavigateUrl = sURL;
            lnkNewName.ToolTip = sTitle;
            lnkimgList.NavigateUrl = sURL;
            lblInitContent.Text = sInitContent;
            imgNewsList.ToolTip = sTitle;
            if (strImages.Length > 0)
            {
                imgNewsList.ImageUrl = Constants.ROOT + Constants.IMAGE_NEWS_DEFAULT_UPLOAD + strImages;
            }
            else
            {
                imgNewsList.ImageUrl = Constants.ROOT + Constants.IMAGE_NO_IMAGE_FRONTEND_280;
            }
        }
    }
Esempio n. 25
0
    protected void Appointments_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        currentAppointment = (Appointment)e.Item.DataItem;
        if (currentAppointment == null)
            return;

        ImageButton btnDel = (ImageButton)e.Item.FindControl("ButtonDelete");
        btnDel.CommandArgument = currentAppointment.Id.ToString();
        btnDel.Attributes["OwnerId"] = LoginState.IsAdmin() ? "admin" : currentAppointment.UserId;

        Repeater inner = (Repeater)e.Item.FindControl("Posts");
        List<Post> posts = new List<Post>();
        foreach (Post p in currentAppointment.AppointmentPosts)
            posts.Add(p);
        posts.Sort((a, b) => a.PostingDate.CompareTo(b.PostingDate));
        inner.DataSource = posts;
        inner.ItemDataBound += new RepeaterItemEventHandler(inner_ItemDataBound);
        inner.DataBind();
        TextBox txt = (TextBox)e.Item.FindControl("Name");
        Button btn = (Button)e.Item.FindControl("ButtonSend");
        btn.CommandArgument = currentAppointment.Id.ToString();
        btn.OnClientClick = string.Format("onSendPost('{0}');", txt.ClientID);
        HtmlImage img = (HtmlImage)e.Item.FindControl("Meteo");
        int idx = currentAppointment.AppointmentDate.DayOfYear - DateTime.Now.DayOfYear;
        if (idx < 0 || idx > 6)
            img.Visible = false;
        else
            img.Src = string.Format("http://www.ilmeteo.it/cartine2/{0}.LIG.png", idx);
    }
Esempio n. 26
0
    protected void CustomTableRep_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataTable dt = new DataTable();
        dt = BCustomFormField.GetTitleList(CustomFormId);

        if (e.Item.ItemType == ListItemType.Header)
        {
            //列举出所有的字段当头部
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sb.Append("<td>"+dt.Rows[i]["Alias"].ToString()+"</td>");
            }
            (e.Item.FindControl("lit_head") as Literal).Text = sb.ToString();
        }

        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)
        {
            //行ID
            int Id = int.Parse((e.Item.FindControl("CustomFormFieldId") as Label).Text);
            drInfo = BInfoOper.GetInfo(MCustomForm.TableName, Id);

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sb.Append("<td>" + Function.Encode(drInfo["" + dt.Rows[i]["Name"].ToString() + ""].ToString()) + "</td>");
            }
            (e.Item.FindControl("lit_item") as Literal).Text = sb.ToString();
        }
    }
    protected void SetAuthor(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            string strAuthorText;
            DataRowView TempRow = (DataRowView)e.Item.DataItem;

            if (TempRow["PortfolioID"].ToString().Length > 0)
                strAuthorText = TempRow["FirstName"].ToString();
            else
            {
                strAuthorText = TempRow["PartnerNickname"].ToString();
                // Make whistle image visible
                if (((CareerCruisingWeb.PageBase.SuperBase)Page).ConSysInfo["CareerCoaches"].ToString() == "True")
                {
                    ((System.Web.UI.WebControls.Image)e.Item.FindControl("CoachImage")).Visible = true;
                }
                else { ((System.Web.UI.WebControls.Image)e.Item.FindControl("CoachImage")).Visible = false; }
            }

            ((Label)e.Item.FindControl("AuthorLabel")).Text = strAuthorText;

            // Also set Deactivate link visibility
            if (_ShowDeactivateLink)
                ((System.Web.UI.HtmlControls.HtmlTableCell)e.Item.FindControl("DeactivateCell")).Visible = true;
            else
                ((System.Web.UI.HtmlControls.HtmlTableCell)e.Item.FindControl("DeactivateCell")).Visible = false;
        }
    }
 /// <summary>
 /// 为RepeaterItem绑定数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void RepeaterItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     //用户控件的使用
     UserControl_TaListItem1 assignmentItem1 = (UserControl_TaListItem1)e.Item.FindControl("TaListItem10");
     //用户控件
     UserControl_TaListItem2 assignmentItem2 = (UserControl_TaListItem2)e.Item.FindControl("TaListItem20");
     //new一个AssignmentInfo对象
     AssignmentInfo a = new AssignmentInfo();
     //初始化
     a.DtAssignDate = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "assignDate"));
     a.DtDeadline = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "deadline"));
     a.IAssignmentId = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ID"));
     a.StrContents = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "contents"));
     a.StrTitle = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "title"));
     //判断作业是否为空
     if (assignmentItem1!=null)
     {
         assignmentItem1.A = a;
         assignmentItem1.Index = index++;
     }
     else
     {
         assignmentItem2.A = a;
         assignmentItem2.Index = index++;
     }
 }
    public void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        //if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
        //    return;

        DataRowView row = (DataRowView)e.Item.DataItem;

        RadioButtonList rbl = new RadioButtonList();
        rbl.RepeatDirection = RepeatDirection.Vertical;
        //string[] ans1;

        //ans1 =Convert.ToString( row["ans"]);
        string[] ans1 = row["ans"].ToString().Split('|');
        //string[] ans1 = row["ans"].ToString();
        //for (int n = 0; n < Choices.Length; n++)
        //{
        //    rbl.Items.Add(new ListItem(Choices[n], n.ToString()));
        //}
        for (int n = 0; n < ans1.Length; n++)
        {
            rbl.Items.Add(new ListItem(ans1[n], n.ToString()));
        }
        if (row["ans"] != DBNull.Value)
            rbl.SelectedIndex = (int)row["ans"];
        //if (row["Answer"] != DBNull.Value)
        //    rbl.SelectedIndex = (int)row["Answer"];
        ((Label)e.Item.FindControl("ChoicesLabel")).Controls.Add(rbl);
    }
        /// <summary>
        /// Handles the ItemDataBound event of the rptrMetricCategory control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RepeaterItemEventArgs"/> instance containing the event data.</param>
        protected void rptrMetricCategory_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var nbMetricsSaved       = e.Item.FindControl("nbMetricsSaved") as NotificationBox;
            var rptrMetric           = e.Item.FindControl("rptrMetric") as Repeater;
            var tbNote               = e.Item.FindControl("tbNote") as RockTextBox;
            var lMetricCategoryTitle = e.Item.FindControl("lMetricCategoryTitle") as Label;

            nbMetricsSaved.Visible = false;

            var metricCategory = ( Category )e.Item.DataItem;


            int campusEntityTypeId   = EntityTypeCache.Read(typeof(Rock.Model.Campus)).Id;
            int scheduleEntityTypeId = EntityTypeCache.Read(typeof(Rock.Model.Schedule)).Id;

            int?     campusId   = bddlCampus.SelectedValueAsInt();
            int?     scheduleId = bddlService.SelectedValueAsInt();
            DateTime?weekend    = bddlWeekend.SelectedValue.AsDateTime();

            var serviceMetricValues = new List <ServiceMetric>();
            var notes = new List <string>();

            // Check to see if we are past the deadline
            Boolean readOnlyMetric  = false;
            var     services        = GetServices(CampusCache.Read(campusId.Value));
            var     selectedService = services.Where(s => s.Id == scheduleId.Value).FirstOrDefault();

            if (selectedService != null && selectedService.GetScheduledStartTimes(weekend.Value.AddDays(-6), weekend.Value.AddSeconds(86399)).Any())
            {
                int?     minutes = GetAttributeValue("DeadlineMinutes").AsIntegerOrNull();
                DateTime service = selectedService.GetScheduledStartTimes(weekend.Value.AddDays(-6), weekend.Value.AddSeconds(86399)).FirstOrDefault();
                if (minutes.HasValue)
                {
                    var theTmp = DateTime.Now.Subtract(service).TotalMinutes;
                    if (DateTime.Now.Subtract(service).TotalMinutes >= minutes.Value)
                    {
                        readOnlyMetric = true;
                    }
                }
                var weekday = GetAttributeValue("DeadlineDay").AsIntegerOrNull();
                var time    = GetAttributeValue("DeadlineTime");
                if (weekday.HasValue && !string.IsNullOrWhiteSpace(time))
                {
                    int      daysUntilDay = (weekday.Value - (int)service.DayOfWeek + 7) % 7;
                    DateTime expireDate   = service.AddDays(daysUntilDay).Date.Add(Convert.ToDateTime(time).TimeOfDay);
                    if (expireDate < DateTime.Now)
                    {
                        readOnlyMetric = true;
                    }
                }
            }

            if (metricCategory != null)
            {
                using (var rockContext = new RockContext())
                {
                    lMetricCategoryTitle.Text = metricCategory.Name;

                    var metricValueService = new MetricValueService(rockContext);
                    foreach (var metric in new MetricService(rockContext)
                             .Queryable()
                             .Where(m =>
                                    m.MetricCategories.Where(mc => mc.CategoryId == metricCategory.Id).Any() &&
                                    m.MetricPartitions.Count == 2 &&
                                    m.MetricPartitions.Any(p => p.EntityTypeId.HasValue && p.EntityTypeId.Value == campusEntityTypeId) &&
                                    m.MetricPartitions.Any(p => p.EntityTypeId.HasValue && p.EntityTypeId.Value == scheduleEntityTypeId))
                             .OrderBy(m => m.Title)
                             .Select(m => new
                    {
                        m.Id,
                        m.Title,
                        CampusPartitionId = m.MetricPartitions.Where(p => p.EntityTypeId.HasValue && p.EntityTypeId.Value == campusEntityTypeId).Select(p => p.Id).FirstOrDefault(),
                        SchedulePartitionId = m.MetricPartitions.Where(p => p.EntityTypeId.HasValue && p.EntityTypeId.Value == scheduleEntityTypeId).Select(p => p.Id).FirstOrDefault(),
                        m.MetricChampionPersonAliasId
                    }))
                    {
                        var serviceMetric = new ServiceMetric(metric.Id, metric.Title, CurrentPerson.Aliases.Where(a => a.Id == metric.MetricChampionPersonAliasId).Any() ? false : readOnlyMetric);

                        if (campusId.HasValue && weekend.HasValue && scheduleId.HasValue)
                        {
                            var metricValue = metricValueService
                                              .Queryable().AsNoTracking()
                                              .Where(v =>
                                                     v.MetricId == metric.Id &&
                                                     v.MetricValueDateTime.HasValue && v.MetricValueDateTime.Value == weekend.Value &&
                                                     v.MetricValuePartitions.Count == 2 &&
                                                     v.MetricValuePartitions.Any(p => p.MetricPartitionId == metric.CampusPartitionId && p.EntityId.HasValue && p.EntityId.Value == campusId.Value) &&
                                                     v.MetricValuePartitions.Any(p => p.MetricPartitionId == metric.SchedulePartitionId && p.EntityId.HasValue && p.EntityId.Value == scheduleId.Value))
                                              .FirstOrDefault();

                            if (metricValue != null)
                            {
                                serviceMetric.Value = metricValue.YValue;

                                if (!string.IsNullOrWhiteSpace(metricValue.Note) &&
                                    !notes.Contains(metricValue.Note))
                                {
                                    notes.Add(metricValue.Note);
                                }
                            }
                        }

                        serviceMetricValues.Add(serviceMetric);
                    }

                    rptrMetric.DataSource = serviceMetricValues;
                    rptrMetric.DataBind();

                    tbNote.Text = notes.AsDelimited(Environment.NewLine + Environment.NewLine);
                }
            }
        }
Esempio n. 31
0
 protected void rptItemDataBound(Object sender, RepeaterItemEventArgs e)
 {
     ConfigurePatientRepeater(sender, e);
 }
Esempio n. 32
0
        public void editorial_categories_Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
        {
// editorial_categories Show Event begin
// editorial_categories Show Event end
        }
 protected void rptPriceLevelCost_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {/*
   * RepeaterItem item = e.Item;
   * if (item.ItemIndex > -1 && item.DataItem is DistributorPriceMarkupBO)
   * {
   *     DistributorPriceMarkupBO objPriceMarkup = (DistributorPriceMarkupBO)item.DataItem;
   *
   *     Literal litCellHeader = (Literal)item.FindControl("litCellHeader");
   *     litCellHeader.Text = objPriceMarkup.objPriceLevel.Name + "<em>( " + objPriceMarkup.objPriceLevel.Volume + " )</em>";
   *
   *     HiddenField hdnCellID = (HiddenField)item.FindControl("hdnCellID");
   *     hdnCellID.Value = "0";
   *
   *     TextBox txtCIFPrice = (TextBox)item.FindControl("txtCIFPrice");
   *     txtCIFPrice.Attributes.Add("level", objPriceMarkup.PriceLevel.ToString());
   *     txtCIFPrice.Text = "0.00";
   *     txtCIFPrice.Enabled = isEnableIndimanCost;
   *
   *     Label lblFOBPrice = (Label)item.FindControl("lblFOBPrice");
   *     lblFOBPrice.Text = "0.00";
   *
   *     Label lblMarkup = (Label)item.FindControl("lblMarkup");
   *     lblMarkup.Text = objPriceMarkup.Markup + "%";
   *
   *     Label lblCIFCost = (Label)item.FindControl("lblCIFCost");
   *     lblCIFCost.Text = "$0.0";
   *
   *     Label lblFOBCost = (Label)item.FindControl("lblFOBCost");
   *     lblFOBCost.Text = "$0.0";
   * }
   * else if (item.ItemIndex > -1 && item.DataItem is PriceLevelCostBO)
   * {
   *     PriceLevelCostBO objPriceLevelCost = (PriceLevelCostBO)item.DataItem;
   *     DistributorPriceMarkupBO objPriceMarkup = objPriceLevelCost.objPriceLevel.DistributorPriceMarkupsWhereThisIsPriceLevel.SingleOrDefault(o => (int)o.Distributor == int.Parse(this.ddlDistributors.SelectedValue.Trim()));
   *
   *     decimal convertion = objPriceLevelCost.objPrice.objPattern.ConvertionFactor;
   *     decimal factoryCost = objPriceLevelCost.FactoryCost;
   *     decimal indimanCIFCost = (factoryCost == 0) ? 0 : Math.Round(Convert.ToDecimal((factoryCost * (100 + objPriceMarkup.Markup)) / 100), 2);
   *
   *     Literal litCellHeader = (Literal)item.FindControl("litCellHeader");
   *     litCellHeader.Text = objPriceLevelCost.objPriceLevel.Name + "<em>( " + objPriceLevelCost.objPriceLevel.Volume + " )</em>";
   *
   *     HiddenField hdnCellID = (HiddenField)item.FindControl("hdnCellID");
   *     hdnCellID.Value = objPriceLevelCost.ID.ToString();
   *
   *     TextBox txtCIFPrice = (TextBox)item.FindControl("txtCIFPrice");
   *     txtCIFPrice.Attributes.Add("level", objPriceLevelCost.PriceLevel.ToString());
   *     txtCIFPrice.Text = objPriceLevelCost.IndimanCost.ToString("0.00");
   *     txtCIFPrice.Enabled = isEnableIndimanCost;
   *
   *     Label lblFOBPrice = (Label)item.FindControl("lblFOBPrice");
   *     lblFOBPrice.Text = ((objPriceLevelCost.IndimanCost != 0) ? (objPriceLevelCost.IndimanCost - objPriceLevelCost.objPrice.objPattern.ConvertionFactor).ToString("0.00") : "0.00");
   *
   *     Label lblMarkup = (Label)item.FindControl("lblMarkup");
   *     lblMarkup.Text = objPriceMarkup.Markup.ToString() + "%";
   *
   *     Label lblCIFCost = (Label)item.FindControl("lblCIFCost");
   *     lblCIFCost.Text = "$" + indimanCIFCost.ToString("0.00");
   *
   *     Label lblFOBCost = (Label)item.FindControl("lblFOBCost");
   *     lblFOBCost.Text = "$" + ((indimanCIFCost == 0) ? 0 : Convert.ToDecimal(indimanCIFCost - convertion)).ToString("0.00");
   * }
   */
 }
Esempio n. 34
0
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
     }
 }
Esempio n. 35
0
        public void Members_Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
        {
// Members Show Event begin
// Members Show Event end
        }
        /// <summary>
        /// The latest posts_ item data bound.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void LatestPosts_ItemDataBound([NotNull] object sender, [NotNull] RepeaterItemEventArgs e)
        {
            // populate the controls here...
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var currentRow = (DataRowView)e.Item.DataItem;

            var topicSubject = this.Get <IBadWordReplace>().Replace(this.HtmlEncode(currentRow["Topic"]));

            // make message url...
            var messageUrl = BuildLink.GetLink(
                ForumPages.Posts,
                "m={0}&name={1}#post{0}",
                currentRow["LastMessageID"],
                topicSubject);

            // get the controls
            var postIcon                   = e.Item.FindControlAs <Label>("PostIcon");
            var textMessageLink            = e.Item.FindControlAs <HyperLink>("TextMessageLink");
            var forumLink                  = e.Item.FindControlAs <HyperLink>("ForumLink");
            var info                       = e.Item.FindControlAs <ThemeButton>("Info");
            var imageMessageLink           = e.Item.FindControlAs <ThemeButton>("GoToLastPost");
            var imageLastUnreadMessageLink = e.Item.FindControlAs <ThemeButton>("GoToLastUnread");
            var lastUserLink               = new UserLink();
            var lastPostedDateLabel        = new DisplayDateTime {
                Format = DateTimeFormat.BothTopic
            };

            var styles = this.Get <BoardSettings>().UseStyledTopicTitles
                             ? this.Get <IStyleTransform>().DecodeStyleByString(currentRow["Styles"].ToString())
                             : string.Empty;

            if (styles.IsSet())
            {
                textMessageLink.Attributes.Add("style", styles);
            }

            textMessageLink.Text = topicSubject;

            var startedByText = this.GetTextFormatted(
                "VIEW_TOPIC_STARTED_BY",
                currentRow[this.Get <BoardSettings>().EnableDisplayName ? "UserDisplayName" : "UserName"].ToString());

            var inForumText = this.GetTextFormatted("IN_FORUM", this.HtmlEncode(currentRow["Forum"].ToString()));

            textMessageLink.ToolTip =
                $"{startedByText} {inForumText}";
            textMessageLink.Attributes.Add("data-toggle", "tooltip");

            textMessageLink.NavigateUrl = BuildLink.GetLink(
                ForumPages.Posts,
                "t={0}&name={1}&find=unread",
                currentRow["TopicID"],
                topicSubject);

            imageMessageLink.NavigateUrl = messageUrl;

            forumLink.Text        = $"({currentRow["Forum"]})";
            forumLink.NavigateUrl = BuildLink.GetForumLink(
                currentRow["ForumID"].ToType <int>(),
                currentRow["Forum"].ToString());

            if (imageLastUnreadMessageLink.Visible)
            {
                imageLastUnreadMessageLink.NavigateUrl = BuildLink.GetLink(
                    ForumPages.Posts,
                    "t={0}&name={1}&find=unread",
                    currentRow["TopicID"],
                    topicSubject);
            }

            // Just in case...
            if (currentRow["LastUserID"] != DBNull.Value)
            {
                lastUserLink.UserID      = currentRow["LastUserID"].ToType <int>();
                lastUserLink.Style       = currentRow["LastUserStyle"].ToString();
                lastUserLink.ReplaceName =
                    currentRow[this.Get <BoardSettings>().EnableDisplayName ? "LastUserDisplayName" : "LastUserName"]
                    .ToString();
            }

            if (currentRow["LastPosted"] != DBNull.Value)
            {
                lastPostedDateLabel.DateTime = currentRow["LastPosted"];

                var lastRead =
                    this.Get <IReadTrackCurrentUser>().GetForumTopicRead(
                        currentRow["ForumID"].ToType <int>(),
                        currentRow["TopicID"].ToType <int>(),
                        currentRow["LastForumAccess"].ToType <DateTime?>() ?? DateTimeHelper.SqlDbMinTime(),
                        currentRow["LastTopicAccess"].ToType <DateTime?>() ?? DateTimeHelper.SqlDbMinTime());

                if (DateTime.Parse(currentRow["LastPosted"].ToString()) > lastRead)
                {
                    postIcon.Visible  = true;
                    postIcon.CssClass = "badge bg-success";

                    postIcon.Text = this.GetText("NEW_MESSAGE");
                }
            }

            var lastPostedDateTime = currentRow["LastPosted"].ToType <DateTime>();

            var formattedDatetime = this.Get <BoardSettings>().ShowRelativeTime
                                        ? lastPostedDateTime.ToString(
                "yyyy-MM-ddTHH:mm:ssZ",
                CultureInfo.InvariantCulture)
                                        : this.Get <IDateTime>().Format(
                DateTimeFormat.BothTopic,
                lastPostedDateTime);

            var span = this.Get <BoardSettings>().ShowRelativeTime ? @"<span class=""popover-timeago"">" : "<span>";

            info.TextLocalizedTag  = "by";
            info.TextLocalizedPage = "DEFAULT";
            info.ParamText0        = this.Get <BoardSettings>().EnableDisplayName
                                  ? currentRow["LastUserDisplayName"].ToString()
                                  : currentRow["LastUserName"].ToString();

            info.DataContent = $@"
                          {lastUserLink.RenderToString()}
                          <span class=""fa-stack"">
                                                    <i class=""fa fa-calendar-day fa-stack-1x text-secondary""></i>
                                                    <i class=""fa fa-circle fa-badge-bg fa-inverse fa-outline-inverse""></i>
                                                    <i class=""fa fa-clock fa-badge text-secondary""></i>
                                                </span>&nbsp;{span}{formattedDatetime}</span>
                         ";
        }
        protected void rptDiffSpecSizeQty_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is SizeChartBO)
            {
                SizeChartBO objSizeChart = (SizeChartBO)item.DataItem;

                TextBox txtQty = (TextBox)item.FindControl("txtQty");
                txtQty.Text = Math.Round(objSizeChart.Val).ToString();

                // txtQty.Attributes.Add("qid", objSizeChart.ID.ToString());
                txtQty.Attributes.Add("MLID", objSizeChart.MeasurementLocation.ToString());
                txtQty.Attributes.Add("SID", objSizeChart.Size.ToString());

                #region Color Selection

                if (objSizeChart.Val >= 6)
                {
                    txtQty.Style.Add("background-color", "#FF0000");
                }
                else if (objSizeChart.Val <= -6)
                {
                    txtQty.Style.Add("background-color", "#FF2828");
                }
                else if (objSizeChart.Val == 5)
                {
                    txtQty.Style.Add("background-color", "#FF3030");
                }
                else if (objSizeChart.Val == -5)
                {
                    txtQty.Style.Add("background-color", "#FF3C3C");
                }
                else if (objSizeChart.Val == 4)
                {
                    txtQty.Style.Add("background-color", "#FF4848");
                }
                else if (objSizeChart.Val == -4)
                {
                    txtQty.Style.Add("background-color", "#FF5555");
                }
                else if (objSizeChart.Val == 3)
                {
                    txtQty.Style.Add("background-color", "#FF5C5C");
                }
                else if (objSizeChart.Val == -3)
                {
                    txtQty.Style.Add("background-color", "#FF6E6E");
                }
                else if (objSizeChart.Val == 2)
                {
                    txtQty.Style.Add("background-color", "#FE7979");
                }
                else if (objSizeChart.Val == -2)
                {
                    txtQty.Style.Add("background-color", "#FF7575");
                }
                else if (objSizeChart.Val == 1)
                {
                    txtQty.Style.Add("background-color", "#FCBBBB");
                }
                else if (objSizeChart.Val == -1)
                {
                    txtQty.Style.Add("background-color", "#FFD7D7");
                }
                #endregion
            }
        }
Esempio n. 38
0
        protected void rp_List_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Task         model          = db.Task.FirstOrDefault(t => t.ID == TaskID);
                int          clatype        = Convert.ToInt32(model.ClassType);   //班次类型
                int          tabtype        = Convert.ToInt32(model.TableTypeID); //表单类型
                HiddenField  hfFlowID       = (HiddenField)e.Item.FindControl("hf_FlowID");
                int          flowid         = Convert.ToInt32(hfFlowID.Value);
                CheckBoxList chk            = (CheckBoxList)e.Item.FindControl("chk_ClassList");
                Literal      ltl_SysUser    = (Literal)e.Item.FindControl("ltl_SysUser");
                Literal      ltl_BeginDate  = (Literal)e.Item.FindControl("ltl_BeginDate");
                Literal      ltl_EndDate    = (Literal)e.Item.FindControl("ltl_EndDate");
                Literal      ltl_RemindDate = (Literal)e.Item.FindControl("ltl_RemindDate");

                //根据班次类型获取所有班次信息
                List <BaseClass>     classlist         = db.BaseClass.Where(t => t.ClassType == (ClassTypeEnums)clatype && t.IsDel != true).ToList();
                List <BaseClassUser> bassclassuserlist = db.BaseClassUser.ToList();
                List <object>        list = new List <object>();
                if (classlist.Count > 0)
                {
                    List <User> UserList = db.User.Where(t => t.IsDel != true).ToList();
                    foreach (BaseClass bclass in classlist)
                    {//根据班次ID和流程ID获取班次人员信息,绑定CheckBoxlist
                        string name = "";
                        List <BaseClassUser> classuserlist = bassclassuserlist.Where(t => t.BaseClassID == bclass.ID && t.FlowID == flowid).ToList();
                        if (classuserlist.Count > 0)
                        {
                            foreach (BaseClassUser classuser in classuserlist)
                            {
                                name += UserList.FirstOrDefault(t => t.ID == classuser.UserID) == null ? "" : (UserList.FirstOrDefault(t => t.ID == classuser.UserID).RealName + ",");
                            }
                        }
                        name = name.TrimEnd(',').TrimStart(',');
                        list.Add(new
                        {
                            Name = bclass.Name + "(" + name + ")",
                            bclass.ID
                        });
                    }
                }
                if (list.Count > 0)
                {
                    chk.DataTextField  = "Name";
                    chk.DataValueField = "ID";
                    chk.DataSource     = list;
                    chk.DataBind();
                }

                List <TaskFlow> taskflowlist = db.TaskFlow.Where(t => t.TaskID == TaskID && t.FlowID == flowid).ToList();
                if (taskflowlist.Count > 0)
                {
                    //获取taskflow表的班次信息
                    var testlist = taskflowlist.Where(t => t.BaseClassID != null).Select(t => t.BaseClassID).Distinct().ToList();
                    for (int i = 0; i < testlist.Count; i++)
                    {
                        int classid = Convert.ToInt32(testlist[i].ToString());
                        for (int j = 0; j < chk.Items.Count; j++)
                        {
                            if (chk.Items[j].Value == classid.ToString())
                            {
                                chk.Items[j].Selected = true;
                            }
                        }
                        TaskFlow taskflow = taskflowlist.FirstOrDefault(t => t.BaseClassID == classid);
                        if (taskflow != null)
                        {
                            ltl_BeginDate.Text  = taskflow.BeginDate.ToString("yyyy-MM-dd HH:mm:ss");
                            ltl_EndDate.Text    = taskflow.EndDate.ToString("yyyy-MM-dd HH:mm:ss");
                            ltl_RemindDate.Text = taskflow.RemindDate.ToString("yyyy-MM-dd HH:mm:ss");
                        }
                    }
                    string          name     = "";
                    List <TaskFlow> flowlist = taskflowlist.Where(t => t.BaseClassID == null).ToList();
                    foreach (TaskFlow taskflow in flowlist)
                    {
                        name += db.User.FirstOrDefault(t => t.ID == taskflow.UserID && t.IsDel != true) == null ? "" : (db.User.FirstOrDefault(t => t.ID == taskflow.UserID && t.IsDel != true).RealName + ",");
                    }
                    ltl_SysUser.Text = name.TrimEnd(',').TrimStart(',');
                }

                Repeater      rp_TableList = (Repeater)e.Item.FindControl("rp_TableList");
                List <object> lists        = new List <object>();
                if (taskflowlist != null)
                {
                    foreach (TaskFlow tflist in taskflowlist)
                    {
                        IFMPLibrary.Entities.Table table = db.Table.FirstOrDefault(t => t.TaskID == TaskID && t.TableTypeID == tabtype && t.CreateUserID == tflist.UserID);
                        if (table != null)
                        {
                            lists.Add(new
                            {
                                table.ID,
                                CreateUser = table.CreateUserID,
                                UserName   = db.User.FirstOrDefault(t => t.ID == table.CreateUserID).RealName,
                                table.CreateDate
                            });
                        }
                        else
                        {
                            lists.Add(new
                            {
                                ID         = -2,
                                CreateUser = tflist.UserID,
                                UserName   = db.User.FirstOrDefault(t => t.ID == tflist.UserID).RealName,
                                CreateDate = ""
                            });
                        }
                    }
                }
                if (lists.Count() > 0)
                {
                    rp_TableList.DataSource = lists.ToList();
                    rp_TableList.DataBind();
                }
            }
        }
Esempio n. 39
0
        /// <summary>
        /// Handles the ItemDataBound event of the ShipmentList 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 ShipmentList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Shipment sh = e.Item.DataItem as Shipment;

                //decimal subtotal = 0;
                //decimal discount = 0;
                Label lblSubtotal = e.Item.FindControl("SubTotal") as Label;
                if (lblSubtotal != null)
                {
                    if (sh != null)
                    {
                        lblSubtotal.Text = GetShipmentSubtotal(sh);
                    }
                }

                Label shippingcost = e.Item.FindControl("ShippingCost") as Label;
                if (shippingcost != null)
                {
                    shippingcost.Text = CurrencyFormatter.FormatCurrency(sh.ShipmentTotal, Order.BillingCurrency); //(spi.ShippingCost.Amount + spi.Charge.Amount, spi.ShippingCost.CurrencyCode);
                }

                HyperLink trackingurl = e.Item.FindControl("TrackingUrl") as HyperLink;
                if (trackingurl != null && !String.IsNullOrEmpty(sh.ShipmentTrackingNumber))
                {
                    trackingurl.NavigateUrl = String.Format("http://www.google.com/search?q={0}", sh.ShipmentTrackingNumber);
                    trackingurl.Text        = RM.GetString("ACCOUNT_ORDER_SHIPMENT_TRACK");
                    trackingurl.Visible     = true;
                }

                Label taxes = e.Item.FindControl("Taxes") as Label;
                if (taxes != null)
                {
                    taxes.Text = CurrencyFormatter.FormatCurrency(0m, Order.BillingCurrency);
                }

                Label total = e.Item.FindControl("TotalCost") as Label;
                if (total != null)
                {
                    total.Text = GetShipmentTotal(sh);                     //Tax.Amount + spi.ShippingCost.Amount + spi.Charge.Amount + subtotal - spi.Discount.Amount, spi.ShippingCost.CurrencyCode);
                }

                // Print discount price

                /*Label discountLabel = e.Item.FindControl("ShipmentDiscount") as Label;
                 * if (discountLabel != null)
                 * {
                 *                      discountLabel.Text = "-" + CurrencyFormatter.FormatCurrency(sh.ShippingDiscountAmount, Order.BillingCurrency); //discount, spi.ShippingCost.CurrencyCode);
                 *  TableRow discountRow = e.Item.FindControl("ShipmentDiscount") as TableRow;
                 *  if (discountRow != null)
                 *  {
                 *      if (discount == 0)
                 *          discountRow.Visible = false;
                 *      else
                 *          discountRow.Visible = true;
                 *  }
                 * }*/

                // Print whole order shipment discount price
                Label discountShipmentLabel = e.Item.FindControl("lblTotalShipmentDiscount") as Label;
                if (discountShipmentLabel != null)
                {
                    discountShipmentLabel.Text = "-" + CurrencyFormatter.FormatCurrency(sh.ShippingDiscountAmount, Order.BillingCurrency);                     //ClientHelper.FormatCurrency(spi.Discount.Amount, spi.Discount.CurrencyCode);
                    TableRow discountRow = e.Item.FindControl("trTotalShipmentDiscount") as TableRow;
                    if (discountRow != null)
                    {
                        if (sh.ShippingDiscountAmount > 0)
                        {
                            discountRow.Visible = true;
                        }
                        else
                        {
                            discountRow.Visible = false;
                        }
                    }
                }

                GridView gv = (GridView)e.Item.FindControl("gvOrders");
                if (gv != null && gv.Columns.Count > 1)
                {
                    gv.Columns[0].HeaderText = RM.GetString("ACCOUNT_ORDER_SHIPMENT_ITEMS_ORDERED");
                    gv.Columns[1].HeaderText = RM.GetString("ACCOUNT_ORDER_SHIPMENT_PRICE");
                    gv.DataBind();
                }
            }
        }
        private static void SavedCandidateSearchesRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                var search         = (MemberSearch)e.Item.DataItem;
                var litDescription = (Literal)e.Item.FindControl("litDescription");
                var phCreateAlert  = (PlaceHolder)e.Item.FindControl("phCreateAlert");
                var lblAlertExists = (Label)e.Item.FindControl("lblAlertExists");

                if (litDescription != null)
                {
                    litDescription.Text = search.GetDisplayHtml();
                }

                var alert = _memberSearchAlertsQuery.GetMemberSearchAlert(search.Id, AlertType.Email);

                if (alert == null)
                {
                    if (phCreateAlert != null)
                    {
                        phCreateAlert.Visible = true;
                    }
                    if (lblAlertExists != null)
                    {
                        lblAlertExists.Visible = false;
                    }
                }
                else
                {
                    if (phCreateAlert != null)
                    {
                        phCreateAlert.Visible = false;
                    }
                    if (lblAlertExists != null)
                    {
                        lblAlertExists.Visible = true;
                    }
                }
            }
        }
Esempio n. 41
0
        protected void rp_TableList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                HiddenField hfFlowID = (HiddenField)e.Item.FindControl("hf_FID");
                int         flowid   = Convert.ToInt32(hfFlowID.Value);

                HiddenField hf_TableID    = (HiddenField)e.Item.FindControl("hf_TableID");
                HiddenField hf_CreateUser = (HiddenField)e.Item.FindControl("hf_CreateUser");
                Repeater    rp_ColList    = (Repeater)e.Item.FindControl("rp_ColList");
                Repeater    rp_AuditList  = (Repeater)e.Item.FindControl("rp_AuditList");
                System.Web.UI.HtmlControls.HtmlTableRow trnull     = (System.Web.UI.HtmlControls.HtmlTableRow)e.Item.FindControl("trnull");
                System.Web.UI.HtmlControls.HtmlTableRow tr_result  = (System.Web.UI.HtmlControls.HtmlTableRow)e.Item.FindControl("tr_result");
                System.Web.UI.HtmlControls.HtmlTableRow tr_message = (System.Web.UI.HtmlControls.HtmlTableRow)e.Item.FindControl("tr_message");
                int tableid    = Convert.ToInt32(hf_TableID.Value);
                int createuser = Convert.ToInt32(hf_CreateUser.Value);

                Flow flowmodel = db.Flow.FirstOrDefault(t => t.ID == flowid);
                if (flowmodel.IsAudit == true)//审核流程
                {
                    rp_ColList.Visible = false;
                    TaskFlow taskflowmodel = db.TaskFlow.FirstOrDefault(t => t.TaskID == TaskID && t.FlowID == flowid && t.UserID == createuser && t.ApplyType != ApplyTypeEnums.未交);

                    Literal ltl_AuditResult  = (Literal)e.Item.FindControl("ltl_AuditResult");
                    Literal ltl_AuditMessage = (Literal)e.Item.FindControl("ltl_AuditMessage");

                    if (taskflowmodel != null)
                    {
                        tr_result.Visible     = true;
                        tr_message.Visible    = true;
                        ltl_AuditResult.Text  = taskflowmodel.AuditResult.ToString();
                        ltl_AuditMessage.Text = taskflowmodel.AuditMessage;
                        trnull.Visible        = false;
                    }
                    else
                    {
                        tr_result.Visible  = false;
                        tr_message.Visible = false;
                        trnull.Visible     = true;
                    }
                }
                else//填写流程
                {
                    var list = from tabledata in db.TableData
                               join tablecolumn in db.TableColumn on tabledata.TableColumnID equals tablecolumn.ID
                               //join dictionary in db.Dictionary on tablecolumn.DictionaryID equals dictionary.ID
                               where tabledata.TableID == tableid && tabledata.CreateUserID == createuser
                               orderby tablecolumn.Order
                               select new
                    {
                        Data = db.Dictionary.FirstOrDefault(t => t.ID == tablecolumn.DictionaryID) == null ? tabledata.Data : db.Dictionary.FirstOrDefault(t => t.ID == tablecolumn.DictionaryID).DisplayType == DictionaryTypeEnums.单选 ? db.DictionaryData.FirstOrDefault(t => t.ID.ToString() == tabledata.Data).Data : tabledata.Data,
                        tablecolumn.ColumnName,
                    };
                    if (list.Count() > 0)
                    {
                        trnull.Visible = false;
                    }
                    else
                    {
                        trnull.Visible = true;
                    }
                    rp_ColList.DataSource = list.ToList();
                    rp_ColList.DataBind();
                }
            }
        }
Esempio n. 42
0
        protected void PopulateKindneyImageFindings(Object Sender, RepeaterItemEventArgs e)
        {
            if (patientID != 0)
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    Literal           DxTarget    = (Literal)e.Item.FindControl("DxTarget");
                    Literal           MaxDim      = (Literal)e.Item.FindControl("MaxDim");
                    Label             NumTumors   = (Label)e.Item.FindControl("NumTumors");
                    HtmlInputCheckBox MultTumors  = (HtmlInputCheckBox)e.Item.FindControl("MultTumors");
                    Label             MaxDimMsg   = (Label)e.Item.FindControl("MaxDimMsg");
                    Literal           ImgFindSide = (Literal)e.Item.FindControl("ImgFindSide");
                    Literal           TumorType   = (Literal)e.Item.FindControl("TumorType");
                    Literal           NoTumorType = (Literal)e.Item.FindControl("NoTumorType");



                    int rowNumber = e.Item.ItemIndex + 1;



                    if (((DataRowView)e.Item.DataItem)[BOL.Diagnostic.DiagnosticId] != null || ((DataRowView)e.Item.DataItem)[BOL.Diagnostic.DiagnosticId].ToString().Length > 0)
                    {
                        int DiagnosticId = int.MinValue;

                        if (int.TryParse(((DataRowView)e.Item.DataItem)[BOL.Diagnostic.DiagnosticId].ToString(), out DiagnosticId))
                        {
                            DiagnosticDa DXda = new DiagnosticDa();
                            DataTable    DXdt = DXda.GetDxImageFindingsKidneyByDiagnosticId(DiagnosticId);

                            if (DXdt.Rows.Count > 0)
                            {
                                decimal maxDimVal           = decimal.MinValue;
                                int     maxDimFindingsRowId = int.MinValue;
                                //                            if (DXdt.Rows.Count > 1) { MultTumors.Checked = true; NumTumors.Text = DXdt.Rows.Count.ToString(); }


                                foreach (DataRow DXdr in DXdt.Rows)
                                {
                                    decimal ImgFindHeight = decimal.MinValue;
                                    decimal ImgFindWidth  = decimal.MinValue;
                                    decimal ImgFindLength = decimal.MinValue;

                                    bool ImgFindHeightExists = decimal.TryParse(DXdt.Rows[0][BOL.ImageFindingKidney.ImgFindHeight].ToString(), out ImgFindHeight);
                                    bool ImgFindWidthExists  = decimal.TryParse(DXdt.Rows[0][BOL.ImageFindingKidney.ImgFindWidth].ToString(), out ImgFindWidth);
                                    bool ImgFindLengthExists = decimal.TryParse(DXdt.Rows[0][BOL.ImageFindingKidney.ImgFindLength].ToString(), out ImgFindLength);

                                    decimal MaxDimValForThisFindingRecord = Math.Max(Math.Max(ImgFindHeight, ImgFindWidth), ImgFindLength);

                                    if (MaxDimValForThisFindingRecord > maxDimVal)
                                    {
                                        maxDimVal = MaxDimValForThisFindingRecord;
                                        int FindingsRowId = int.MinValue;

                                        string MaxDimDisplayText = MaxDimValForThisFindingRecord.ToString();

                                        if (DXdt.Rows[0][BOL.ImageFindingKidney.ImgFindSide].ToString().Length > 0)
                                        {
                                            ImgFindSide.Text = DXdt.Rows[0][BOL.ImageFindingKidney.ImgFindSide].ToString();
                                            //                                           MaxDimDisplayText += " (" + DXdt.Rows[0][BOL.ImageFindingKidney.ImgFindSide].ToString() + ")";
                                        }

                                        MaxDim.Text = MaxDimDisplayText;


                                        if (!ImgFindHeightExists || !ImgFindWidthExists || !ImgFindLengthExists)
                                        {
                                            MaxDimMsg.Visible = true;
                                        }
                                        else
                                        {
                                            MaxDimMsg.Visible = false;
                                        }


                                        if (int.TryParse(DXdt.Rows[0][BOL.ImageFindingKidney.DxImageFindingKidneyId].ToString(), out FindingsRowId))
                                        {
                                            maxDimFindingsRowId = FindingsRowId;
                                        }

                                        try
                                        {
                                            if (DXdt.Rows[0][BOL.ImageFindingKidney.ImgFindTumorType] != null && DXdt.Rows[0][BOL.ImageFindingKidney.ImgFindTumorType].ToString().Length > 0)
                                            {
                                                TumorType.Text      = DXdt.Rows[0][BOL.ImageFindingKidney.ImgFindTumorType].ToString();
                                                NoTumorType.Visible = false;
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            ExceptionHandler.Publish(ex);
                                        }
                                    }
                                }
                            }
                        }
                    }



                    if (((DataRowView)e.Item.DataItem)[BOL.Diagnostic.DxTotalNumTumors] != null || ((DataRowView)e.Item.DataItem)[BOL.Diagnostic.DxTotalNumTumors].ToString().Length > 0)
                    {
                        int DxTotalNumTumors = int.MinValue;

                        if (int.TryParse(((DataRowView)e.Item.DataItem)[BOL.Diagnostic.DxTotalNumTumors].ToString(), out DxTotalNumTumors))
                        {
                            if (DxTotalNumTumors > 1)
                            {
                                MultTumors.Checked = true; NumTumors.Text = DxTotalNumTumors.ToString();
                            }
                        }
                    }
                }
            }
        }
    protected void ObjectsGrid_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        LinkButton l = (LinkButton)e.Item.FindControl("Delete_btn");

        l.Attributes.Add("onclick", "javascript:return confirm('Əminsiniz?')");
    }
Esempio n. 44
0
        void rptrActivities_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var activity = e.Item.DataItem as WorkflowActivity;

            if (activity != null)
            {
                var lblComplete = e.Item.FindControl("lblComplete") as Label;
                if (lblComplete != null)
                {
                    lblComplete.Visible = activity.CompletedDateTime.HasValue;
                }

                var lblActive = e.Item.FindControl("lblActive") as Label;
                if (lblActive != null)
                {
                    lblActive.Visible = !activity.CompletedDateTime.HasValue;
                }

                var tdAssignedToPerson = e.Item.FindControl("tdAssignedToPerson") as TermDescription;
                if (tdAssignedToPerson != null && activity.AssignedPersonAliasId.HasValue)
                {
                    var person = _personAliasService.Queryable()
                                 .Where(a => a.Id == activity.AssignedPersonAliasId.Value)
                                 .Select(a => a.Person)
                                 .FirstOrDefault();
                    if (person != null)
                    {
                        tdAssignedToPerson.Description = string.Format("<a href='{0}{1}'>{2}</a>",
                                                                       ResolveRockUrl("~/Person/"), person.Id, person.FullName);
                    }
                }

                var tdAssignedToGroup = e.Item.FindControl("tdAssignedToGroup") as TermDescription;
                if (tdAssignedToGroup != null && activity.AssignedGroupId.HasValue)
                {
                    var group = _groupService.Get(activity.AssignedGroupId.Value);
                    if (group != null)
                    {
                        tdAssignedToGroup.Description = group.Name;
                    }
                }

                var tdActivated = e.Item.FindControl("tdActivated") as TermDescription;
                if (tdActivated != null && activity.ActivatedDateTime.HasValue)
                {
                    tdActivated.Description = string.Format("{0} {1} ({2})",
                                                            activity.ActivatedDateTime.Value.ToShortDateString(),
                                                            activity.ActivatedDateTime.Value.ToShortTimeString(),
                                                            activity.ActivatedDateTime.Value.ToRelativeDateString());
                }

                var tdCompleted = e.Item.FindControl("tdCompleted") as TermDescription;
                if (tdCompleted != null && activity.CompletedDateTime.HasValue)
                {
                    tdCompleted.Description = string.Format("{0} {1} ({2})",
                                                            activity.CompletedDateTime.Value.ToShortDateString(),
                                                            activity.CompletedDateTime.Value.ToShortTimeString(),
                                                            activity.CompletedDateTime.Value.ToRelativeDateString());
                }

                var phActivityAttributes = e.Item.FindControl("phActivityAttributes") as PlaceHolder;
                if (phActivityAttributes != null)
                {
                    foreach (var attribute in activity.Attributes.OrderBy(a => a.Value.Order).Select(a => a.Value))
                    {
                        var td = new TermDescription();
                        phActivityAttributes.Controls.Add(td);
                        td.Term = attribute.Name;

                        string value = activity.GetAttributeValue(attribute.Key);

                        var    field          = attribute.FieldType.Field;
                        string formattedValue = field.FormatValueAsHtml(phActivityAttributes, attribute.EntityTypeId, activity.Id, value, attribute.QualifierValues);

                        if (field is Rock.Field.ILinkableFieldType)
                        {
                            var linkableField = field as Rock.Field.ILinkableFieldType;
                            td.Description = string.Format("<a href='{0}{1}'>{2}</a>",
                                                           ResolveRockUrl("~"), linkableField.UrlLink(value, attribute.QualifierValues), formattedValue);
                        }
                        else
                        {
                            td.Description = formattedValue;
                        }
                        phActivityAttributes.Controls.Add(td);
                    }
                }

                var gridActions = e.Item.FindControl("gridActions") as Grid;
                if (gridActions != null)
                {
                    gridActions.DataSource = activity.Actions.OrderBy(a => a.ActionTypeCache.Order)
                                             .Select(a => new
                    {
                        Name          = a.ActionTypeCache.Name,
                        LastProcessed = a.LastProcessedDateTime.HasValue ?
                                        string.Format("{0} {1} ({2})",
                                                      a.LastProcessedDateTime.Value.ToShortDateString(),
                                                      a.LastProcessedDateTime.Value.ToShortTimeString(),
                                                      a.LastProcessedDateTime.Value.ToRelativeDateString()) :
                                        "",
                        Completed     = a.CompletedDateTime.HasValue,
                        CompletedWhen = a.CompletedDateTime.HasValue ?
                                        string.Format("{0} {1} ({2})",
                                                      a.CompletedDateTime.Value.ToShortDateString(),
                                                      a.CompletedDateTime.Value.ToShortTimeString(),
                                                      a.CompletedDateTime.Value.ToRelativeDateString()) :
                                        ""
                    })
                                             .ToList();
                    gridActions.DataBind();
                }
            }
        }
Esempio n. 45
0
 protected void Pro_RPT_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         //如果变复杂,将其分离为局部页
         if (e.Item.ItemIndex == 0)//首行判断
         {
             DataRowView dr = e.Item.DataItem as DataRowView;
             M_Payment payMod = OrderHelper.GetPaymentByOrderNo(dr.Row);
             int count = OrderDT.Select("id=" + dr["ID"]).Length;
             string html = "";
             //收货人
             html += "<td class='td_l rowtd' rowspan='" + count + "'>";
             html += "<i class='fa fa-user'></i> <a href='OrderList.aspx?UserID=" + dr["UserID"] + "' title='按用户筛选'>" + B_User.GetUserName(dr["HoneyName"], dr["AddUser"]) + "</a>";
             html += "(<a href='javascript:;' onclick='user.showuinfo(" + dr["UserID"] + ");' title='查看用户信息'><span style='color:green;'>" + dr["UserID"] + "</span></a>)";
             html += "</td>";
             //金额栏
             html += "<td class='td_l rowtd' rowspan='" + count + "' style='font-size:12px;'>总计:<i class='fa fa-rmb'></i> " + Convert.ToDouble(dr["OrdersAmount"]).ToString("f2") + "<br />";
             string _paytypeHtml = OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.PayType);
             if (!string.IsNullOrEmpty(_paytypeHtml)) { _paytypeHtml = _paytypeHtml + "<br />"; }
             html += _paytypeHtml;
             html += "<div>商品:" + (DataConvert.CDouble(dr["OrdersAmount"]) - DataConvert.CDouble(dr["Freight"])).ToString("F2") + "</div>";
             html += "<div>运费:" + DataConvert.CDouble(dr["Freight"]).ToString("F2") + "</div>";
             html += "<div title='优惠券'>优惠:" + payMod.ArriveMoney.ToString("F2") + "</div>";
             html += "<div>积分:" + payMod.UsePointArrive.ToString("f2") + "(" + payMod.UsePoint.ToString("F0") + ")</div>";
             switch (payMod.PayType)
             {
                 case (int)M_OrderList.PayTypeEnum.PrePay:
                     try
                     {
                         M_PrePayinfo preInfo = new M_PrePayinfo(payMod.PrePayInfo);
                         string payedTlp = "<div>(<span style='color:green;'>已付款</span>:{0},{1})</div>";
                         string nopayTlp = "<div>(<span style='color:red;'>未付款</span>)</div>";
                         html += "<div style='color:#d9534f;'>定金:" + preInfo.money_pre.ToString("F2") + "</div>";
                         html += preInfo.money_pre_payed > 0 ? string.Format(payedTlp, preInfo.money_pre_payed.ToString("F2"), preInfo.pre_payMethod) : nopayTlp;
                         html += "<div style='color:#d9534f'>尾款:" + preInfo.money_after.ToString("F2") + "</div>";
                         html += preInfo.money_after_payed > 0 ? string.Format(payedTlp, preInfo.money_after_payed.ToString("F2"), preInfo.after_payMethod) : nopayTlp;
                         html += "<div style='color:#d9534f'>总计:" + preInfo.money_total.ToString("F2") + "</div>";
                     }
                     catch
                     {
                         html += "预付信息错误";
                     }
                     break;
                 default:
                     html += "<div style='color:#d9534f;'>需付:" + payMod.MoneyReal.ToString("F2") + "</div>";
                     break;
             }
             if (!string.IsNullOrEmpty(DataConvert.CStr(dr["PaymentNo"])))
             {
                 string plat = platBll.GetPayPlatName(DataConvert.CStr(dr["PaymentNo"]));
                 html += "<a href='" + StrHelper.Url_AddParam(Request.RawUrl, "filter=paid") + "' title='筛选已付款订单'>" + "<span style='color:#337ab7;'>" + plat + "</span>"
                     + "(" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Pay) + ")</a>";
             }
             else
             {
                 html += "(" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Pay) + ")";
             }
             html += "</td>";
             //订单状态
             html += "<td class='td_md rowtd' rowspan='" + count + "'>";
             html += "<span class='gray9'>" + (DataConvert.CLng(dr["IsSure"]) == 1 ? "已确认" : "未确认") + "</span><br />";
             html += "<span class='gray9'>" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Order) + "</span> <br />";
             int ordertype = DataConvert.CLng(dr["OrderType"]);
             //非旅游与酒店订单,则显示快递信息
             int expid = DataConvert.CLng(dr["ExpressNum"]);
             if (ordertype != 7 && ordertype != 9)
             {
                 html += "<a href='javascript:;' class='expview_a' data-expid='" + expid + "' id='expview_" + dr["ID"] + "_a' onclick=\"exp.apilink(this,'" + expid + "');\">" + OrderHelper.GetExpStatus(Convert.ToInt32(dr["StateLogistics"])) + "</span> <br/>";
             }
             html += "</td>";
             //操作栏
             html += "<td class='td_md rowtd' rowspan='" + count + "'><a href='OrderListInfo.aspx?ID=" + dr["ID"] + "' class='order_bspan'>订单详情</a><br/>" + Getoperator(dr) + "</td>";
             (e.Item.FindControl("Order_Lit") as Literal).Text = html;
         }
     }
 }
Esempio n. 46
0
        protected void rptRoomsDay_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var room = e.Item.DataItem as Room;

            if (room != null)
            {
                var hplBooking      = e.Item.FindControl("hplBooking") as HyperLink;
                var chkSelectRoom   = e.Item.FindControl("chkSelectRoom") as HtmlInputCheckBox;
                var lableSelectRoom = e.Item.FindControl("lableSelectRoom") as HtmlControl;
                if (lableSelectRoom != null)
                {
                    if (chkSelectRoom != null)
                    {
                        lableSelectRoom.Attributes.Add("for", chkSelectRoom.ClientID);
                    }
                }
                var litCustomer   = e.Item.FindControl("litCustomer") as Literal;
                var litCheckInfo  = e.Item.FindControl("litCheckInfo") as Literal;
                var lblR          = e.Item.FindControl("lblR") as Literal;
                var lblL          = e.Item.FindControl("lblL") as Literal;
                var litAction     = e.Item.FindControl("litAction") as Literal;
                var litRoomName   = e.Item.FindControl("litRoomName") as Literal;
                var hidCurrentDay = e.Item.FindControl("hidCurrentDay") as HiddenField;
                if (litRoomName != null)
                {
                    litRoomName.Text = room.Name;
                }
                if (hplBooking != null)
                {
                    var booking = FindBooking(room, hidCurrentDay != null && hidCurrentDay.Value == "1" ? _currentDate : _nextDate);
                    if (booking != null)
                    {
                        hplBooking.Text        = string.Format("{0:OS00000}", booking.Id);
                        hplBooking.NavigateUrl = "#";
                        if (booking.Status == StatusType.Approved)
                        {
                            hplBooking.CssClass = "Approved";
                        }
                        if (booking.Status == StatusType.CutOff || booking.Status == StatusType.Pending)
                        {
                            hplBooking.CssClass = "Pending";
                        }
                        if (_room != null && _room.Id == room.Id && booking.Id == _booking.Id)
                        {
                            hplBooking.CssClass = "booking-room";
                        }

                        if (chkSelectRoom != null)
                        {
                            chkSelectRoom.Visible = false;
                        }
                        if (lableSelectRoom != null)
                        {
                            lableSelectRoom.Visible = false;
                        }
                        var listRoom = booking.BookingRooms.Where(c => c.Room != null && c.Room.Id == room.Id).ToList();

                        if (litCustomer != null)
                        {
                            var cus     = "";
                            var listCus = new List <Customer>();
                            foreach (BookingRoom bookingRoom in listRoom)
                            {
                                listCus.AddRange(bookingRoom.Customers);
                            }
                            var checkInfo = true;
                            if (listCus.Count > 0)
                            {
                                for (int i = 0; i < listCus.Count(); i++)
                                {
                                    if (!string.IsNullOrWhiteSpace(listCus[i].Fullname))
                                    {
                                        if (i < listCus.Count - 1)
                                        {
                                            cus += listCus[i].Fullname + "</br>";
                                        }
                                        else
                                        {
                                            cus += listCus[i].Fullname;
                                        }
                                    }
                                    if (string.IsNullOrWhiteSpace(listCus[i].Fullname))
                                    {
                                        checkInfo = false;
                                    }
                                    if (listCus[i].IsMale == null)
                                    {
                                        checkInfo = false;
                                    }
                                    if (listCus[i].Birthday == null)
                                    {
                                        checkInfo = false;
                                    }
                                    if (listCus[i].Nationality == null)
                                    {
                                        checkInfo = false;
                                    }
                                    if (string.IsNullOrWhiteSpace(listCus[i].VisaNo))
                                    {
                                        checkInfo = false;
                                    }
                                    if (string.IsNullOrWhiteSpace(listCus[i].Passport))
                                    {
                                        checkInfo = false;
                                    }
                                    if (string.IsNullOrWhiteSpace(listCus[i].NguyenQuan))
                                    {
                                        checkInfo = false;
                                    }
                                    if (listCus[i].VisaExpired == null)
                                    {
                                        checkInfo = false;
                                    }
                                }
                            }
                            litCustomer.Text = cus;
                            if (!checkInfo && litCheckInfo != null)
                            {
                                litCheckInfo.Text = "<div class='checkCusInfo'></div>";
                            }
                            if (lblR != null)
                            {
                                lblR.Text = string.Format("<div class=\"card-link-pax\">{0}</div>", listCus.Count);
                            }
                        }
                        if (lblL != null)
                        {
                            lblL.Text = string.Format("<div class=\"card-link-left\">{0}</div>", booking.Agency.Name);
                        }
                        if (litRoomName != null)
                        {
                            string color = "#0b3bf5";
                            if (booking.Trip.NumberOfDay > 2)
                            {
                                color = "yellow";
                            }
                            litRoomName.Text = string.Format("<a href='javascript:;' style='color:{1}'>{0}</a>", room.Name, color);
                        }
                        if (litAction != null)
                        {
                            var rtype = listRoom[0].RoomType.Name.ToLower();
                            if (rtype == "double" && room.RoomType.Name.ToLower() == "twin")
                            {
                                rtype = "double_c";
                            }
                            litAction.Text = string.Format("<div class=\"card-link-action\"><img src='/Modules/Sails/Themes/images/{0}.png' /></div>", rtype);
                        }
                    }
                    else
                    {
                        hplBooking.CssClass = "";
                        if (chkSelectRoom != null)
                        {
                            //if (_currentDate <= DateTime.Now.AddDays(-1))
                            //{
                            //    chkSelectRoom.Visible = false;
                            //    if (lableSelectRoom != null) lableSelectRoom.Visible = false;
                            //    if (litAction != null) litAction.Visible = false;
                            //}
                        }
                        if (lblL != null)
                        {
                            lblL.Text = string.Format("<div class=\"card-link-left roomClass\">{0}</div>", room.RoomClass.Name);
                        }
                        if (lblR != null)
                        {
                            lblR.Text = string.Format("<div class=\"card-link-roomType\"><img src='/Modules/Sails/Themes/images/{0}.png'/></div>", room.RoomType.Name.ToLower());
                        }
                    }
                }
            }
        }
 protected void DataList1_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
 }
        protected void HistoricalRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var rowHistory = (HtmlTableRow)e.Item.FindControl("rowHistory");
                rowHistory.Attributes.Add("class", "alternative");
            }

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var booking          = (Bookings)e.Item.DataItem;
                var checkInDateLabel = (Label)e.Item.FindControl("CheckInDateLabel");

                if (booking.PassStatus != (int)Enums.BookingStatus.Redeemed)
                {
                    checkInDateLabel.Text = booking.CheckinDate.HasValue
                        ? booking.CheckinDate.Value.ToLosAngerlesTimeWithTimeZone(_hotels.TimeZoneId).ToString("M/d/yy")
                        : "";
                }
                else
                {
                    checkInDateLabel.Text = booking.RedeemedDate.HasValue
                        ? booking.RedeemedDate.Value.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId).ToString("M/d/yy hh:mm tt")
                        : "";
                }

                if (booking.PassStatus == (int)Enums.BookingStatus.Active)
                {
                    var redeemButton = (Button)e.Item.FindControl("RedeemButton");
                    redeemButton.Visible = true;
                }
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                var totalPass     = (Literal)e.Item.FindControl("TotalPass");
                var spendAvg      = (Literal)e.Item.FindControl("SpendAvg");
                var ratingAvg     = (Literal)e.Item.FindControl("RatingAvg");
                var totalRedeemed = (Literal)e.Item.FindControl("TotalRedeemed");
                if (_bookings.Any())
                {
                    totalPass.Text = _bookings.Count + " PASSES";
                    spendAvg.Text  = string.Format("AVG ${0:N0}", _bookings.Where(x => x.EstSpend.HasValue).Average(x => x.EstSpend));
                    var ratingBooking = _bookings.Where(x => x.UserRating > 0).ToList();
                    if (ratingBooking.Any())
                    {
                        ratingAvg.Text = "AVG " + ratingBooking.Average(x => x.UserRating).ToString("###.#");
                    }

                    totalRedeemed.Text = _bookings.Count(x => x.PassStatus == (int)Enums.PassStatus.Redeemed) + " REDEEMED";
                }
                else
                {
                    totalPass.Text     = "0 PASSES";
                    spendAvg.Text      = "AVG $";
                    ratingAvg.Text     = "AVG ";
                    totalRedeemed.Text = "0 REDEEMED";
                }

                var litPage    = (Literal)e.Item.FindControl("LitPage");
                var totalHotel = _bookings.Count;
                var totalPage  = totalHotel / Constant.ItemPerPage + (totalHotel % Constant.ItemPerPage != 0 ? 1 : 0);
                litPage.Text = string.Format("Page {0} of {1}", Session["CurrentPage"], totalPage);
            }
        }
Esempio n. 49
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      anchor  = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
                HtmlAnchor      anchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReturn");
                HtmlAnchor      anchor3 = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReplace");
                switch (status)
                {
                case 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;
                    }
                    break;

                case OrderStatus.ApplyForRefund:
                    anchor.Visible = true;
                    break;

                case OrderStatus.ApplyForReturns:
                    anchor2.Visible = true;
                    break;

                case OrderStatus.ApplyForReplacement:
                    anchor3.Visible = true;
                    break;
                }
                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;
            }
        }
Esempio n. 50
0
        protected void rptShoppingCart_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label   lblSkuCode        = e.Item.FindControl("lblSkuCode") as Label;
                Label   lblSkuDescription = e.Item.FindControl("lblSkuDescription") as Label;
                TextBox txtQuantity       = e.Item.FindControl("txtQuantity") as TextBox;
                //Label lblQuantity = e.Item.FindControl("lblQuantity") as Label;
                Label                lblSkuInitialPrice = e.Item.FindControl("lblSkuInitialPrice") as Label;
                ImageButton          btnRemoveItem      = e.Item.FindControl("btnRemoveItem") as ImageButton;
                HtmlContainerControl holderQuantity     = e.Item.FindControl("holderQuantity") as HtmlContainerControl;
                HtmlContainerControl holderRemove       = e.Item.FindControl("holderRemove") as HtmlContainerControl;
                Image                imgProduct         = e.Item.FindControl("imgProduct") as Image;

                Sku cartItem = e.Item.DataItem as Sku;

                lblSkuDescription.Text = cartItem.ShortDescription;
                //lblQuantity.Text = txtQuantity.Text = cartItem.Quantity.ToString();
                lblSkuInitialPrice.Text = String.Format("${0:0.##}", cartItem.InitialPrice);
                if (cartItem.ImagePath != null && cartItem.ImagePath.Length > 0)
                {
                    imgProduct.ImageUrl = cartItem.ImagePath;
                    lblSkuCode.Visible  = false;
                }
                else
                {
                    imgProduct.Visible = false;
                    lblSkuCode.Text    = cartItem.SkuCode.ToString();
                }


                btnRemoveItem.CommandArgument = cartItem.SkuId.ToString();

                //txtQuantity.Attributes["onchange"] = Page.ClientScript.GetPostBackEventReference(refresh, "");

                switch (QuantityMode)
                {
                case ShoppingCartQuanityMode.Hidden:
                    holderQuantity.Visible = false;
                    break;

                //case ShoppingCartQuanityMode.Editable:
                //    lblQuantity.Visible = false;
                //    break;
                //case ShoppingCartQuanityMode.Readonly:
                //    txtQuantity.Visible = false;
                //    break;
                default:
                    break;
                }

                if (HideRemoveButton)
                {
                    holderRemove.Visible = false;
                }
            }
            else if (e.Item.ItemType == ListItemType.Header)
            {
                HtmlContainerControl holderHeaderQuantity = e.Item.FindControl("holderHeaderQuantity") as HtmlContainerControl;
                HtmlContainerControl holderHeaderRemove   = e.Item.FindControl("holderHeaderRemove") as HtmlContainerControl;
                if (QuantityMode == ShoppingCartQuanityMode.Hidden)
                {
                    holderHeaderQuantity.Visible = false;
                }

                if (HideRemoveButton)
                {
                    holderHeaderRemove.Visible = false;
                }
            }
        }
Esempio n. 51
0
    protected void CommentList_OnItemCreated(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Header)
        {
            PlaceHolder bulkApprove  = (PlaceHolder)e.Item.FindControl("bulkApprove");
            PlaceHolder bulkDelete   = (PlaceHolder)e.Item.FindControl("bulkDelete");
            PlaceHolder bulkUndelete = (PlaceHolder)e.Item.FindControl("bulkUndelete");

            // hide everything for now
            bulkApprove.Visible  = false;
            bulkDelete.Visible   = false;
            bulkUndelete.Visible = false;

            string page = Request.QueryString["a"] ?? "t";

            if (!String.IsNullOrEmpty(page))
            {
                switch (page)
                {
                case "t":     // published
                    bulkDelete.Visible = true;
                    break;

                case "f":     // pending
                    bulkApprove.Visible = true;
                    bulkDelete.Visible  = true;
                    break;

                case "d":     // bulkDeleted
                    bulkUndelete.Visible = true;
                    break;
                }
            }
            else
            {
                bulkDelete.Visible = true;
            }
        }

        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            if (e.Item.DataItem == null)
            {
                return;
            }

            Literal control = (Literal)e.Item.FindControl("cssclass");

            if (control != null)
            {
                control.Text = IsAltRow(e.Item.ItemIndex);
            }

            HiddenField hf = (HiddenField)e.Item.FindControl("CommentID");

            if (hf != null)
            {
                hf.Value = (((Comment)e.Item.DataItem).Id.ToString());
            }

            PlaceHolder edit     = (PlaceHolder)e.Item.FindControl("edit");
            PlaceHolder approve  = (PlaceHolder)e.Item.FindControl("approve");
            PlaceHolder delete   = (PlaceHolder)e.Item.FindControl("delete");
            PlaceHolder undelete = (PlaceHolder)e.Item.FindControl("undelete");

            // just to set them bold or not...
            //Literal EditBold = (Literal)edit.FindControl("EditBold");
            //Literal ApproveBold = (Literal)approve.FindControl("ApproveBold");

            Label pipe1 = (Label)e.Item.FindControl("pipe1");
            Label pipe2 = (Label)e.Item.FindControl("pipe2");

            // hide everything for now
            edit.Visible     = false;
            approve.Visible  = false;
            delete.Visible   = false;
            undelete.Visible = false;
            pipe1.Visible    = false;
            pipe2.Visible    = false;

            string page = Request.QueryString["a"] ?? "t";

            Comment c = (Comment)e.Item.DataItem;

            if (!String.IsNullOrEmpty(page))
            {
                switch (page)
                {
                case "t":     // published
                    if (RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Edit)
                    {
                        edit.Visible = true;
                    }

                    if (RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Publish)
                    {
                        //EditBold.Visible = true;
                        pipe1.Visible  = true;
                        delete.Visible = true;
                    }
                    break;

                case "f":     // pending
                    if (RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Edit)
                    {
                        edit.Visible = true;
                    }

                    if (RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Publish)
                    {
                        pipe1.Visible   = true;
                        approve.Visible = true;
                        //ApproveBold.Visible = true;
                        pipe2.Visible  = true;
                        delete.Visible = true;
                    }
                    break;

                case "d":     // deleted
                    if (RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Publish)
                    {
                        undelete.Visible = true;
                    }
                    break;
                }
            }
            else
            {
                // published is default tab
                if (RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Edit)
                {
                    edit.Visible = true;
                }

                if (RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Publish)
                {
                    pipe1.Visible  = true;
                    delete.Visible = true;
                }
            }


            if (!RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Publish)
            {
                CheckBox commentCheckbox = (CheckBox)e.Item.FindControl("CommentCheckbox");
                commentCheckbox.Visible = false;
            }
        }
    }
        protected void rptRoom_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Room item = e.Item.DataItem as Room;

            if (item != null)
            {
                #region Name

                using (HyperLink hyperLink_Name = e.Item.FindControl("hyperLink_Name") as HyperLink)
                {
                    if (hyperLink_Name != null)
                    {
                        hyperLink_Name.Text        = item.Name;
                        hyperLink_Name.NavigateUrl = string.Format(
                            "RoomEdit.aspx?NodeId={0}&SectionId={1}&RoomId={2}", Node.Id, Section.Id, item.Id);
                    }
                }

                #endregion

                #region Edit

                using (HyperLink hyperLinkEdit = e.Item.FindControl("hyperLinkEdit") as HyperLink)
                {
                    if (hyperLinkEdit != null)
                    {
                        hyperLinkEdit.NavigateUrl = string.Format("RoomEdit.aspx?NodeId={0}&SectionId={1}&RoomId={2}",
                                                                  Node.Id, Section.Id, item.Id);
                    }
                }

                #endregion

                #region RoomType

                using (Label label_RoomType = e.Item.FindControl("label_RoomType") as Label)
                {
                    if (label_RoomType != null)
                    {
                        label_RoomType.Text = item.RoomType.Name;
                    }
                }

                #endregion

                #region Room Class

                using (Label label_RoomClass = e.Item.FindControl("label_RoomClass") as Label)
                {
                    if (label_RoomClass != null)
                    {
                        label_RoomClass.Text = item.RoomClass.Name;
                    }
                }
                #endregion

                Label labelCruise = e.Item.FindControl("labelCruise") as Label;
                if (labelCruise != null)
                {
                    try
                    {
                        if (item.Cruise != null)
                        {
                            labelCruise.Text = item.Cruise.Name;
                        }
                    }
                    catch
                    {
                        item.Cruise = null;
                    }
                }

                if (_date != DateTime.MinValue)
                {
                    HtmlTableCell tdAvailable = e.Item.FindControl("tdAvailable") as HtmlTableCell;
                    if (tdAvailable != null)
                    {
                        if (item.IsAvailable)
                        {
                            tdAvailable.InnerText = string.Format("{0} người lớn - {1} trẻ em - {2} trẻ sơ sinh", item.Adult, item.Child, item.Baby);
                        }
                        else
                        {
                            tdAvailable.InnerText = string.Format("{0} người lớn - {1} trẻ em - {2} trẻ sơ sinh", item.Adult, item.Child, item.Baby);
                            tdAvailable.Style[HtmlTextWriterStyle.BackgroundColor] = SailsModule.IMPORTANT;
                        }
                    }
                }
            }
        }
Esempio n. 53
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var keywordID  = TranslateUtils.EvalInt(e.Item.DataItem, "KeywordID");
                var keywords   = TranslateUtils.EvalString(e.Item.DataItem, "Keywords");
                var isDisabled = TranslateUtils.ToBool(TranslateUtils.EvalString(e.Item.DataItem, "IsDisabled"));
                var reply      = TranslateUtils.EvalString(e.Item.DataItem, "Reply");
                var matchType  = EMatchTypeUtils.GetEnumType(TranslateUtils.EvalString(e.Item.DataItem, "MatchType"));
                var addDate    = TranslateUtils.EvalDateTime(e.Item.DataItem, "AddDate");

                var phSingle   = e.Item.FindControl("phSingle") as PlaceHolder;
                var phMultiple = e.Item.FindControl("phMultiple") as PlaceHolder;

                var resourceInfoList = DataProviderWX.KeywordResourceDAO.GetResourceInfoList(keywordID);

                phMultiple.Visible = resourceInfoList.Count > 1;
                phSingle.Visible   = !phMultiple.Visible;

                if (phSingle.Visible)
                {
                    var resourceInfo = new KeywordResourceInfo();
                    if (resourceInfoList.Count > 0)
                    {
                        resourceInfo = resourceInfoList[0];
                    }

                    var ltlSingleTitle     = e.Item.FindControl("ltlSingleTitle") as Literal;
                    var ltlSingleKeywords  = e.Item.FindControl("ltlSingleKeywords") as Literal;
                    var ltlSingleAddDate   = e.Item.FindControl("ltlSingleAddDate") as Literal;
                    var ltlSingleImageUrl  = e.Item.FindControl("ltlSingleImageUrl") as Literal;
                    var ltlSingleSummary   = e.Item.FindControl("ltlSingleSummary") as Literal;
                    var ltlSingleEditUrl   = e.Item.FindControl("ltlSingleEditUrl") as Literal;
                    var ltlSingleDeleteUrl = e.Item.FindControl("ltlSingleDeleteUrl") as Literal;

                    ltlSingleTitle.Text    = $@"<a href=""{"javascript:;"}"" target=""_blank"">{resourceInfo.Title}</a>";
                    ltlSingleKeywords.Text =
                        $@"{keywords + (isDisabled ? "(禁用)" : string.Empty)}&nbsp;<a href=""javascript:;"" onclick=""{Modal
                            .KeywordAddNews.GetOpenWindowStringToEdit(PublishmentSystemID, keywordID)}"">修改</a>";
                    ltlSingleAddDate.Text = addDate.ToShortDateString();
                    if (!string.IsNullOrEmpty(resourceInfo.ImageUrl))
                    {
                        ltlSingleImageUrl.Text =
                            $@"<img src=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo, resourceInfo.ImageUrl)}"" class=""appmsg_thumb"">";
                    }
                    ltlSingleSummary.Text = MPUtils.GetSummary(resourceInfo.Summary, resourceInfo.Content);
                    ltlSingleEditUrl.Text =
                        $@"<a class=""js_edit"" href=""{BackgroundKeywordNewsAdd.GetRedirectUrl(PublishmentSystemID,
                            keywordID, resourceInfo.ResourceID, phSingle.Visible)}""><i class=""icon18_common edit_gray"">编辑</i></a>";
                    ltlSingleDeleteUrl.Text =
                        $@"<a class=""js_del no_extra"" href=""{GetRedirectUrl(
                            PublishmentSystemID)}&delete=true&keywordID={keywordID}"" onclick=""javascript:return confirm('此操作将删除图文回复“{keywords}”,确认吗?');""><i class=""icon18_common del_gray"">删除</i></a>";
                }
                else
                {
                    var resourceInfo = resourceInfoList[0];
                    resourceInfoList.Remove(resourceInfo);

                    var ltlMultipleKeywords  = e.Item.FindControl("ltlMultipleKeywords") as Literal;
                    var ltlMultipleAddDate   = e.Item.FindControl("ltlMultipleAddDate") as Literal;
                    var ltlMultipleTitle     = e.Item.FindControl("ltlMultipleTitle") as Literal;
                    var ltlMultipleImageUrl  = e.Item.FindControl("ltlMultipleImageUrl") as Literal;
                    var rptMultipleContents  = e.Item.FindControl("rptMultipleContents") as Repeater;
                    var ltlMultipleEditUrl   = e.Item.FindControl("ltlMultipleEditUrl") as Literal;
                    var ltlMultipleDeleteUrl = e.Item.FindControl("ltlMultipleDeleteUrl") as Literal;

                    ltlMultipleKeywords.Text =
                        $@"{keywords + (isDisabled ? "(禁用)" : string.Empty)}&nbsp;<a href=""javascript:;"" onclick=""{Modal
                            .KeywordAddNews.GetOpenWindowStringToEdit(PublishmentSystemID, keywordID)}"">修改</a>";

                    ltlMultipleAddDate.Text = addDate.ToShortDateString();
                    ltlMultipleTitle.Text   = $@"<a href=""{"javascript:;"}"" target=""_blank"">{resourceInfo.Title}</a>";
                    if (!string.IsNullOrEmpty(resourceInfo.ImageUrl))
                    {
                        ltlMultipleImageUrl.Text =
                            $@"<img src=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo, resourceInfo.ImageUrl)}"" class=""appmsg_thumb"">";
                    }

                    rptMultipleContents.DataSource     = resourceInfoList;
                    rptMultipleContents.ItemDataBound += rptMultipleContents_ItemDataBound;
                    rptMultipleContents.DataBind();

                    ltlMultipleEditUrl.Text =
                        $@"<a class=""js_edit"" href=""{BackgroundKeywordNewsAdd.GetRedirectUrl(PublishmentSystemID,
                            keywordID, resourceInfo.ResourceID, phSingle.Visible)}""><i class=""icon18_common edit_gray"">编辑</i></a>";
                    ltlMultipleDeleteUrl.Text =
                        $@"<a class=""js_del no_extra"" href=""{GetRedirectUrl(
                            PublishmentSystemID)}&delete=true&keywordID={keywordID}"" onclick=""javascript:return confirm('此操作将删除图文回复“{keywords}”,确认吗?');""><i class=""icon18_common del_gray"">删除</i></a>";
                }
            }
        }
Esempio n. 54
0
        protected void OnForumTopicItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            DataObjectForumTopicItem item = (DataObjectForumTopicItem)e.Item.DataItem;
            Literal postDate = (Literal)e.Item.FindControl("LitPosterInfo");

            postDate.Text = string.Format("{0} {1}", item.Inserted.ToShortDateString(), item.Inserted.ToShortTimeString());

            Control          posterControl = e.Item.FindControl("PhPoster");
            SmallOutputUser2 poster        = (SmallOutputUser2)this.LoadControl("~/UserControls/Templates/SmallOutputUser2.ascx");

            if (item.UserID != Constants.ANONYMOUS_USERID.ToGuid())
            {
                poster.DataObjectUser = DataObject.Load <DataObjectUser>(item.UserID);
                poster.LinkActive     = true;
                posterControl.Controls.Add(poster);
                bool isPosterCommunityMember;
                bool isPosterCommunityOwner = Community.GetIsUserOwner(item.UserID.Value, forumTopic.CommunityID.Value, out isPosterCommunityMember);
                if (isPosterCommunityOwner)
                {
                    posterControl.Controls.Add(new LiteralControl("<div class=\"forumModerator\">" + language.GetString("LabelModerator") + "</div>"));
                }
            }
            else
            {
                poster.UserName       = item.Nickname;
                poster.UserDetailURL  = string.Empty;
                poster.UserPictureURL = _4screen.CSB.Common.SiteConfig.MediaDomainName + Helper.GetObjectType("User").DefaultImageURL;
                poster.PrimaryColor   = Helper.GetDefaultUserPrimaryColor();
                poster.SecondaryColor = Helper.GetDefaultUserSecondaryColor();
                posterControl.Controls.Add(poster);
            }

            Control placeHolderfunctions = (PlaceHolder)e.Item.FindControl("PhFunc");

            if (((forumTopic.TopicItemCreationUsers == CommunityUsersType.Members && isCommunityMember) ||
                 (forumTopic.TopicItemCreationUsers == CommunityUsersType.Authenticated && Request.IsAuthenticated) ||
                 isRoleAllowed) &&
                item.ItemStatus != CommentStatus.Deleted &&
                item.ShowState == ObjectShowState.Published)
            {
                HyperLink replyButton = new HyperLink();
                replyButton.CssClass    = "inputButton";
                replyButton.Text        = languageShared.GetString("CommandComment");
                replyButton.NavigateUrl = string.Format("javascript:radWinOpen('/Pages/Popups/ForumTopicItemComment.aspx?ObjID={0}&ObjIDRef={1}&ObjType={2}', '{3}', 470, 370, true)", forumTopic.ObjectID.Value, item.ObjectID.Value, Helper.GetObjectTypeNumericID("ForumTopic"), languageShared.GetString("CommandComment"));
                placeHolderfunctions.Controls.Add(replyButton);
            }
            if (isCommunityOwner && item.ShowState == ObjectShowState.Draft)
            {
                LinkButton publishButton = new LinkButton();
                publishButton.CssClass        = "inputButton";
                publishButton.Text            = language.GetString("CommandForumReleasing");
                publishButton.CommandArgument = item.ObjectID.ToString();
                publishButton.Click          += new EventHandler(OnPublishItemClick);
                placeHolderfunctions.Controls.Add(publishButton);
            }
            if (isCommunityOwner && item.ItemStatus == CommentStatus.None)
            {
                LinkButton removeButton = new LinkButton();
                removeButton.CssClass        = "inputButton";
                removeButton.Text            = language.GetString("CommandForumRemove");
                removeButton.CommandArgument = item.ObjectID.ToString();
                removeButton.Click          += new EventHandler(OnRemoveItemClick);
                placeHolderfunctions.Controls.Add(removeButton);
            }

            if (item.ShowState == ObjectShowState.Draft)
            {
                ((HtmlTableRow)e.Item.FindControl("Tr1")).Attributes.Add("class", "forumDraft");
                ((HtmlTableRow)e.Item.FindControl("Tr2")).Attributes.Add("class", "forumDraft");
            }

            Control topicItemContent = e.Item.FindControl("PhContent");

            if (item.ReferencedItemId.HasValue)
            {
                DataObjectForumTopicItem referencedItem = DataObject.Load <DataObjectForumTopicItem>(item.ReferencedItemId.Value, ObjectShowState.Published, false);
                if (referencedItem != null && referencedItem.State != ObjectState.Added)
                {
                    topicItemContent.Controls.Add(new LiteralControl(string.Format("<div class=\"forumCitation\"><div class=\"forumInfo\">{0}{1}</div><div>{2}</div></div>",
                                                                                   referencedItem.UserID != Constants.ANONYMOUS_USERID.ToGuid() ? string.Format("<a href='{0}'>{1}</a>", Helper.GetDetailLink("User", referencedItem.Nickname), referencedItem.Nickname) : referencedItem.Nickname,
                                                                                   string.Format(language.GetString("MessageForumTopicHasWrite"), referencedItem.Inserted.ToShortDateString() + " " + referencedItem.Inserted.ToShortTimeString()),
                                                                                   referencedItem.ItemStatus == CommentStatus.Deleted ? language.GetString("MessageForumRemove") : referencedItem.Description)));
                }
            }

            if (item.ItemStatus == CommentStatus.Deleted)
            {
                topicItemContent.Controls.Add(new LiteralControl(language.GetString("MessageForumRemove")));
            }
            else if (item.ShowState == ObjectShowState.Published || isCommunityOwner || item.UserID == udc.UserID)
            {
                topicItemContent.Controls.Add(new LiteralControl(item.Description));
            }
            else
            {
                e.Item.Visible = false;
            }
        }
 protected void dlPlanes_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     //csRefere.dlPlanes_ItemDataBound(sender, e);
 }
Esempio n. 56
0
        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 Expense)
            {
                #region -- Tính toán chi phí & hiển thị --

                Expense 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
        }
Esempio n. 57
0
    public void CartRepeaterItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        bool orderlinePrice    = ValidationHelper.GetBoolean(GetValue("OrderlinePrice"), true);
        bool orderlineVat      = ValidationHelper.GetBoolean(GetValue("OrderlineVAT"), true);
        bool orderlineQuantity = ValidationHelper.GetBoolean(GetValue("OrderlineQuantity"), true);
        bool orderlineItemNo   = ValidationHelper.GetBoolean(GetValue("OrderlineItemNo"), true);
        bool editable          = ValidationHelper.GetBoolean(GetValue("Editable"), true);

        if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
        {
            return;
        }

        Currency currency = TransactionLibrary.GetBasket(true).PurchaseOrder.BillingCurrency;

        OrderLine currentItem = (OrderLine)e.Item.DataItem;
        var       product     = CatalogLibrary.GetProduct(currentItem.Sku);
        var       itemPrice   = new Money(currentItem.Price, currency);
        var       itemTax     = new Money(currentItem.VAT, currency);
        var       lineTotal   = new Money(currentItem.Total.Value, currency);

        var lnkItemLink         = (HyperLink)e.Item.FindControl("lnkItemLink");
        var litPrice            = (Literal)e.Item.FindControl("litPrice");
        var litVat              = (Literal)e.Item.FindControl("litVat");
        var litTotal            = (Literal)e.Item.FindControl("litTotal");
        var txtQuantity         = (TextBox)e.Item.FindControl("txtQuantity");
        var btnUpdateQuantities = (Button)e.Item.FindControl("btnUpdateQuantities");
        var btnRemoveLine       = (Button)e.Item.FindControl("btnRemoveLine");
        var lblQuantity         = (Label)e.Item.FindControl("lblQuantity");
        var litItemNo           = (Literal)e.Item.FindControl("litItemNo");


        string url = CatalogLibrary.GetNiceUrlForProduct(product, product.GetCategories().FirstOrDefault());

        lnkItemLink.Text        = currentItem.ProductName;
        lnkItemLink.NavigateUrl = url;

        if (currentItem.UnitDiscount.HasValue && currentItem.UnitDiscount > 0)
        {
            var nowPrice = new Money((currentItem.Price - currentItem.UnitDiscount.Value), currency);
            litPrice.Text = "<span style=\"text-decoration: line-through\">" + itemPrice + "</span>" + nowPrice;
        }
        else
        {
            litPrice.Text = itemPrice.ToString();
        }
        litVat.Text      = itemTax.ToString();
        litTotal.Text    = lineTotal.ToString();
        txtQuantity.Text = currentItem.Quantity.ToString();
        txtQuantity.Attributes.Add("orderlinenumber", _currentIteration.ToString());
        btnUpdateQuantities.Attributes.Add("orderlinenumber", _currentIteration.ToString());
        btnRemoveLine.Attributes.Add("orderlinenumber", _currentIteration.ToString());
        btnUpdateQuantities.ID = "btnUpdateQuantities" + _currentIteration;
        txtQuantity.ID         = "txtQuantity" + _currentIteration;
        txtQuantity.Attributes.Add("data-orderlineid", currentItem.OrderLineId.ToString());

        litPrice.Visible            = orderlinePrice;
        litVat.Visible              = orderlineVat;
        txtQuantity.Visible         = orderlineQuantity;
        btnUpdateQuantities.Visible = orderlineQuantity;
        litItemNo.Text              = currentItem.Sku;
        litItemNo.Visible           = orderlineItemNo;
        if (!editable)
        {
            btnRemoveLine.Visible       = false;
            btnUpdateQuantities.Visible = false;
            txtQuantity.Attributes.Add("readonly", "true");
            txtQuantity.CssClass += " textbox-to-label";
        }

        _currentIteration++;
    }
Esempio n. 58
0
    protected void ViewControl_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView    drv  = (DataRowView)e.Item.DataItem;
        IDataContainer data = new DataRowContainer(drv);

        string fileNameColumn = FileNameColumn;

        // Get information on file
        string fileName = HTMLHelper.HTMLEncode(data.GetValue(fileNameColumn).ToString());
        string ext      = HTMLHelper.HTMLEncode(data.GetValue(FileExtensionColumn).ToString());

        // Load file type
        Label lblType = e.Item.FindControl("lblTypeValue") as Label;

        if (lblType != null)
        {
            fileName     = fileName.Substring(0, fileName.Length - ext.Length);
            lblType.Text = ResHelper.LocalizeString(ext);
        }

        // Load file name
        Label lblName = e.Item.FindControl("lblFileName") as Label;

        if (lblName != null)
        {
            lblName.Text = fileName;
        }

        // Load file size
        Label lblSize = e.Item.FindControl("lblSizeValue") as Label;

        if (lblSize != null)
        {
            long size = ValidationHelper.GetLong(data.GetValue(FileSizeColumn), 0);
            lblSize.Text = DataHelper.GetSizeString(size);
        }

        string argument     = RaiseOnGetArgumentSet(drv.Row);
        string selectAction = GetSelectScript(drv, argument);

        // Initialize SELECT button
        ImageButton btnSelect = e.Item.FindControl("btnSelect") as ImageButton;

        if (btnSelect != null)
        {
            btnSelect.ImageUrl = ResolveUrl(ImagesPath + "next.png");
            btnSelect.ToolTip  = GetString("dialogs.list.actions.select");
            btnSelect.Attributes["onclick"] = selectAction;
        }

        // Initialize EDIT button
        ImageButton btnEdit = e.Item.FindControl("btnEdit") as ImageButton;

        if (btnEdit != null)
        {
            btnEdit.ToolTip  = GetString("general.edit");
            btnEdit.ImageUrl = ResolveUrl(ImagesPath + "edit.png");

            string path       = data.GetValue("Path").ToString();
            string editScript = GetEditScript(path, ext);

            if (!String.IsNullOrEmpty(editScript))
            {
                btnEdit.OnClientClick = editScript;
            }
            else
            {
                btnEdit.Visible = false;
            }
        }

        // Initialize DELETE button
        ImageButton btnDelete = e.Item.FindControl("btnDelete") as ImageButton;

        if (btnDelete != null)
        {
            btnDelete.ImageUrl      = ResolveUrl(ImagesPath + "delete.png");
            btnDelete.ToolTip       = GetString("general.delete");
            btnDelete.OnClientClick = GetDeleteScript(argument);
        }

        // Image area
        Image fileImage = e.Item.FindControl("imgElem") as Image;

        if (fileImage != null)
        {
            string url = null;
            if (ImageHelper.IsImage(ext))
            {
                url = URLHelper.UnMapPath(data.GetValue("Path").ToString());

                // Generate new tooltip command
                if (!String.IsNullOrEmpty(url))
                {
                    url = String.Format("{0}?chset={1}", url, Guid.NewGuid());

                    UIHelper.EnsureTooltip(fileImage, ResolveUrl(url), 0, 0, null, null, ext, null, null, 300);
                }
            }
            else
            {
                url = UIHelper.GetFileIconUrl(Page, ext, "");
            }

            fileImage.ImageUrl = ResolveUrl(url);
        }

        // Selectable area
        Panel pnlItemInageContainer = e.Item.FindControl("pnlTiles") as Panel;

        if (pnlItemInageContainer == null)
        {
            pnlItemInageContainer = e.Item.FindControl("pnlThumbnails") as Panel;
        }
        if (pnlItemInageContainer != null)
        {
            pnlItemInageContainer.Attributes["onclick"] = selectAction;
        }
    }
Esempio n. 59
0
        /// <summary>
        /// Tính toán chi phí cho repeater item lưu thông tin expense
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private Expense ExpenseCalculate(RepeaterItemEventArgs e)
        {
            #region -- Thông tin chung của expense --

            Expense expense = (Expense)e.Item.DataItem;
            // Khi tính chi phí thì chỉ tính theo khách đã check-in
            ICriterion criterion = Expression.And(Expression.Eq("StartDate", expense.Date.Date),
                                                  Expression.Eq("Status", StatusType.Approved));
            // Bỏ deleted và cả transfer
            criterion = Expression.And(Expression.Eq("Deleted", false), criterion);
            criterion = Expression.And(Expression.Eq("IsTransferred", false), criterion);

            // Nếu là trang báo cáo chi phí từng tàu thì chỉ lấy theo tàu đó
            if (ActiveCruise != null)
            {
                criterion = Expression.And(criterion, Expression.Eq("Cruise", ActiveCruise));
            }

            IList bookings =
                Module.BookingGetByCriterion(criterion, null, 0, 0);

            int adult = 0;
            int child = 0;
            //int baby = 0;
            foreach (Booking booking in bookings)
            {
                adult += booking.Adult;
                child += booking.Child;
            }
            _pax += adult + child;

            #endregion

            if (ActiveCruise != null)
            {
                GetCurrentCruiseTable(expense.Date, ActiveCruise);
            }

            _currentTotal = 0; // Tổng cho ngày hiện tại

            // Chi phí tháng/năm chỉ được tính vào chi phí ngày nếu cho phép tính trung bình
            if (PeriodExpenseAvg)
            {
                #region -- Chi phí tháng --

                // Nếu là tính chi phí cho một tàu thì chia chi phí bình thường
                if (expense.Cruise != null)
                {
                    // Nếu có chạy hoặc là tháng chưa kết thúc
                    if (bookings.Count > 0 ||
                        expense.Date.Month + expense.Date.Year * 12 >= DateTime.Today.Month + DateTime.Today.Year * 12)
                    {
                        // Tính chi phí tháng
                        Literal litMonth = e.Item.FindControl("litMonth") as Literal;
                        if (litMonth != null)
                        {
                            DateTime dateMonth = new DateTime(expense.Date.Year, expense.Date.Month, 1);
                            if (!_monthExpense.ContainsKey(dateMonth))
                            {
                                int runcount; // Số ngày tàu chạy trong tháng, chỉ phục vụ việc tính chi phí trung bình
                                // Không cần tính lại trong mỗi lần lặp
                                // Nếu là tháng chưa kết thúc
                                if (dateMonth.AddMonths(1) > DateTime.Today)
                                {
                                    runcount = dateMonth.AddMonths(1).Subtract(dateMonth).Days;
                                }
                                else
                                {
                                    runcount = Module.RunningDayCount(expense.Cruise, expense.Date.Year,
                                                                      expense.Date.Month);
                                }

                                Expense monthExpense = Module.ExpenseGetByDate(expense.Cruise, dateMonth);
                                if (monthExpense.Id < 0)
                                {
                                    Module.SaveOrUpdate(monthExpense);
                                }
                                double total = Module.CopyMonthlyCost(monthExpense);
                                _monthExpense.Add(dateMonth, total / runcount);
                            }

                            litMonth.Text  = _monthExpense[dateMonth].ToString("#,0.#");
                            _month        += _monthExpense[dateMonth];
                            _currentTotal += _monthExpense[dateMonth];
                        }
                    }
                }
                else // Nếu là tính chi phí tổng hợp thì tính cho tất cả các tàu rồi cộng lại
                {
                    IList  cruises  = Module.CruiseGetAll();
                    double monthAll = 0; // tổng chi phí tháng trung bình
                    foreach (Cruise cruise in cruises)
                    {
                        DateTime dateMonth = new DateTime(expense.Date.Year, expense.Date.Month, 1);
                        // Nếu chưa có bảng chi phí cho tàu hiện tại
                        if (!_monthExpenseCruise.ContainsKey(cruise))
                        {
                            _monthExpenseCruise.Add(cruise, new Dictionary <DateTime, double>());
                            // Tạo một từ điển trắng để lưu dữ liệu
                        }

                        // Nếu chưa có chi phí của tàu hiện tại trong tháng hiện tại
                        if (!_monthExpenseCruise[cruise].ContainsKey(dateMonth))
                        {
                            int runcount;
                            // Nếu là tháng chưa kết thúc
                            if (dateMonth.AddMonths(1) > DateTime.Today)
                            {
                                runcount = dateMonth.AddMonths(1).Subtract(dateMonth).Days;
                            }
                            else
                            {
                                runcount = Module.RunningDayCount(cruise, expense.Date.Year, expense.Date.Month);
                            }

                            Expense monthExpense = Module.ExpenseGetByDate(cruise, dateMonth);
                            if (monthExpense.Id < 0)
                            {
                                Module.SaveOrUpdate(monthExpense);
                            }
                            double total = Module.CopyMonthlyCost(monthExpense);
                            _monthExpenseCruise[cruise].Add(dateMonth, total / runcount);
                        }

                        bool isRun = false;
                        if (dateMonth.AddMonths(1) <= DateTime.Today)
                        {
                            foreach (Booking booking in bookings)
                            {
                                if (booking.Cruise == cruise)
                                {
                                    isRun = true;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            isRun = true; // Nếu là tháng chưa kết thúc thì mặc định là mọi ngày tàu đều chạy
                        }


                        if (isRun)
                        {
                            monthAll += _monthExpenseCruise[cruise][dateMonth];
                            // cộng thêm chi phí cho tàu này, ngày này khi tàu có chạy
                        }
                    }

                    _month += monthAll;

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

                #endregion

                #region -- Chi phí năm --

                if (expense.Cruise != null)
                {
                    // Nếu có chạy hoặc năm chưa kết thúc
                    if (bookings.Count > 0 || expense.Date.Year >= DateTime.Today.Year)
                    {
                        // Tính chi phí năm
                        Literal litYear = e.Item.FindControl("litYear") as Literal;
                        if (litYear != null)
                        {
                            DateTime dateYear = new DateTime(expense.Date.Year, 1, 1);
                            int      runcount;
                            // Nếu là năm chưa kết thúc
                            if (dateYear.AddYears(1) > DateTime.Today)
                            {
                                runcount = dateYear.AddYears(1).Subtract(dateYear).Days;
                            }
                            else
                            {
                                runcount = Module.RunningDayCount(expense.Cruise, expense.Date.Year, 0);
                            }
                            if (!_yearExpense.ContainsKey(dateYear))
                            {
                                Expense yearExpense = Module.ExpenseGetByDate(expense.Cruise, dateYear);
                                if (yearExpense.Id < 0)
                                {
                                    Module.SaveOrUpdate(yearExpense);
                                }
                                double total = Module.CopyYearlyCost(yearExpense);
                                _yearExpense.Add(dateYear, total / runcount);
                            }

                            litYear.Text   = _yearExpense[dateYear].ToString("#,0.#");
                            _year         += _yearExpense[dateYear];
                            _currentTotal += _yearExpense[dateYear];
                        }
                    }
                }
                else
                {
                    IList  cruises = Module.CruiseGetAll();
                    double yearAll = 0; // tổng chi phí tháng trung bình
                    foreach (Cruise cruise in cruises)
                    {
                        DateTime dateYear = new DateTime(expense.Date.Year, 1, 1);

                        // Nếu chưa có bảng chi phí cho tàu hiện tại
                        if (!_yearExpenseCruise.ContainsKey(cruise))
                        {
                            _yearExpenseCruise.Add(cruise, new Dictionary <DateTime, double>());
                            // Tạo một từ điển trắng để lưu dữ liệu
                        }

                        // Nếu chưa có chi phí của tàu hiện tại trong năm hiện tại
                        if (!_yearExpenseCruise[cruise].ContainsKey(dateYear))
                        {
                            int runcount;
                            // Nếu là năm chưa kết thúc
                            if (dateYear.AddYears(1) > DateTime.Today)
                            {
                                runcount = dateYear.AddYears(1).Subtract(dateYear).Days;
                            }
                            else
                            {
                                runcount = Module.RunningDayCount(cruise, expense.Date.Year, 0);
                            }

                            Expense yearExpense = Module.ExpenseGetByDate(cruise, dateYear);
                            if (yearExpense.Id < 0)
                            {
                                Module.SaveOrUpdate(yearExpense);
                            }
                            double total = Module.CopyYearlyCost(yearExpense);

                            _yearExpenseCruise[cruise].Add(dateYear, total / runcount);
                        }

                        bool isRun = false;
                        if (dateYear.AddYears(1) <= DateTime.Today)
                        {
                            foreach (Booking booking in bookings)
                            {
                                if (booking.Cruise == cruise)
                                {
                                    isRun = true;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            isRun = true; // Nếu là năm chưa kết thúc thì mặc định là mọi ngày tàu đều chạy
                        }


                        if (isRun)
                        {
                            yearAll += _yearExpenseCruise[cruise][dateYear];
                            // cộng thêm chi phí cho tàu này, ngày này khi tàu có chạy
                        }
                    }

                    _year += yearAll;

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

                #endregion
            }

            if (_cruiseTable == null && ActiveCruise != null)
            {
                throw new Exception("Hai phong cruise price table is out of valid");
            }

            // Lấy về bảng giá đã tính
            _currentCostMap = expense.Calculate(AllCostTypes, GetCurrentTable, GetCurrentDailyTable, GetCurrentCruiseTable,
                                                expense.Cruise,
                                                bookings, Module, PartnershipManager);
            return(expense);
        }