public void loadAdvise()
 {
     usersTableAdapters.GetUserNameTableAdapter user = new usersTableAdapters.GetUserNameTableAdapter();
     InvestmentDSTableAdapters.GetAdviseTableAdapter advise = new InvestmentDSTableAdapters.GetAdviseTableAdapter();
     InvestmentDS.GetAdviseDataTable tblAdvise =advise.GetAdvise(MySessionManager.InvAppID, MySessionManager.ClientID);
     if (tblAdvise.Rows.Count > 0)
     {
         foreach (InvestmentDS.GetAdviseRow r in tblAdvise)
         {
             //txtDescription.Value = tblAdvise[0].datDescription.ToString();
             HtmlGenericControl myp = new HtmlGenericControl("p");
             HtmlGenericControl mypMessage = new HtmlGenericControl("blockquote");
             HtmlGenericControl myDiv = new HtmlGenericControl("div");
             myDiv.Attributes["class"] = " col-md-12 alert alert-info";
             myDiv.Style["padding"] = "4px";
             myp.InnerHtml = "<h5><span> Stage:" + r.datStage.ToString() + "</span><br/><i>   <b> " + user.Getuser(r.userID).ToString() +"</b>'s comment on " + r.modifiedDate.ToLongDateString() + "</i></h5>"
                            + "<hr style='margin:3px'/>";
             mypMessage.Attributes["class"] = "text-justify";
             mypMessage.InnerHtml = "<p>" + r.datDescription.ToString() + "</p>";
             Literal myLine = new Literal();
             myLine.Text = "<hr style='margin:3px'/><br/>";
             myDiv.Controls.Add(myp);
             myDiv.Controls.Add(myLine);
             myDiv.Controls.Add(mypMessage);
             myDiv.Controls.Add(myLine);
             this.Comments.Controls.Add(myDiv);
         }
     }
 }
示例#2
0
    protected void cmdSubmit_Click(object sender, EventArgs e)
    {
        //if (txtFname.Text != "Jason")
        //{
        //    Response.Write("Oh no!");
        //}

        System.Web.UI.WebControls.Label lblFName = new Label();
        lblFName.ID = "lblFName";
        lblFName.Text = txtFname.Text;

        System.Web.UI.WebControls.Label lblEmail = new Label();
        lblEmail.ID = "lblEmail";
        lblEmail.Text = txtEmail.Text;

        System.Web.UI.WebControls.Literal lit1 = new Literal();
        lit1.Text = "<br />";

        System.Web.UI.WebControls.Literal lit2 = new Literal();
        lit2.Text = "<br />";

        PlaceHolder1.Controls.Add(lit1);
        PlaceHolder1.Controls.Add(lblEmail);
        PlaceHolder1.Controls.Add(lit2);
        PlaceHolder1.Controls.Add(lblFName);

        lblhidden.Text = Request.Form["ctl00$MainContent$txtFname"];
        lblhidden.Visible = true;
    }
	private void ShowErrorMsg(string msg)
	{
        //Display error message
		Literal script = new Literal();
		script.Text = "<script language='javascript'>alert(\"" + msg + "\");</script>";
		this.Controls.Add(script);
	}
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //如果不設定這個,畫面在第一次讀取關閉後,就不會再跑Page_Load了.
            Response.Expires = 0;

            //動態加入_self,不然會另開新視窗
            Literal litCss = new Literal();
            litCss.Text = @"<base target=""_self"">";
            this.Header.Controls.Add(litCss);

            ErrorMsgLabel.Text = "";

            if (!IsPostBack)
            {

                Init_Data();
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {

        }

    }
示例#5
0
    private void fillWipTables()
    {
        string IP = Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? Request.ServerVariables["REMOTE_ADDR"];
        DataTable DT = theCake.getWipTasks(theCake.getActiveUserName(IP));
        string TableString = "";

        if (DT.Rows.Count > 0)
        {
            foreach (DataRow DR in DT.Rows)
            {
                Literal sectionControl = new Literal();
                float percentComplete = float.Parse(DR["Percent_Completed"].ToString()) / 100;
                TableString += "<section><a href=\"ViewTask.aspx?ID=" + DR["ID"].ToString() + "\"><h3>" + DR["taskName"].ToString() + "</h3><p>Progress: <progress value=\"" + percentComplete + "\" /></p></a></section>";
                sectionControl.Text = TableString;
                pnl_WipTasks.Controls.Add(sectionControl);
            }
        }
        else
        {
            Literal sectionControl = new Literal();
            TableString += "No projects available";
            sectionControl.Text = TableString;
            pnl_WipTasks.Controls.Add(sectionControl);
        }
    }
        protected override string GetValue(Literal literal)
        {
            if (literal == null)
                throw new ArgumentNullException(nameof(literal));

            return literal.Identifier;
        }
        public void DataBindTemplate(object sender, EventArgs e)
        {
            PlaceHolder templatePlaceHolder = sender as PlaceHolder;
            ComboBoxItemTemlateContainer container = templatePlaceHolder.NamingContainer as ComboBoxItemTemlateContainer;
            ComboBoxItem item = (ComboBoxItem)container.Parent;

            Literal companyNameText = new Literal();
            if(!isPostBack)
            companyNameText.Text = "<span class=\"template-name\">" + DataBinder.Eval(item.DataItem, "CompanyName").ToString() + "</span>";

            Literal countryText1 = new Literal();
            if (!isPostBack)
            countryText1.Text = " / <span class=\"template-country\">" + DataBinder.Eval(item.DataItem, "Country").ToString() + " ";

            Image flag = new Image();
            if (!isPostBack)
            flag.ImageUrl = GetCountryFlag(DataBinder.Eval(item.DataItem, "Country").ToString());
            
            Literal countryText2 = new Literal();
            if (!isPostBack)
            countryText2.Text = "</span>";

            templatePlaceHolder.Controls.Add(companyNameText);
            templatePlaceHolder.Controls.Add(countryText1);
            templatePlaceHolder.Controls.Add(flag);
            templatePlaceHolder.Controls.Add(countryText2);
        }
示例#8
0
 public void literal_html_encodes_its_value()
 {
     const string value = "<div>Foo</div>";
     var html = new Literal("test").Value(value).ToString();
     html.ShouldRenderHtmlDocument().ChildNodes[0]
         .ShouldHaveInnerTextEqual(HttpUtility.HtmlEncode(value));
 }
 /// <summary>
 /// Checks whether the process responses is already running, and changes the status message.
 /// </summary>
 /// <param name="btnProcessIncomingResponse"></param>
 /// <param name="litIncomingInfo"></param>
 /// <author>Saad Mansour</author>
 public static void CheckProcessResponsesStatus(RadButton btnProcessIncomingResponse, Literal litIncomingInfo)
 {
     try
     {
         if (GlobalVariables.IsProcessIncomingRunning)
         {
             if (btnProcessIncomingResponse != null)
             {
                 btnProcessIncomingResponse.Enabled = false;
                 litIncomingInfo.Text = "Processing is already Running. Please, wait.";
             }
         }
         else
         {
             if (btnProcessIncomingResponse != null)
             {
                 string[] files = Directory.GetFiles(Utility.GetResponseFilesFolderName() + "incoming");
                 if (files.Length > 0)
                 {
                     btnProcessIncomingResponse.Enabled = true;
                     litIncomingInfo.Text = "New Form Response(s): " + files.Length;
                 }
                 else
                 {
                     btnProcessIncomingResponse.Enabled = false;
                     litIncomingInfo.Text = "All Responses have been processed.";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogUtils.WriteErrorLog(ex.ToString());
     }
 }
    public void MensajeJQuery(String Message)
    {
        //*******************************************
        // MensajeJQuery
        //*******************************************
        //En esta ocasión agregaremos un literal que a su vez agregaremos un div que nos servira de Dialog
        //O si prefieren pueden crear el div directamente en el HTML
        Literal li = new Literal();
        StringBuilder sbMensaje = new StringBuilder();
        //Creamos el Div
        sbMensaje.Append("<div id='dialog-message' title='Aviso'>");
        sbMensaje.Append("<div class='ui-widget'>");
        sbMensaje.Append("<div class='ui-state-error ui-corner-all'style='padding: 0 .7em;'>");
        sbMensaje.Append("<p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span>");
        //Le indicamos el mensaje a mostrar
        sbMensaje.Append(Message);
        //cerramos el div
        sbMensaje.Append("</p></div></div></div>");

        sbMensaje.Append("<script type='text/javascript'>");
        sbMensaje.Append("$(function() {");
        //Destruimos cualquier rastro de dialogo abierto
        sbMensaje.Append("$('#dialog-message').dialog('destroy');");
        //Si quieres que muestre un boton para cerrar el mensaje seria esta linea que dejare en comentario
        sbMensaje.Append("$('#dialog-message').dialog({ modal: true, buttons: { 'Ok': function() { $( this ).dialog('close'); } } });");
        sbMensaje.Append("});");
        sbMensaje.Append("</script>");
        //Agremamos el texto del stringbuilder al literal
        li.Text = sbMensaje.ToString();
        //Agregamos el literal a la pagina
        Page.Controls.Add(li);
    }
示例#11
0
    /// <summary>
    /// 
    /// </summary>
    protected void BindProfiles()
    {
        ProfileAdmin profileAdmin = new ProfileAdmin();
        TList<Profile> profileList = profileAdmin.GetAll();

        foreach (Profile entity in profileList)
        {
            Literal ltrl = new Literal();
            ltrl.Text = "<div class=\"FieldStyle\">" + entity.Name + "</div><div class=\"ValueStyle\">";

            TextBox textBox = new TextBox();
            textBox.ID = "txtProfile" + entity.ProfileID.ToString();
            XmlNode node = QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='ProfileID" + entity.ProfileID.ToString() + "']");
            if (node != null)
            {
                textBox.Text = node.Attributes["MsgValue"].Value;
            }

            Literal newLine = new Literal();
            newLine.Text = "</div>";

            ControlPlaceHolder.Controls.Add(ltrl);
            ControlPlaceHolder.Controls.Add(textBox);
            ControlPlaceHolder.Controls.Add(newLine);
        }
    }
    public void LoadComments(int AccID)
    {
        LoanAccountDSTableAdapters.AccountCommentTableAdapter accComment = new LoanAccountDSTableAdapters.AccountCommentTableAdapter();
        LoanAccountDS.AccountCommentDataTable tblAccComment = accComment.GetAccountComment(AccID);

        foreach (LoanAccountDS.AccountCommentRow r in tblAccComment)
        {
            HtmlGenericControl myp = new HtmlGenericControl("p");
            HtmlGenericControl mypMessage = new HtmlGenericControl("blockquote");
            HtmlGenericControl myDiv = new HtmlGenericControl("div");
            myDiv.Attributes["class"] = " col-md-12 alert alert-info";
            myDiv.Style["padding"] = "4px";
            myp.InnerHtml = "<h5><i><b> " + r.datUser.ToString() + "</b>'s comment on " + r.modifiedDate.ToLongDateString() + "</i></h5>"
                           +"<hr style='margin:3px'/>";
            mypMessage.Attributes["class"] = "text-justify";
            mypMessage.InnerHtml="<p>" + r.datDescription.ToString()+"</p>";
            Literal myLine = new Literal();
            myLine.Text = "<hr style='margin:3px'/><br/>";
            myDiv.Controls.Add(myp);
            myDiv.Controls.Add(myLine);
            myDiv.Controls.Add(mypMessage);
            myDiv.Controls.Add(myLine);
            this.Comments.Controls.Add(myDiv);
        }
    }
示例#13
0
    private void DisableControls(Control gv)
    {
        LinkButton lb = new LinkButton();
        Literal l = new Literal();
        string name = String.Empty;

        for (int i = 0; i < gv.Controls.Count; i++)
        {
            if (gv.Controls[i].GetType() == typeof(LinkButton))
            {
                l.Text = (gv.Controls[i] as LinkButton).Text;
                gv.Controls.Remove(gv.Controls[i]);
                gv.Controls.AddAt(i, l);
            }
            else if (gv.Controls[i].GetType() == typeof(DropDownList))
            {
                l.Text = (gv.Controls[i] as DropDownList).SelectedItem.Text;
                gv.Controls.Remove(gv.Controls[i]);
                gv.Controls.AddAt(i, l);
            }

            if (gv.Controls[i].HasControls())
            {
                DisableControls(gv.Controls[i]);
            }
        }
    }
示例#14
0
    private void ReplaceThemeCssLink()
    {
        string themeName = Page.Theme;
        if (string.IsNullOrEmpty(themeName)) return;

        // Find out all the Css links that are generated on the theme folder because
        // they will be replaced with one single link to CssHandler.ashx
        List<HtmlLink> linksToRemove = new List<HtmlLink>();
        foreach (Control c in Page.Header.Controls)
            if (c is HtmlLink)
                if ((c as HtmlLink).Href.Contains("App_Themes/" + themeName))
                    linksToRemove.Add(c as HtmlLink);

        // Remove all of them and create a comma delimited file name list as the 
        // CssHandler needs to know what files to combine on the theme folder
        string themeCssNames = "";
        linksToRemove.ForEach(new Action<HtmlLink>(delegate(HtmlLink link)
            {
                Page.Header.Controls.Remove(link);
                themeCssNames += VirtualPathUtility.GetFileName(link.Href) + ',';
            }));

        // Produce a new <link> tag that will hit hte CssHandler.ashx with the 
        // necessary theme information. Using Literal because HtmlLink encodes
        // the href attribute and screws up the URL
        Literal linkTag = new Literal();

        string cssPath = CSS_PREFIX + "CssHandler.ashx?t=" + themeName
            + "&f=" + HttpUtility.UrlEncode(themeCssNames.TrimEnd(','))
            + "&v=" + CSS_VERSION;

        linkTag.Text = string.Format(@"<link href=""{0}"" type=""text/css"" rel=""stylesheet"" />", cssPath);        
        Page.Header.Controls.Add(linkTag);
    }
        public static void TestAssignment()
        {
            var context = new ExecutionContext(new Python3Calculator());
            var foo = new Variable("foo", context);
            var bar = new Variable("bar", context);
            var boolean = new Literal(false);
            var intNumber = new Literal(3);
            var floatNumber = new Literal(3.0f);

            context.Assign(foo, new Literal(3));
            AssertEquals(foo.AsLiteral(), new Literal(3));
            AssertEquals(foo.AsValue(), 3);

            context.Assign(bar, new Literal(3));
            AssertEquals(bar.AsLiteral(), new Literal(3));
            AssertEquals(bar.AsValue(), 3);

            context.Assign(bar, new Literal(5));
            context.Assign(foo, bar);
            AssertEquals(foo.AsLiteral(), new Literal(5));
            AssertEquals(foo.AsValue(), 5);
            AssertEquals(bar.AsLiteral(), new Literal(5));
            AssertEquals(bar.AsValue(), 5);

            AssertException<InvalidOperationException>(() => context.Assign(boolean, foo));
            AssertException<InvalidOperationException>(() => context.Assign(intNumber, foo));
            AssertException<InvalidOperationException>(() => context.Assign(floatNumber, foo));
        }
示例#16
0
    public override Sage.Platform.Application.UI.ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType)
    {
        Sage.Platform.WebPortal.SmartParts.ToolsSmartPartInfo tinfo = new Sage.Platform.WebPortal.SmartParts.ToolsSmartPartInfo();

        tinfo.Description = "Web Info";
        tinfo.Title = "Web Info";

        Literal spacer = new Literal();
        spacer.Text = " ";

        Label label1 = new Label();
        label1.Text = "WebSites ";

        tinfo.CenterTools.Add(label1);
        tinfo.CenterTools.Add(ddlUrls);

        tinfo.RightTools.Add(cmdAdd);
        tinfo.RightTools.Add(spacer);
        tinfo.RightTools.Add(cmdEdit);
        tinfo.RightTools.Add(spacer);
        tinfo.RightTools.Add(cmdDelete);
        tinfo.RightTools.Add(spacer);
        tinfo.RightTools.Add(cmdRefresh);

        return tinfo;
    }
示例#17
0
 public void BindFBComment(string Vid)
 {
     string str = "<div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#appId=" + Settings.FBAppId + "&amp;xfbml=1\"></script><fb:comments xid=\"" + Vid + "\" href=\"http://www.timeflies.by/" + Vid + "&" + "\" num_posts=\"4\"  width=\"500\"></fb:comments>";
     Literal myScript = new Literal();
     myScript.Text = str;
     FBCommentPlaceHolder.Controls.Add(myScript);
 }
示例#18
0
    /// <summary>
    /// This subroutine accepts an integer indicating the current ContentLanguage specified by the user, and then outputs the current Synonym Sets stored in the CMS to the workarea.  The Keywords associated with each Synonym Set will be truncated in the output so that only one line of terms will be displayed.  A "title" attribute provides the entire list of terms on mouseover.
    /// </summary>
    /// <param name="ContentLanguage">An integer representing the current user selected language for the content.</param>
    /// <remarks></remarks>
    protected void OutputSynonymSets(int ContentLanguage, Literal  objLiteral)
    {
        Ektron.Cms.CommonApi api = new Ektron.Cms.CommonApi();
            try
            {
                List<SynonymData> synonymSetData = GetSynonyms(ContentLanguage);

                if (synonymSetData == null)
                {
                    throw (new Exception(m_refMsg.GetMessage("generic no results found")));
                }

                objLiteral.Text = "<table id=\"viewSynonymSets\" class=\"ektronGrid\">";

                objLiteral.Text += "<tr class=\"title-header\">" + "\r\n";
                objLiteral.Text += "<th class=\"left\">" + m_refMsg.GetMessage("lbl synonym header set") + "</th>" + "\r\n";
                objLiteral.Text += "<th class=\"center\">" + m_refMsg.GetMessage("generic language") + "</th>" + "\r\n";
                objLiteral.Text += "</tr>" + "\r\n";

                foreach (SynonymData synonymSet in synonymSetData)
                {
                    //TODO: Pinkesh - Add row striping
                    objLiteral.Text += "<tr class=\"row\">" + "\r\n";
                    objLiteral.Text += "<td><a href=\"synonyms.aspx?id=" + synonymSet.ID.ToString() + "&#38;LangType=" + synonymSet.LanguageID + "&#38;action=ViewSynonym&#38;bck=vs\">" + EkFunctions.HtmlEncode(synonymSet.Name) + "</td>" + "\r\n";
                    objLiteral.Text += "<td  class=\"center\"><img style=\'vertical-align:middle;\' src=\'" + objLocalizationApi.GetFlagUrlByLanguageID(synonymSet.LanguageID) + "\' title=\'" + synonymSet.LanguageID + "\' alt=\'" + synonymSet.LanguageID + "\' /></td>";
                    objLiteral.Text += "</tr>" + "\r\n";
                }
                objLiteral.Text += "</table>" + "\r\n";
            }
            catch
            {
                Utilities.ShowError(m_refMsg.GetMessage("msg search synonyms connection error"));
            }
    }
示例#19
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        MonkData db = new MonkData();
        foreach(PropertyInfo tablePInfo in db.GetType().GetProperties())
        {
            Type[] genericTypes = tablePInfo.PropertyType.GetGenericArguments();
            if(genericTypes.Count() < 1)
                continue;

            if(!CanUserAccessTable(genericTypes[0].Name, false, ref db))
            {
                continue;
            }

            HyperLink hlTypeEdit = new HyperLink();
            hlTypeEdit.NavigateUrl = "AddEdit.aspx?typename=" + genericTypes[0].Name;
            hlTypeEdit.Text = "Add " + GetFieldNameFromString( tablePInfo.Name);
            plcAddItemsList.Controls.Add(hlTypeEdit);

            Literal litLineBreak = new Literal();
            litLineBreak.Text = "<br />";
            plcAddItemsList.Controls.Add(litLineBreak);

            HyperLink hlTypeGridView = new HyperLink();
            hlTypeGridView.NavigateUrl = "GridView.aspx?typename=" + genericTypes[0].Name;
            hlTypeGridView.Text = GetFieldNameFromString( tablePInfo.Name);
            plcViewItems.Controls.Add(hlTypeGridView);

            Literal litLineBreakGridView = new Literal();
            litLineBreakGridView.Text = "<br />";
            plcViewItems.Controls.Add(litLineBreakGridView);
        }
    }
        public void InstantiateIn(Control container)
        {
            Literal templatePlaceHolder = new Literal();
            container.Controls.Add(templatePlaceHolder);

            templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate);
        }
示例#21
0
        static string Escape(this char ch, Literal literal)
        {
            switch (ch)
            {
                case '\"': return literal == Literal.String ? "\\\"" : Char.ToString(ch);
                case '\'': return literal == Literal.Character ? "\\\'" : Char.ToString(ch);

                case '\\': return "\\\\";
                case '\0': return "\\0";
                case '\a': return "\\a";
                case '\b': return "\\b";
                case '\f': return "\\f";
                case '\n': return "\\n";
                case '\r': return "\\r";
                case '\t': return "\\t";
                case '\v': return "\\v";

                case '\u0085': //Next Line
                case '\u2028': //Line Separator
                case '\u2029': //Paragraph Separator
                   return string.Format("\\u{0:X4}", (int)ch);

                default:
                    return Char.ToString(ch);
            }
        }
		protected FulltextFunction(ReservedKeyword keyword, Expression query, Literal language) {
			Debug.Assert(keyword != null);
			Debug.Assert(query != null);
			this.keyword = keyword;
			this.query = query;
			this.language = language;
		}
    protected void GridTeachers_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            HtmlAnchor aPages = e.Row.Cells[0].FindControl("aPages") as HtmlAnchor;
            PlaceHolder ltTchs = e.Row.Cells[1].FindControl("ltTchs") as PlaceHolder;
            HtmlAnchor aMore = e.Row.Cells[0].FindControl("aMore") as HtmlAnchor;
            Field fd = e.Row.DataItem as Field;
            if (fd != null)
            {
                aPages.HRef = aMore.HRef = Utils.AbsoluteWebRoot + @"TeacherList.aspx?fid=" + fd.Id;
                int num = 0;
                foreach (MembershipUser user in Membership.GetAllUsers())
                {
                    AuthorProfile ap = AuthorProfile.GetProfile(user.UserName);
                    if (ap!=null && ap.IsTeacher && !ap.IsAdmin && ap.IsPrivate && ap.Fields.Contains(fd.Id.ToString()) && num<9)
                    {
                        HtmlAnchor aTch = new HtmlAnchor();
                        aTch.HRef = Utils.AbsoluteWebRoot + @"Views\TeacherView.aspx?uid=" + ap.UserName;
                        aTch.Title = ap.DisplayName;
                        aTch.InnerText = StripString(ap.DisplayName, 4);
                        //aTch.Style.Add(HtmlTextWriterStyle.Color, "#333333");
                        ltTchs.Controls.Add(aTch);

                        Literal lt = new Literal();
                        lt.Text = " ";
                        ltTchs.Controls.Add(lt);
                        num++;
                    }
                }
            }
        }
    }
示例#24
0
    protected void LoadPage()
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CAI"].ConnectionString);
        conn.Open();
        string sql = "Select Heading, Text, OrderCOl From DONATION_PAGE Where Active=1 Order By OrderCol";
        SqlCommand cmd = new SqlCommand(sql, conn);
        SqlDataReader dr = cmd.ExecuteReader(); int i = 0;
        while (dr.Read())
        {
            //-----create new article control---------
            //Load control from template and assign unique ID
            Control art = LoadControl("~/design/Article.ascx");
            art.ID = dr["Heading"].ToString() + i.ToString(); i++;

            //get header and content placeholders for newly created article control
            PlaceHolder header = (PlaceHolder)art.FindControl("HeaderPlaceholder");
            PlaceHolder content = (PlaceHolder)art.FindControl("ContentPlaceholder");

            //assign header to a literal control
            Literal litHeader = new Literal(); litHeader.Text = dr["Heading"].ToString();

           //assign text to a literal control
            Literal litText = new Literal(); litText.Text = dr["Text"].ToString();

            //add literals to placeholders and add article to PagePanel
            if (header != null && content != null) { header.Controls.Add(litHeader); content.Controls.Add(litText); }
            PagePanel.Controls.Add(art);
        }
        dr.Close(); Global_Functions.CloseConnection(conn);
    }
示例#25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String _storId = Request.QueryString["storId"];

        if (!String.IsNullOrEmpty(_storId))
        {
            Stories _st = new Stories(ConfigurationManager.ConnectionStrings["TopRockConnection"].ConnectionString);
            _st.LitePopulate(_storId);

            if (!String.IsNullOrEmpty(CommonUtility.NullSafeString(_st.YouTubeLink, "").Trim()))
            {
                Literal _li = new Literal();
                _li.Text = _st.YouTubeLink;
                secureHolder.Controls.Add(_li);
            }
            else
            {
                if (!String.IsNullOrEmpty(CommonUtility.NullSafeString(_st.ImgType, "").Trim()))
                {
                    Image _img = new Image();
                    _img.ImageUrl = String.Format(ConfigurationManager.AppSettings["StoriesImagesPath"], _st.ID.ToString(), _st.ImgType);
                    secureHolder.Controls.Add(_img);
                }
            }

        }
    }
 void IView.Error(string message)
 {
     Literal lit = new Literal();
     lit.Text = message;
     phWidgetLists.Controls.Clear();
     phWidgetLists.Controls.Add(lit);
 }
        protected override void OnLoad(System.EventArgs e)
        {
            if (!Sitecore.Context.ClientPage.IsEvent)
            {
                //create the controls (one for typing the text into, the other for the live preview).
                var memoRawText = new Sitecore.Shell.Applications.ContentEditor.Memo();
                memoRawText.ID = GetID("memoRawText");
                memoRawText.Height = 100;

                //Uses Showdown to provide a live preview. (See 'InjectScripts.cs' for how we do this)
                memoRawText.Attributes.Add("onkeyup", string.Format("javascript: var converter = new Showdown.converter(); var ePreview = document.getElementById('{0}'); ePreview.innerHTML = converter.makeHtml(this.value);", GetID("previewLiteral")));
                memoRawText.Attributes.Add("onclick", string.Format("javascript: var converter = new Showdown.converter(); var ePreview = document.getElementById('{0}'); ePreview.innerHTML = converter.makeHtml(this.value);", GetID("previewLiteral")));
                Controls.Add(memoRawText);

                var previewLiteral = new Literal("<br /><br />");
                previewLiteral.ID = GetID("previewLiteral"); ;
                Controls.Add(previewLiteral);

                //If we have a value already then populate it.
                memoRawText.Value = Value;
            }
            else
            {
                //This is the save event so get the raw value and save it to the Value field.
                var memoRawText = FindControl(GetID("memoRawText")) as Sitecore.Shell.Applications.ContentEditor.Memo;

                if (memoRawText != null)
                {
                    Value = memoRawText.Value;
                }
            }

            base.OnLoad(e);
        }
示例#28
0
 public void literal_renders_with_inner_text_formatted()
 {
     const decimal item = 1234.5m;
     var expected = string.Format("{0:$#,##0.00}", item);
     var html = new Literal("test").Value(item).Format("$#,##0.00").ToString();
     html.ShouldRenderHtmlDocument().ChildNodes[0]
         .ShouldHaveInnerTextEqual(expected);
 }
示例#29
0
 public void TestLiteralEquals()
 {
     Literal a1 = new Literal('A');
     Assert.AreNotEqual(a1, null);
     Assert.AreNotEqual(a1, new Literal('B'));
     Literal a2 = new Literal('A');
     Assert.AreEqual(a1, a2);
 }
示例#30
0
		public Parameter(ParameterName parameterName, Qualified<SchemaName, TypeName> parameterTypeName, Optional<Literal> defaultValue, Optional<UnreservedKeyword> readOnly) {
			Debug.Assert(parameterName != null);
			Debug.Assert(parameterTypeName != null);
			this.parameterName = parameterName;
			this.parameterTypeName = parameterTypeName;
			this.defaultValue = defaultValue;
			this.readOnly = readOnly.HasValue();
		}
示例#31
0
        /// <summary>
        /// Load the controls which will form the user interface.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // Set the literal control.
            _literalUpload       = new Literal();
            _literalInstructions = new Literal();

            // Create the required controls.
            _textBoxLicenceKey        = new TextBox();
            _buttonActivate           = new Button();
            _buttonRefresh            = new Button();
            _validatorRequired        = new RequiredFieldValidator();
            _validatorRegEx           = new RegularExpressionValidator();
            _validationLicenceSummary = new ValidationSummary();
            _literalResult            = new Literal();

            // Set the new controls properties.
            _buttonActivate.ID              = "ButtonActivate";
            _buttonActivate.Click          += new EventHandler(_buttonActivate_Click);
            _buttonActivate.ValidationGroup = VALIDATION_LICENCE;
            _buttonRefresh.ID                  = "ButtonRefresh";
            _buttonRefresh.Click              += new EventHandler(_buttonActivate_Click);
            _buttonRefresh.Visible             = false;
            _textBoxLicenceKey.ID              = "TextBoxLicenceKey";
            _textBoxLicenceKey.ValidationGroup = VALIDATION_LICENCE;

            // Set the validators.
            _validatorRequired.ID                 = "ValidatorRequired";
            _validatorRegEx.ID                    = "ValidatorRegEx";
            _validationLicenceSummary.ID          = "ValidationLicenceSummary";
            _validatorRequired.ControlToValidate  = _validatorRegEx.ControlToValidate = _textBoxLicenceKey.ID;
            _validatorRegEx.ValidationGroup       = _validatorRequired.ValidationGroup = VALIDATION_LICENCE;
            _validatorRegEx.ValidationExpression  = FiftyOne.Foundation.Mobile.Detection.Constants.LicenceKeyValidationRegex;
            _validationLicenceSummary.DisplayMode = ValidationSummaryDisplayMode.SingleParagraph;
            _validationLicenceSummary.Style.Clear();
            _validationLicenceSummary.ValidationGroup = VALIDATION_LICENCE;
            _validatorRequired.Display         = _validatorRegEx.Display = ValidatorDisplay.None;
            _validatorRegEx.EnableClientScript = _validatorRequired.EnableClientScript =
                _validationLicenceSummary.EnableClientScript = true;

            // Set the child controls.
            _upload.FooterEnabled          = false;
            _upload.LogoEnabled            = false;
            _upload.UploadComplete        += new UploadEventHandler(_upload_UploadComplete);
            _shareUsage.LogoEnabled        = false;
            _shareUsage.FooterEnabled      = false;
            _shareUsage.ShareUsageChanged += new ShareUsageChangedEventHandler(_shareUsage_ShareUsageChanged);

            // Add the controls to the user control.
            _container.Controls.Add(_literalResult);
            _container.Controls.Add(_validationLicenceSummary);

            _container.Controls.Add(_literalInstructions);

            if (IsPaidFor == false)
            {
                _container.Controls.Add(_validatorRequired);
                _container.Controls.Add(_validatorRegEx);
                _container.Controls.Add(_textBoxLicenceKey);
                _container.Controls.Add(_buttonActivate);
                _container.Controls.Add(_buttonRefresh);
                _container.Controls.Add(_literalUpload);
                _container.Controls.Add(_upload);
            }

            _container.Controls.Add(_shareUsage);
        }
示例#32
0
    protected void calc_btn0_Click(object sender, EventArgs e)
    {
        int       animalid       = Convert.ToInt32(Grow_ddl5.SelectedValue);
        int       targetincrease = Convert.ToInt32(Grow_ddl6.SelectedValue);
        bool      season         = Convert.ToBoolean(season_ddl0.SelectedValue);
        bool      type           = Convert.ToBoolean(keepgrp_ddl.SelectedValue);
        ArrayList feedidss       = new ArrayList();
        ArrayList drymatter      = new ArrayList();
        ArrayList crudefiber     = new ArrayList();
        ArrayList protein        = new ArrayList();
        ArrayList energy         = new ArrayList();
        ArrayList ca             = new ArrayList();
        ArrayList p            = new ArrayList();
        ArrayList feed         = new ArrayList();
        ArrayList feedcategory = new ArrayList();
        ArrayList feedids      = new ArrayList();
        ArrayList feedweights  = new ArrayList();
        Dictionary <string, object> energychange = new Dictionary <string, object>();
        Dictionary <string, object> ratio        = new Dictionary <string, object>();

        using (SqlConnection conn = new SqlConnection())
        {
            conn.ConnectionString = ConfigurationManager.ConnectionStrings["DBpath"].ConnectionString;
            SqlCommand comm = new SqlCommand();
            comm.Connection = conn;
            conn.Open();



            int count = 0;
            comm.Parameters.Clear();
            comm.CommandText = "SELECT FEED_STOCK.FEEDID, FEED_STOCK.WEIGHT AS WEIGHT, FEED.NAME AS FEEDNAME, FEED_STOCK.ID, FEED.ID AS FEED_ID FROM FEED_STOCK INNER JOIN FEED ON FEED_STOCK.FEEDID = FEED.ID";

            SqlDataReader reader = comm.ExecuteReader();
            while (reader.Read())
            {
                feedids.Add(reader["FEED_ID"]);
                feedweights.Add(reader["WEIGHT"]);
            }
            reader.Close();
            string feedid = feedids[0].ToString();
            for (int i = 1; i <= feedids.Count - 1; i++)
            {
                feedid += "," + feedids[i].ToString();
            }
            int animalsid = 0;
            int quantity  = 0;
            comm.Parameters.Clear();
            comm.CommandText = string.Format("SELECT E.ANIMALSID,F.QUANTITY AS QUANTITY,E.DRYMATTER,E.CRUDEFIBER,E.PROTEIN,E.ENERGY,E.CA,E.P, R.COPERCENT,R.ROPERCENT,R.SUPERCENT FROM ENERGYCHANGE E, FEEDRATIO R, FARM F WHERE E.TARGETINCREASEID={0} AND E.SEASON='{2}' AND E.TYPE='{3}' AND E.RATIOID=R.ID AND E.ANIMALSID=F.ANIMALSID AND E.TARGETINCREASEID=F.TARGETINCREASEID AND F.RATIONGROUP={1}", targetincrease, animalid, season, type);
            reader           = comm.ExecuteReader();
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    energychange["DRYMATTER"]  = reader["DRYMATTER"].ToString();
                    energychange["CRUDEFIBER"] = reader["CRUDEFIBER"].ToString();
                    energychange["PROTEIN"]    = reader["PROTEIN"].ToString();
                    energychange["ENERGY"]     = reader["ENERGY"].ToString();
                    energychange["CA"]         = reader["CA"].ToString();
                    energychange["P"]          = reader["P"].ToString();
                    ratio["COPERCENT"]         = reader["COPERCENT"].ToString();
                    ratio["ROPERCENT"]         = reader["ROPERCENT"].ToString();
                    ratio["SUPERCENT"]         = reader["SUPERCENT"].ToString();
                    animalsid     = Convert.ToInt32(reader[0]);
                    quantity      = Convert.ToInt32(reader["QUANTITY"]);
                    ratio_lb.Text = string.Format("<tr><td>Concentrated (15% H20)</td><td>{0}</td></tr><tr><td>Roughages (15% H20)</td><td>{1}</td></tr><tr><td>Succulent	(75% H20)</td><td>{2}</td></tr>", reader["COPERCENT"].ToString() + "%", reader["ROPERCENT"].ToString() + "%", reader["SUPERCENT"].ToString() + "%");
                }
            }

            reader.Dispose();
            conn.Close();


            string new123 = comm.CommandText;



            conn.Open();
            comm.Parameters.Clear();
            comm.CommandText = string.Format("SELECT F.ID, F.NAME AS FEED, F.DRYMATTER as DRYMATTER,F.CRUDEFIBER,F.PROTEIN,F.ENERGY,F.CA,F.P,FC.NAME AS CATEGORY FROM FEED F, ANIMALFEEDTYPE FT, ANIMALS A, ANIMALGROUP AG, FEEDCATEGORY FC WHERE FT.FEEDID=F.ID AND FT.ANIMALGROUPID=AG.ID AND A.ID={1} AND F.ID in ({0}) and F.CATEGORYID=FC.ID AND A.ANIMALGROUPID=AG.ID", feedid, animalsid);

            reader = comm.ExecuteReader();
            while (reader.Read())
            {
                feedidss.Add(reader["ID"].ToString());
                drymatter.Add(reader["DRYMATTER"].ToString());
                crudefiber.Add(reader["CRUDEFIBER"].ToString());
                protein.Add(reader["PROTEIN"].ToString());
                energy.Add(reader["ENERGY"].ToString());
                ca.Add(reader["CA"].ToString());
                p.Add(reader["P"].ToString());
                feedcategory.Add(reader["CATEGORY"].ToString());
                feed.Add(reader["FEED"].ToString());
            }
            ArrayList feedkoef = new ArrayList();


            double cocrudefibersum = 0;
            double coproteinsum    = 0;
            double coenergysum     = 0;
            double cocasum         = 0;
            double copsum          = 0;
            double codrymattersum  = 0;

            double rocrudefibersum = 0;
            double roproteinsum    = 0;
            double roenergysum     = 0;
            double rocasum         = 0;
            double ropsum          = 0;
            double rodrymattersum  = 0;

            double sucrudefibersum = 0;
            double suproteinsum    = 0;
            double suenergysum     = 0;
            double sucasum         = 0;
            double supsum          = 0;
            double sudrymattersum  = 0;


            double koefco       = 0;
            double koefsu       = 0;
            double koefro       = 0;
            double koefficentco = 0;
            double koefficentro = 0;
            double koefficentsu = 0;
            double maxco        = 0;
            double maxro        = 0;
            double maxsu        = 0;



            for (int i = 0; i <= feedidss.Count - 1; i++)
            {
                if (feedcategory[i].ToString().Substring(0, 2) == "Co")
                {
                    //drymattersum =drymattersum+ Convert.ToDecimal(drymatter[i]);
                    energy[i]        = energy[i];
                    coenergysum     += Convert.ToDouble(energy[i]);
                    cocrudefibersum += Convert.ToDouble(crudefiber[i]);
                    coproteinsum    += Convert.ToDouble(protein[i]);
                    cocasum         += Convert.ToDouble(ca[i]);
                    copsum          += Convert.ToDouble(p[i]);
                    codrymattersum  += Convert.ToDouble(drymatter[i]);
                    co_lb.Text       = feed[i].ToString();
                    int k = 1;
                    koefficentco = Convert.ToDouble(energychange["DRYMATTER"]) * Convert.ToDouble(ratio["COPERCENT"]) / 100 * quantity / codrymattersum;
                    for (int j = 0; j <= feedids.Count - 1; j++)
                    {
                        if (Convert.ToInt32(feedids[j]) == Convert.ToInt32(feedidss[i]))
                        {
                            k = j;
                        }
                    }
                    maxco = Convert.ToDouble(feedweights[k]);


                    if (maxco < koefficentco)
                    {
                        Button b = sender as Button;
                        if (b != null)
                        {
                            Literal c = (Literal)b.Parent.FindControl(string.Format("error{0}_lb", k.ToString()));
                            if (c != null)
                            {
                                c.Text = string.Format("Please add {0} category feed", feedcategory[i].ToString());
                            }
                        }
                    }
                }
                if (feedcategory[i].ToString().Substring(0, 2) == "Ro")
                {
                    //drymattersum =drymattersum+ Convert.ToDecimal(drymatter[i]);
                    crudefiber[i]    = crudefiber[i];
                    roenergysum     += Convert.ToDouble(energy[i]);
                    rocrudefibersum += Convert.ToDouble(crudefiber[i]);
                    roproteinsum    += Convert.ToDouble(protein[i]);
                    rocasum         += Convert.ToDouble(ca[i]);
                    ropsum          += Convert.ToDouble(p[i]);
                    rodrymattersum  += Convert.ToDouble(drymatter[i]);
                    ro_lb.Text       = feed[i].ToString();


                    int k = 1;
                    koefficentro = Convert.ToDouble(energychange["DRYMATTER"]) * Convert.ToDouble(ratio["ROPERCENT"]) / 100 * quantity / rodrymattersum;
                    for (int j = 0; j <= feedids.Count - 1; j++)
                    {
                        if (Convert.ToInt32(feedids[j]) == Convert.ToInt32(feedidss[i]))
                        {
                            k = j;
                        }
                    }
                    maxro = Convert.ToDouble(feedweights[k]);


                    if (maxro < koefficentro)
                    {
                        Button b = sender as Button;
                        if (b != null)
                        {
                            Literal c = (Literal)b.Parent.FindControl(string.Format("error{0}_lb", k.ToString()));
                            if (c != null)
                            {
                                c.Text = string.Format("Please add {0} category feed", feedcategory[i].ToString());
                            }
                        }
                    }
                }
                if (feedcategory[i].ToString().Substring(0, 2) == "Su")
                {
                    //drymattersum =drymattersum+ Convert.ToDecimal(drymatter[i]);
                    crudefiber[i]    = crudefiber[i];
                    suenergysum     += Convert.ToDouble(energy[i]);
                    sucrudefibersum += Convert.ToDouble(crudefiber[i]);
                    suproteinsum    += Convert.ToDouble(protein[i]);
                    sucasum         += Convert.ToDouble(ca[i]);
                    supsum          += Convert.ToDouble(p[i]);
                    sudrymattersum  += Convert.ToDouble(drymatter[i]);
                    su_lb.Text       = feed[i].ToString();


                    int k = 1;
                    koefficentsu = Convert.ToDouble(energychange["DRYMATTER"]) * Convert.ToDouble(ratio["SUPERCENT"]) / 100 * quantity / sudrymattersum;
                    for (int j = 0; j <= feedids.Count - 1; j++)
                    {
                        if (Convert.ToInt32(feedids[j]) == Convert.ToInt32(feedidss[i]))
                        {
                            k = j;
                        }
                    }
                    maxsu = Convert.ToDouble(feedweights[k]);


                    if (maxsu < koefficentsu)
                    {
                        Button b = sender as Button;
                        if (b != null)
                        {
                            Literal c = (Literal)b.Parent.FindControl(string.Format("error{0}_lb", k.ToString()));
                            if (c != null)
                            {
                                c.Text = string.Format("Please add {0} category feed", feedcategory[i].ToString());
                            }
                        }
                    }
                }
            }
            try
            {
                koefco       = ((Convert.ToDouble(ratio["COPERCENT"]) / 100) * coenergysum * Convert.ToDouble(energychange["DRYMATTER"]));
                koefficentco = Convert.ToDouble(energychange["DRYMATTER"]) * Convert.ToDouble(ratio["COPERCENT"]) / 100;

                co_energy.Text     = koefco.ToString();
                co_p.Text          = (koefficentco * copsum).ToString();
                co_ca.Text         = (koefficentco * cocasum).ToString();
                co_crudefiber.Text = (koefficentco * cocrudefibersum).ToString();
                co_protein.Text    = (koefficentco * coproteinsum).ToString();
                co_weight.Text     = Math.Round((koefficentco / codrymattersum), 2).ToString();


                koefro = Convert.ToDouble(energychange["DRYMATTER"]) * Convert.ToDouble(ratio["ROPERCENT"]) / 100;
                //ec_energy.Text = Math.Round(koefco, 2).ToString();
                ro_crudefiber.Text = (koefro * rocrudefibersum).ToString();
                ro_ca.Text         = (koefro * rocasum).ToString();;
                ro_energy.Text     = (koefro * roenergysum).ToString();
                ro_p.Text          = (koefro * ropsum).ToString();
                ro_protein.Text    = (koefro * roproteinsum).ToString();
                ro_weight.Text     = Math.Round((koefro / rodrymattersum), 2).ToString();


                ec_ca.Text         = energychange["CA"].ToString();
                ec_crudefiber.Text = energychange["CRUDEFIBER"].ToString();
                ec_protein.Text    = energychange["PROTEIN"].ToString();
                ec_energy.Text     = energychange["ENERGY"].ToString();
                ec_ca.Text         = energychange["CA"].ToString();
                ec_p.Text          = energychange["P"].ToString();



                koefsu = Convert.ToDouble(energychange["DRYMATTER"]) * Convert.ToDouble(ratio["SUPERCENT"]) / 100;
                //ec_energy.Text = Math.Round(koefco, 2).ToString();
                su_crudefiber.Text = (koefsu * sucrudefibersum).ToString();
                su_ca.Text         = (koefsu * sucasum).ToString();
                su_energy.Text     = (koefsu * suenergysum).ToString();
                su_p.Text          = (koefsu * supsum).ToString();
                su_protein.Text    = (koefsu * suproteinsum).ToString();
                if (sudrymattersum == 0)
                {
                    su_weight.Text = "0";
                    total_lb.Text  = string.Format("<tr><td>{0}</td><td>{1}</td></tr><tr><td>{2}</td><td>{3}</td></tr>", co_lb.Text, Convert.ToDouble(co_weight.Text) * quantity, ro_lb.Text, Convert.ToDouble(ro_weight.Text) * quantity);
                }
                else
                {
                    su_weight.Text = Math.Round((koefsu / sudrymattersum), 2).ToString();
                    total_lb.Text  = string.Format("<tr><td>{0}</td><td>{1}</td></tr><tr><td>{2}</td><td>{3}</td></tr><tr><td>{4}</td><td>{5}</td></tr>", co_lb.Text, Convert.ToDouble(co_weight.Text) * quantity, ro_lb.Text, Convert.ToDouble(ro_weight.Text) * quantity, su_lb.Text, Convert.ToDouble(su_weight.Text) * quantity);
                }



                oq_ca.Text      = Math.Round(((koefro * rocasum) + (koefficentco * cocasum) + (koefsu * sucasum) - Convert.ToDouble(energychange["CA"])), 3).ToString();
                oq_ca.ForeColor = System.Drawing.Color.Red;

                oq_energy.Text      = Math.Round(((koefro * roenergysum) + (koefficentco * coenergysum) + (koefsu * suenergysum) - Convert.ToDouble(energychange["ENERGY"])), 3).ToString();
                oq_energy.ForeColor = System.Drawing.Color.Red;

                oq_protein.Text      = Math.Round(((koefro * roproteinsum) + (koefficentco * coproteinsum) + (koefsu * suproteinsum) - Convert.ToDouble(energychange["PROTEIN"])), 3).ToString();
                oq_protein.ForeColor = System.Drawing.Color.Red;

                oq_crudefiber.Text      = Math.Round(((koefro * rocrudefibersum) + (koefficentco * cocrudefibersum) + (koefsu * sucrudefibersum) - Convert.ToDouble(energychange["CRUDEFIBER"])), 3).ToString();
                oq_crudefiber.ForeColor = System.Drawing.Color.Red;

                oq_p.Text      = Math.Round(((koefro * ropsum) + (koefficentco * copsum) + (koefsu * supsum) - Convert.ToDouble(energychange["P"])), 3).ToString();
                oq_p.ForeColor = System.Drawing.Color.Red;



                // ro_lbl.Text = Math.Round(koefro, 2).ToString();
                // co_energy.Text = "energy change " + Convert.ToDouble(energychange["ENERGY"]).ToString() + " COPERCENT " + (Convert.ToDouble(ratio["COPERCENT"]) / 100).ToString() + " energy sum "+ coenergysum.ToString() + " drymatter " + Convert.ToDouble(energychange["DRYMATTER"]).ToString();
            }
            catch
            {
                //  Label1.Text = new123;
                return;
            }
        }
    }
示例#33
0
        /// <summary> Adds the controls for this result viewer to the place holder on the main form </summary>
        /// <param name="MainPlaceHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form into which the the bulk of the result viewer's output is displayed</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles and sorted by serial hierarchy </returns>
        public override void Add_HTML(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Table_ResultsWriter.Add_HTML", "Rendering results in table view");
            }

            // If results are null, or no results, return empty string
            if ((PagedResults == null) || (ResultsStats == null) || (ResultsStats.Total_Items <= 0))
            {
                return;
            }

            // Get the text search redirect stem and (writer-adjusted) base url
            string textRedirectStem = Text_Redirect_Stem;
            string base_url         = RequestSpecificValues.Current_Mode.Base_URL;

            if (RequestSpecificValues.Current_Mode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)
            {
                base_url = RequestSpecificValues.Current_Mode.Base_URL + "l/";
            }

            // Start the results
            StringBuilder resultsBldr = new StringBuilder(5000);

            resultsBldr.AppendLine("<br />");
            resultsBldr.AppendLine("<table width=\"100%\">");

            // Start the header row and add the 'No.' part
            short?currentOrder = RequestSpecificValues.Current_Mode.Sort;

            if (RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Results)
            {
                RequestSpecificValues.Current_Mode.Sort = 0;
                resultsBldr.AppendLine("\t<tr valign=\"bottom\" align=\"left\">");
                resultsBldr.AppendLine("\t\t<td width=\"30px\"><span class=\"SobekTableSortText\"><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode).Replace("&", "&amp;") + "\"><strong>No.</strong></a></span></td>");
            }
            else
            {
                resultsBldr.AppendLine("\t<tr valign=\"bottom\" align=\"left\">\n\t\t<td>No.</td>");
            }

            // Add the title column
            RequestSpecificValues.Current_Mode.Sort = 1;
            resultsBldr.AppendLine("\t\t<td><span class=\"SobekTableSortText\"><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode).Replace("&", "&amp;") + "\"><strong>" + UI_ApplicationCache_Gateway.Translation.Get_Translation("Title", RequestSpecificValues.Current_Mode.Language) + "</strong></a></span></td>");

            // Add the date column
            RequestSpecificValues.Current_Mode.Sort = 10;
            resultsBldr.AppendLine("\t\t<td><span class=\"SobekTableSortText\"><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode).Replace("&", "&amp;") + "\"><strong>" + UI_ApplicationCache_Gateway.Translation.Get_Translation("Date", RequestSpecificValues.Current_Mode.Language) + "</strong></a></span></td>");
            RequestSpecificValues.Current_Mode.Sort = currentOrder;
            resultsBldr.AppendLine("\t</tr>");

            resultsBldr.AppendLine("\t<tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>");

            // Set the counter for these results from the page
            int page           = RequestSpecificValues.Current_Mode.Page.HasValue ? Math.Max(RequestSpecificValues.Current_Mode.Page.Value, ((ushort)1)) : 1;
            int result_counter = ((page - 1) * Results_Per_Page) + 1;
            int current_row    = 0;

            // Step through all the results
            foreach (iSearch_Title_Result titleResult in PagedResults)
            {
                bool multiple_title = titleResult.Item_Count > 1;

                // Always get the first item for things like the main link and thumbnail
                iSearch_Item_Result firstItemResult = titleResult.Get_Item(0);

                //// Is this restricted?
                //bool restricted_by_ip = false;
                //if ((titleResult.Item_Count == 1) && (firstItemResult.IP_Restriction_Mask > 0))
                //{
                //    int comparison = dbItem.IP_Range_Membership & base.current_user_mask;
                //    if (comparison == 0)
                //    {
                //        restricted_by_ip = true;
                //    }
                //}

                // Determine the internal link to the first (possibly only) item
                string internal_link = base_url + titleResult.BibID + "/" + firstItemResult.VID + textRedirectStem;

                // For browses, just point to the title
                if ((RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Aggregation) && (RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Browse_Info))
                {
                    internal_link = base_url + titleResult.BibID + textRedirectStem;
                }

                // Start this row
                if (multiple_title)
                {
                    resultsBldr.AppendLine("\t<tr valign=\"top\" onmouseover=\"this.className='tableRowHighlight'\" onmouseout=\"this.className='tableRowNormal'\" >");
                }
                else
                {
                    resultsBldr.AppendLine("\t<tr valign=\"top\" onmouseover=\"this.className='tableRowHighlight'\" onmouseout=\"this.className='tableRowNormal'\" onclick=\"window.location.href='" + internal_link + "';\" >");
                }


                // Add the counter as the first column
                resultsBldr.AppendLine("\t\t<td>" + result_counter + "</td>");

                // Add differently depending on the child row count
                if (!multiple_title)
                {
                    if (!String.IsNullOrEmpty(firstItemResult.Link))
                    {
                        resultsBldr.AppendLine("\t\t<td>" + firstItemResult.Title + " ( <a href=\"" + firstItemResult.Link + "\">external resource</a> | <a href=\"" + internal_link + "\">internal citation</a> )</td>");
                    }
                    else
                    {
                        resultsBldr.AppendLine("\t\t<td><a href=\"" + internal_link + "\">" + firstItemResult.Title + "</a></td>");
                    }
                    resultsBldr.AppendLine("\t\t<td>" + firstItemResult.PubDate + "</td></tr>");
                }
                else
                {
                    resultsBldr.AppendLine("\t\t<td colspan=\"2\">");

                    // Add this to the place holder
                    Literal thisLiteral = new Literal
                    {
                        Text = resultsBldr.ToString().Replace("&lt;role&gt;", "<i>").Replace("&lt;/role&gt;", "</i>")
                    };
                    MainPlaceHolder.Controls.Add(thisLiteral);
                    resultsBldr.Remove(0, resultsBldr.Length);

                    Add_Issue_Tree(MainPlaceHolder, titleResult, current_row, textRedirectStem, base_url);
                    resultsBldr.AppendLine("\t</td></tr>");
                }

                // Add a horizontal line
                resultsBldr.AppendLine("\t<tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>");

                // Increment the result counters
                result_counter++;
                current_row++;
            }

            // End this table
            resultsBldr.AppendLine("</table>");

            // Add this to the html table
            Literal mainLiteral = new Literal
            {
                Text = resultsBldr.ToString().Replace("&lt;role&gt;", "<i>").Replace("&lt;/role&gt;", "</i>")
            };

            MainPlaceHolder.Controls.Add(mainLiteral);
        }
示例#34
0
        /// <summary>
        /// Handles the RowDataBound event of the rGrid control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridViewRowEventArgs" /> instance containing the event data.</param>
        protected void rGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                int attributeId = ( int )rGrid.DataKeys[e.Row.RowIndex].Value;

                var attribute = Rock.Web.Cache.AttributeCache.Get(attributeId);
                var fieldType = FieldTypeCache.Get(attribute.FieldTypeId);

                Literal lCategories = e.Row.FindControl("lCategories") as Literal;
                if (lCategories != null)
                {
                    lCategories.Text = attribute.Categories.Select(c => c.Name).ToList().AsDelimited(", ");
                }

                Literal lEntityQualifier = e.Row.FindControl("lEntityQualifier") as Literal;
                if (lEntityQualifier != null)
                {
                    if (attribute.EntityTypeId.HasValue)
                    {
                        string entityTypeName = EntityTypeCache.Get(attribute.EntityTypeId.Value).FriendlyName;
                        if (!string.IsNullOrWhiteSpace(attribute.EntityTypeQualifierColumn))
                        {
                            lEntityQualifier.Text = string.Format("{0} where [{1}] = '{2}'", entityTypeName, attribute.EntityTypeQualifierColumn, attribute.EntityTypeQualifierValue);
                        }
                        else
                        {
                            lEntityQualifier.Text = entityTypeName;
                        }
                    }
                    else
                    {
                        lEntityQualifier.Text = "Global Attribute";
                    }
                }

                if (_displayValueEdit)
                {
                    Literal lValue = e.Row.FindControl("lValue") as Literal;
                    if (lValue != null)
                    {
                        AttributeValueService attributeValueService = new AttributeValueService(new RockContext());
                        var attributeValue = attributeValueService.GetByAttributeIdAndEntityId(attributeId, _entityId);
                        if (attributeValue != null && !string.IsNullOrWhiteSpace(attributeValue.Value))
                        {
                            lValue.Text = fieldType.Field.FormatValue(lValue, attribute.EntityTypeId, _entityId, attributeValue.Value, attribute.QualifierValues, true).EncodeHtml();
                        }
                        else
                        {
                            lValue.Text = string.Format("<span class='text-muted'>{0}</span>", fieldType.Field.FormatValue(lValue, attribute.EntityTypeId, _entityId, attribute.DefaultValue, attribute.QualifierValues, true).EncodeHtml());
                        }
                    }
                }
                else
                {
                    Literal lDefaultValue = e.Row.FindControl("lDefaultValue") as Literal;
                    if (lDefaultValue != null)
                    {
                        lDefaultValue.Text = fieldType.Field.FormatValueAsHtml(lDefaultValue, attribute.EntityTypeId, _entityId, attribute.DefaultValue, attribute.QualifierValues, true);
                    }
                }

                if (attribute.IsActive == false)
                {
                    e.Row.AddCssClass("is-inactive");
                }
            }
        }
        /// <summary>
        /// Displays a list of all already scheduled publishes for this item, ordered from most recent to furthest in time.
        /// </summary>
        private void BuildExistingSchedules()
        {
            IEnumerable <PublishSchedule> existingSchedules = _scheduledPublishRepo.GetSchedules(InnerItem.ID).ToList();

            if (existingSchedules.Any())
            {
                ExistingSchedulesDiv.Visible = false;
                foreach (var schedule in existingSchedules)
                {
                    DateTime time    = schedule.PublishDate;
                    Literal  timeLit = new Literal();
                    timeLit.Text = time.ToString(_culture);
                    ExistingSchedulesTable.Controls.Add(timeLit);

                    string  action    = schedule.Unpublish ? Constants.UNPUBLISH_TEXT : Constants.PUBLISH_TEXT;
                    Literal actionLit = new Literal();
                    actionLit.Text = action;
                    ExistingSchedulesTable.Controls.Add(actionLit);

                    string languages = schedule.TargetLanguages != null?
                                       string.Join(",", schedule.TargetLanguages.Select(x => x.Name)).TrimEnd(',') :
                                           Constants.NOT_APPLICABLE;

                    Literal languagesLit = new Literal();
                    languagesLit.Text = languages;
                    ExistingSchedulesTable.Controls.Add(languagesLit);


                    Literal versionLit = new Literal();
                    string  version;
                    if (schedule.ItemToPublish == null)
                    {
                        version = Constants.WEBSITE_PUBLISH_TEXT;
                    }
                    else
                    {
                        Item itemInVersion = schedule.ItemToPublish.Publishing.GetValidVersion(time, true, false);
                        if (itemInVersion != null)
                        {
                            version = itemInVersion.Version.Number.ToString();
                        }
                        else
                        {
                            version = Constants.NO_VALID_VERSION_TEXT;

                            languagesLit.Style.Add("color", "red");
                            actionLit.Style.Add("color", "red");
                            timeLit.Style.Add("color", "red");
                            versionLit.Style.Add("color", "red");
                        }
                    }
                    versionLit.Text = version;
                    ExistingSchedulesTable.Controls.Add(versionLit);
                }
            }
            else
            {
                ExistingSchedulesTable.Visible = false;
                ExistingSchedulesDiv.InnerHtml = Constants.NO_EXISTING_SCHEDULES_TEXT;
            }
        }
示例#36
0
    private void procede()
    {
        PortalSettings          ps       = new PortalSettings();
        int                     portalId = ps.PortalId;
        TabController           tc       = new TabController();
        DesktopModuleController DMC      = new DesktopModuleController();
        //string check = "";
        Dictionary <String, String> settings = null;
        TabController TC = new TabController();

        System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(Server.MapPath("DesktopModules/AIS/Installer/Modules.xml"));
        while (reader.Read())
        {
            if (reader.Name == "tab" && reader.HasAttributes)
            {
                TabInfo ti = TC.GetTabByName(reader.GetAttribute("name"), portalId);
                if (ti == null)
                {
                    if (reader.GetAttribute("parent") != null && reader.GetAttribute("parent") != "")
                    {
                        createPage(reader.GetAttribute("name"), getListPermissionsTab(reader.GetAttribute("name")), bool.Parse(reader.GetAttribute("visible")), bool.Parse(reader.GetAttribute("superTab")), reader.GetAttribute("parent"));
                    }
                    else
                    {
                        createPage(reader.GetAttribute("name"), getListPermissionsTab(reader.GetAttribute("name")), bool.Parse(reader.GetAttribute("visible")), bool.Parse(reader.GetAttribute("superTab")), "");
                    }
                    if
                    (reader.GetAttribute("dependency") != null && reader.GetAttribute("dependency") != "")
                    {
                        TC.DeleteTab(TC.GetTabByName(reader.GetAttribute("dependency"), portalId).TabID, portalId);
                        procede();
                        reader.Close();
                    }
                }
            }
            if (reader.Name == "module" && reader.HasAttributes)
            {
                if (DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName")) != null)
                {
                    DesktopModuleInfo dmi = DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"));
                    if (reader.AttributeCount > 2)
                    {
                        settings = new Dictionary <string, string>();
                        for (int i = 2; i < reader.AttributeCount; i = i + 2)
                        {
                            settings.Add(reader.GetAttribute(i), reader.GetAttribute(i + 1));
                        }
                    }
                    Label   lbl  = new Label();
                    Literal line = new Literal();
                    line.Text = "<br />";
                    TabInfo ti = new TabInfo();
                    ti.TabName = reader.GetAttribute("tab");
                    switch (checkPage(ti, DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"))))
                    {
                    case "OK":
                        break;

                    case "Page":

                        break;

                    case "Bin":
                        break;

                    default:
                        AddModuleToTab(tc.GetTabByName(ti.TabName, portalId), dmi, settings: settings);
                        break;
                    }
                }
            }
        }
        pnl_install.Visible = false;
        pnl_install_missing_files.Visible = false;
        pnl_manuel.Visible = true;
        pnl_fin.Visible    = true;
    }
        protected override void AttachChildControls()
        {
            int num2;
            int num3;

            this.litSurplusIntegral = (Literal)this.FindControl("litSurplusIntegral");
            this.litSumIntegral     = (Literal)this.FindControl("litSumIntegral");
            this.litStatus0         = (Literal)this.FindControl("litStatus0");
            this.litStatus1         = (Literal)this.FindControl("litStatus1");
            this.litStatus2         = (Literal)this.FindControl("litStatus2");
            this.littableList0      = (Literal)this.FindControl("littableList0");
            this.littableList1      = (Literal)this.FindControl("littableList1");
            this.littableList2      = (Literal)this.FindControl("littableList2");
            this.txtTotal           = (HtmlInputHidden)this.FindControl("txtTotal");
            this.txtShowTabNum      = (HtmlInputHidden)this.FindControl("txtShowTabNum");
            this.rptIntegarlDetail0 = (VshopTemplatedRepeater)this.FindControl("rptIntegarlDetail0");
            this.rptIntegarlDetail1 = (VshopTemplatedRepeater)this.FindControl("rptIntegarlDetail1");
            this.rptIntegarlDetail2 = (VshopTemplatedRepeater)this.FindControl("rptIntegarlDetail2");
            int num = 0;

            if (!int.TryParse(this.Page.Request.QueryString["page"], out num2))
            {
                num2 = 1;
            }
            if (!int.TryParse(this.Page.Request.QueryString["size"], out num3))
            {
                num3 = 10;
            }
            IntegralDetailQuery query         = new IntegralDetailQuery();
            MemberInfo          currentMember = MemberProcessor.GetCurrentMember();

            this.litSurplusIntegral.Text = currentMember.Points.ToString();
            this.litSumIntegral.Text     = Convert.ToInt32(MemberProcessor.GetIntegral(currentMember.UserId)).ToString();
            query.UserId    = currentMember.UserId;
            query.PageIndex = num2;
            query.PageSize  = num3;
            if (int.TryParse(this.Page.Request.QueryString["IntegralSourceType"], out num))
            {
                if (num == 0)
                {
                    query.IntegralSourceType = num;
                    DbQueryResult integralDetail = MemberProcessor.GetIntegralDetail(query);
                    this.rptIntegarlDetail0.DataSource = integralDetail.Data;
                    this.rptIntegarlDetail0.DataBind();
                    this.litStatus0.Text    = "class=\"active\"";
                    this.litStatus1.Text    = "";
                    this.litStatus2.Text    = "";
                    this.littableList0.Text = "style=\"display: block;\"";
                    this.littableList1.Text = "style=\"display: none;\"";
                    this.littableList2.Text = "style=\"display: none;\"";
                    this.txtTotal.SetWhenIsNotNull(integralDetail.TotalRecords.ToString());
                }
                else if (num == 1)
                {
                    query.IntegralSourceType = num;
                    DbQueryResult result2 = MemberProcessor.GetIntegralDetail(query);
                    this.rptIntegarlDetail1.DataSource = result2.Data;
                    this.rptIntegarlDetail1.DataBind();
                    this.litStatus0.Text    = "";
                    this.litStatus1.Text    = "class=\"active\"";
                    this.litStatus2.Text    = "";
                    this.littableList0.Text = "style=\"display: none ;\"";
                    this.littableList1.Text = "style=\"display:block;\"";
                    this.littableList2.Text = "style=\"display: none;\"";
                    this.txtTotal.SetWhenIsNotNull(result2.TotalRecords.ToString());
                }
                else
                {
                    query.IntegralSourceType = num;
                    DbQueryResult result3 = MemberProcessor.GetIntegralDetail(query);
                    this.rptIntegarlDetail2.DataSource = result3.Data;
                    this.rptIntegarlDetail2.DataBind();
                    this.litStatus0.Text    = "";
                    this.litStatus1.Text    = "";
                    this.litStatus2.Text    = "class=\"active\"";
                    this.littableList0.Text = "style=\"display: none ;\"";
                    this.littableList1.Text = "style=\"display:none;\"";
                    this.littableList2.Text = "style=\"display: block;\"";
                    this.txtTotal.SetWhenIsNotNull(result3.TotalRecords.ToString());
                }
            }
            PageTitle.AddSiteNameTitle("积分明细");
        }
示例#38
0
    private void BindEquInfo()
    {
        new ResResourceService();
        EquEquipmentTypeService equEquipmentTypeService = new EquEquipmentTypeService();
        EquEquipment            byId = this.equSer.GetById(this.id);

        this.lblEquCode.Text = byId.EquCode;
        this.lblEquName.Text = byId.EquName;
        EquEquipmentType byId2 = equEquipmentTypeService.GetById(byId.TypeId);

        if (byId2 != null)
        {
            this.lblEquTypeName.Text = byId2.Name;
        }
        if (byId.SupplierId.HasValue)
        {
            XPMBasicContactCorpService xPMBasicContactCorpService = new XPMBasicContactCorpService();
            XPMBasicContactCorp        byId3 = xPMBasicContactCorpService.GetById(byId.SupplierId.Value);
            if (byId3 != null)
            {
                this.lblCorpName.Text = byId3.CorpName;
            }
        }
        this.lblFactoryNumber.Text         = byId.FactoryNumber;
        this.lblFactoryDate.Text           = this.ConvertToString(byId.FactoryDate);
        this.lblPurchaseDate.Text          = this.ConvertToString(byId.PurchaseDate);
        this.lblDepreciationRate.Text      = byId.DepreciationRate.ToString("0.000");
        this.lblPeriodicVertification.Text = byId.PeriodicVertification;
        this.lblDurableYear.Text           = byId.DurableYear;
        this.lblPurchasePrice.Text         = byId.PurchasePrice.ToString("0.000");
        this.lblState.Text       = this.GetStateOrProperty("EquState", byId.State);
        this.lblEquProperty.Text = this.GetStateOrProperty("EquProperty", byId.EquProperty);
        this.lblReceiptNo.Text   = byId.ReceiptNo;
        if (equEquipmentTypeService.IsShip(byId.TypeId))
        {
            this.trShip.Style["Display"] = "Block";
            this.lblShipLength.Text      = byId.ShipLength;
            this.lblShipWidth.Text       = byId.ShipWidth;
            this.lblShipCapacity.Text    = byId.ShipCapaticy;
            EquShipTechnicalParasService equShipTechnicalParasService = new EquShipTechnicalParasService();
            System.Collections.Generic.IList <EquShipTechnicalParas> equShipTechParasByEquId = equShipTechnicalParasService.GetEquShipTechParasByEquId(this.id);
            if (equShipTechParasByEquId == null || equShipTechParasByEquId.Count <= 0)
            {
                goto IL_352;
            }
            if (equShipTechParasByEquId.Count == 1)
            {
                this.lblOtherShipInfo.Text = equShipTechParasByEquId.First <EquShipTechnicalParas>().OtherShipInfo;
            }
            int   num   = 0;
            Label label = null;
            using (System.Collections.Generic.IEnumerator <EquShipTechnicalParas> enumerator = equShipTechParasByEquId.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    EquShipTechnicalParas current = enumerator.Current;
                    if (num == 0)
                    {
                        this.lblOtherShipInfo.Text = string.Format("参数{0}:   {1}", (num + 1).ToString(), current.OtherShipInfo);
                        label = (this.plOtherShips.FindControl("lblOtherShipInfo") as Label);
                    }
                    else
                    {
                        Literal literal = new Literal();
                        literal.Text = "<br />";
                        this.plOtherShips.Controls.Add(literal);
                        Label label2 = new Label();
                        label2.ID   = label.ID + num.ToString();
                        label2.Text = string.Format("参数{0}:   {1}", num + 1, current.OtherShipInfo);
                        this.plOtherShips.Controls.Add(label2);
                    }
                    num++;
                }
                goto IL_352;
            }
        }
        this.trShip.Style["Display"] = "None";
IL_352:
        this.lblMiddleInspectDate.Text = this.ConvertToString(byId.MiddleInspectDate);
        this.lblYearInspectDate.Text   = this.ConvertToString(byId.YearInspectDate);
        this.lblOtherCredentials.Text  = byId.OtherCredentials;
        this.lblAnnex.Text             = FileView.FilesBind(1901, byId.Id);
        this.lblNotes.Text             = byId.Note;
    }
示例#39
0
        protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType.Equals(DataControlRowType.Header))
            {
                #region Create Item Header
                bool bSort = false;
                int  i     = 0;
                for (i = 0; i < GridView1.Columns.Count; i++)
                {
                    if (ViewState["sort"].Equals(GridView1.Columns[i].SortExpression))
                    {
                        bSort = true;
                        break;
                    }
                }
                if (bSort)
                {
                    foreach (System.Web.UI.Control c in e.Row.Controls[i].Controls)
                    {
                        if (c.GetType().ToString().Equals("System.Web.UI.WebControls.DataControlLinkButton"))
                        {
                            if (ViewState["direction"].Equals("ASC"))
                            {
                                ((LinkButton)c).Text += "<img border=0 src='" + ((DataSet)Application["xmlconfig"]).Tables["imgAsc"].Rows[0]["img"].ToString() + "'>";
                            }
                            else
                            {
                                ((LinkButton)c).Text += "<img border=0 src='" + ((DataSet)Application["xmlconfig"]).Tables["imgDesc"].Rows[0]["img"].ToString() + "'>";
                            }
                        }
                    }
                }
                #endregion
            }
            else if (e.Row.RowType.Equals(DataControlRowType.Pager))
            {
                TableCell   tbc      = e.Row.Cells[0];
                Label       lblPrev  = null;
                Label       lblNext  = null;
                ImageButton lbtnPrev = null;
                ImageButton lbtnNext = null;

                #region find and store Previous and Next Page
                TableRow tbr = (TableRow)tbc.Controls[0].Controls[0];
                foreach (System.Web.UI.Control c in tbr.Controls)
                {
                    if (c.GetType().ToString().Equals("System.Web.UI.WebControls.Label"))
                    {
                        Label lbl = (Label)c;
                        if (lbl.Text.IndexOf("P") != -1)
                        {
                            lblPrev      = lbl;
                            lblPrev.Text = string.Empty;
                        }
                        if (lbl.Text.IndexOf("N") != -1)
                        {
                            lblNext      = lbl;
                            lblNext.Text = string.Empty;
                        }
                    }
                    if (c.Controls[0].GetType().ToString().Equals("System.Web.UI.WebControls.DataControlImageButton"))
                    {
                        ImageButton lbtn = (ImageButton)c.Controls[0];
                        if (lbtn.AlternateText.IndexOf("P") != -1)
                        {
                            lbtnPrev          = lbtn;
                            lbtnPrev.ImageUrl = "~/images/prev.gif";
                        }
                        if (lbtn.AlternateText.IndexOf("N") != -1)
                        {
                            lbtnNext          = lbtn;
                            lbtnNext.ImageUrl = "~/images/next.gif";
                        }
                    }
                }
                #endregion

                #region render new pager
                tbc.Text = string.Empty;
                Literal lblPager = new Literal();
                lblPager.Text = "<TABLE border='0' width='100%' cellpadding='0' cellspacing='0'><TR><TD width='30%' valign='middle'>";
                tbc.Controls.Add(lblPager);

                Label lblTotalRecord = new Label();
                lblTotalRecord.Attributes.Add("class", "label_h");
                lblTotalRecord.Text = "พบข้อมูล " + txthTotalRecord.Value.ToString() + " รายการ.";
                tbc.Controls.Add(lblTotalRecord);

                lblPager      = new Literal();
                lblPager.Text = "</TD><TD width='30%' align='center' valign='middle'>";
                tbc.Controls.Add(lblPager);

                DropDownList cboPerPage = new DropDownList();
                cboPerPage.ID = "cboPerPage";

                DataTable entries;
                if ((DataSet)Application["xmlconfig"] == null)
                {
                    return;
                }
                else
                {
                    entries = ((DataSet)Application["xmlconfig"]).Tables["RecordPerPage"];
                }

                for (int i = 0; i < entries.Rows.Count; i++)
                {
                    cboPerPage.Items.Add(new ListItem(entries.Rows[i][0].ToString(), entries.Rows[i][1].ToString()));
                }

                if (cboPerPage.Items.FindByValue(strRecordPerPage) != null)
                {
                    cboPerPage.Items.FindByValue(strRecordPerPage).Selected = true;
                }

                cboPerPage.AutoPostBack          = true;
                cboPerPage.SelectedIndexChanged += new System.EventHandler(cboPerPage_SelectedIndexChanged);
                tbc.Controls.Add(cboPerPage);

                lblPager      = new Literal();
                lblPager.Text = "&nbsp;&nbsp;&nbsp;<span class=\"label_h\">รายการ/หน้า</span></TD><TD width='40%' align='right' valign='middle'>";
                tbc.Controls.Add(lblPager);

                if (lblPrev != null)
                {
                    tbc.Controls.Add(lblPrev);
                }
                else if (lbtnPrev != null)
                {
                    tbc.Controls.Add(lbtnPrev);
                }

                lblPager      = new Literal();
                lblPager.Text = "&nbsp;&nbsp;&nbsp;<span class=\"label_h\">หน้าที่: </span>";
                tbc.Controls.Add(lblPager);

                TextBox txtPage = new TextBox();
                txtPage.AutoPostBack = false;
                txtPage.ID           = "txtPage";
                txtPage.Width        = System.Web.UI.WebControls.Unit.Parse("30px");
                txtPage.Attributes.Add("class", "text1");
                txtPage.Style.Add("text-align", "right");
                int nCurrentPage = (GridView1.PageIndex + 1);
                txtPage.Text = nCurrentPage.ToString();//strPageNo;
                txtPage.Attributes.Add("onkeypress", "javascript: return checkKeyCode(event);");
                txtPage.Attributes.Add("onkeyup", "javasctipt: checkInt(this, " + GridView1.PageCount.ToString() + ");");
                tbc.Controls.Add(txtPage);

                lblPager      = new Literal();
                lblPager.Text = "<span class=\"label_h\"> จากทั้งหมด " + GridView1.PageCount.ToString() + "&nbsp;&nbsp;</span>";
                tbc.Controls.Add(lblPager);

                lblPager      = new Literal();
                lblPager.Text = "&nbsp;&nbsp;";
                tbc.Controls.Add(lblPager);

                ImageButton imgGo = new ImageButton();
                imgGo.ID       = "imgGo";
                imgGo.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgGo"].Rows[0]["img"].ToString();
                imgGo.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgGo"].Rows[0]["title"].ToString());
                imgGo.Attributes.Add("onclick", "javascript: return checkPage(" + GridView1.PageCount.ToString() + ",'กรุณาระบุข้อมูลให้ถูกต้อง.|||ctl00$ContentPlaceHolder2$GridView1$ctl01$txtPage');");
                imgGo.Click += new System.Web.UI.ImageClickEventHandler(this.imgGo_Click);
                tbc.Controls.Add(imgGo);

                lblPager      = new Literal();
                lblPager.Text = "&nbsp;&nbsp;&nbsp;";
                tbc.Controls.Add(lblPager);

                if (lblNext != null)
                {
                    tbc.Controls.Add(lblNext);
                }
                else if (lbtnNext != null)
                {
                    tbc.Controls.Add(lbtnNext);
                }

                lblPager      = new Literal();
                lblPager.Text = "</TD></TR></TABLE>";
                tbc.Controls.Add(lblPager);

                #endregion
            }
        }
示例#40
0
        protected override void AttachChildControls()
        {
            int num;
            int num2;
            int num3;

            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.keyWord       = this.Page.Request.QueryString["keyWord"];
            this.imgUrl        = (HiImage)this.FindControl("imgUrl");
            this.litContent    = (Literal)this.FindControl("litContent");
            this.litItemParams = (Literal)this.FindControl("litItemParams");
            this.rptProducts   = (VshopTemplatedRepeater)this.FindControl("rptCutDownProducts");
            this.txtTotal      = (HtmlInputHidden)this.FindControl("txtTotal");
            this.rptCategories = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            if (this.rptCategories != null)
            {
                IList <CategoryInfo> maxSubCategories = CategoryBrowser.GetMaxSubCategories(this.categoryId, 0x3e8);
                this.rptCategories.DataSource = maxSubCategories;
                this.rptCategories.DataBind();
            }
            if (!int.TryParse(this.Page.Request.QueryString["page"], out num))
            {
                num = 1;
            }
            if (!int.TryParse(this.Page.Request.QueryString["size"], out num2))
            {
                num2 = 10;
            }
            this.rptProducts.DataSource = ProductBrowser.GetCutDownProducts(new int?(this.categoryId), this.keyWord, num, num2, out num3, true);
            this.rptProducts.DataBind();
            this.txtTotal.SetWhenIsNotNull(num3.ToString());
            PageTitle.AddSiteNameTitle("砍价列表页");

            #region 微信分享内容配置
            SiteSettings     masterSettings     = SettingsManager.GetMasterSettings(false);
            DistributorsInfo userIdDistributors = new DistributorsInfo();
            userIdDistributors = DistributorsBrower.GetUserIdDistributors(base.referralId);
            if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
            {
                PageTitle.AddSiteNameTitle(userIdDistributors.StoreName);
            }
            string str3 = "";
            if (!string.IsNullOrEmpty(masterSettings.ShopHomePic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.ShopHomePic;
            }
            string str4 = "";
            string str5 = (userIdDistributors == null) ? masterSettings.SiteName : userIdDistributors.StoreName;
            if (!string.IsNullOrEmpty(masterSettings.DistributorBackgroundPic))
            {
                str4 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[] { '|' })[0];
            }
            string strDes = masterSettings.ShopHomeDescription;
            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.BrandShow)
            {
                strDes = "正品低价砍回家,澳洲尖货就在考拉萌购!";
            }

            this.litItemParams.Text = str3 + "|" + masterSettings.ShopHomeName + "|" + strDes + "$";
            this.litItemParams.Text = string.Concat(new object[] { this.litItemParams.Text, str4, "|好店推荐之", str5, "商城|" + strDes + "|", HttpContext.Current.Request.Url });
            #endregion
        }
示例#41
0
        public void bindReplaceInfo()
        {
            int         replaceId   = this.Page.Request["replaceId"].ToInt(0);
            ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId);

            if (replaceInfo == null)
            {
                this.ShowMsg("换货信息错误!", false);
            }
            else
            {
                OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(replaceInfo.OrderId);
                HiddenField hiddenField = this.hidReplaceStatus;
                int         num         = (int)replaceInfo.HandleStatus;
                hiddenField.Value = num.ToString();
                if (orderInfo == null)
                {
                    this.ShowMsg("错误的订单信息!", false);
                }
                else
                {
                    if (string.IsNullOrEmpty(replaceInfo.SkuId))
                    {
                        this.listPrducts.DataSource = orderInfo.LineItems.Values;
                    }
                    else
                    {
                        Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>();
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            if (value.SkuId == replaceInfo.SkuId)
                            {
                                dictionary.Add(value.SkuId, value);
                            }
                        }
                        this.listPrducts.DataSource = dictionary.Values;
                    }
                    this.txtAdminRemark.Text = replaceInfo.AdminRemark;
                    this.listPrducts.DataBind();
                    this.litOrderId.Text      = orderInfo.PayOrderId;
                    this.litOrderTotal.Text   = orderInfo.GetTotal(false).F2ToString("f2");
                    this.litRefundReason.Text = replaceInfo.ReplaceReason;
                    this.litRemark.Text       = replaceInfo.UserRemark;
                    Literal literal = this.litReturnQuantity;
                    num          = replaceInfo.Quantity;
                    literal.Text = num.ToString();
                    string userCredentials = replaceInfo.UserCredentials;
                    if (!string.IsNullOrEmpty(userCredentials))
                    {
                        string[] array = userCredentials.Split('|');
                        userCredentials = "";
                        string[] array2 = array;
                        foreach (string str in array2)
                        {
                            userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str);
                        }
                        this.litImageList.Text = userCredentials;
                    }
                    else
                    {
                        this.divCredentials.Visible = false;
                    }
                    if (replaceInfo.HandleStatus == ReplaceStatus.Applied)
                    {
                        this.btnAcceptReplace.Visible = true;
                        this.btnRefuseReplace.Visible = true;
                    }
                    if (replaceInfo.HandleStatus != 0)
                    {
                        this.txtAdminCellPhone.Visible   = false;
                        this.txtAdminShipAddress.Visible = false;
                        this.txtAdminShipTo.Visible      = false;
                        this.litAdminCellPhone.Visible   = true;
                        this.litAdminShipAddrss.Visible  = true;
                        this.litAdminShipTo.Visible      = true;
                        this.litAdminCellPhone.Text      = replaceInfo.AdminCellPhone;
                        this.litAdminShipTo.Text         = replaceInfo.AdminShipTo;
                        this.litAdminShipAddrss.Text     = replaceInfo.AdminShipAddress;
                    }
                    else
                    {
                        ShippersInfo defaultGetGoodsShipperBysupplierId = SalesHelper.GetDefaultGetGoodsShipperBysupplierId(orderInfo.SupplierId);
                        if (defaultGetGoodsShipperBysupplierId != null)
                        {
                            Literal literal2 = this.litAdminShipAddrss;
                            TextBox textBox  = this.txtAdminShipAddress;
                            string  text3    = literal2.Text = (textBox.Text = RegionHelper.GetFullRegion(defaultGetGoodsShipperBysupplierId.RegionId, " ", true, 0) + " " + defaultGetGoodsShipperBysupplierId.Address);
                            Literal literal3 = this.litAdminShipTo;
                            TextBox textBox2 = this.txtAdminShipTo;
                            text3 = (literal3.Text = (textBox2.Text = defaultGetGoodsShipperBysupplierId.ShipperName));
                            Literal literal4 = this.litAdminCellPhone;
                            TextBox textBox3 = this.txtAdminCellPhone;
                            text3 = (literal4.Text = (textBox3.Text = defaultGetGoodsShipperBysupplierId.CellPhone));
                        }
                    }
                    if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery)
                    {
                        this.btnViewUserLogistic.Visible = true;
                        AttributeCollection attributes = this.btnViewUserLogistic.Attributes;
                        num = replaceInfo.ReplaceId;
                        attributes.Add("replaceid", num.ToString());
                    }
                    if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced)
                    {
                        this.btnViewMallLogistic.Visible = true;
                        AttributeCollection attributes2 = this.btnViewMallLogistic.Attributes;
                        num = replaceInfo.ReplaceId;
                        attributes2.Add("replaceid", num.ToString());
                    }
                    string str2 = string.IsNullOrEmpty(orderInfo.RealName) ? "" : (orderInfo.RealName.Replace("\n\r", "").Replace("\n", "").Replace("\r", "") + " (" + (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone) + ")");
                    str2 = str2 + orderInfo.ShippingRegion + " " + orderInfo.Address;
                    this.litUserAddress.Text = str2;
                    this.txtStatus.Text      = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 0);
                    Literal literal5 = this.txtAfterSaleId;
                    num           = replaceInfo.ReplaceId;
                    literal5.Text = num.ToString();
                }
            }
        }
示例#42
0
        /// <summary>
        /// Handles the RowDataBound event of the gGroupMembers control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param>
        public void gList_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                BenevolenceRequest benevolenceRequest = e.Row.DataItem as BenevolenceRequest;
                if (benevolenceRequest != null)
                {
                    Literal lName = e.Row.FindControl("lName") as Literal;
                    if (lName != null)
                    {
                        if (benevolenceRequest.RequestedByPersonAlias != null)
                        {
                            lName.Text = string.Format("<a href=\"{0}\">{1}</a>", ResolveUrl(string.Format("~/Person/{0}", benevolenceRequest.RequestedByPersonAlias.PersonId)), benevolenceRequest.RequestedByPersonAlias.Person.FullName ?? string.Empty);
                        }
                        else
                        {
                            lName.Text = string.Format("{0} {1}", benevolenceRequest.FirstName, benevolenceRequest.LastName);
                        }
                    }

                    Literal lResults = e.Row.FindControl("lResults") as Literal;
                    if (lResults != null)
                    {
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.Append("<div class='col-md-12'>");
                        foreach (BenevolenceResult result in benevolenceRequest.BenevolenceResults)
                        {
                            if (result.Amount != null)
                            {
                                stringBuilder.Append(string.Format("<div class='row'>{0} ({1}{2:0.00})</div>", result.ResultTypeValue, GlobalAttributesCache.Value("CurrencySymbol"), result.Amount));
                            }
                            else
                            {
                                stringBuilder.Append(string.Format("<div class='row'>{0}</div>", result.ResultTypeValue));
                            }
                        }

                        stringBuilder.Append("</div>");
                        lResults.Text = stringBuilder.ToString();
                    }

                    HighlightLabel hlStatus = e.Row.FindControl("hlStatus") as HighlightLabel;
                    if (hlStatus != null)
                    {
                        switch (benevolenceRequest.RequestStatusValue.Value)
                        {
                        case "Approved":
                            hlStatus.Text      = "Approved";
                            hlStatus.LabelType = LabelType.Success;
                            return;

                        case "Denied":
                            hlStatus.Text      = "Denied";
                            hlStatus.LabelType = LabelType.Danger;
                            return;

                        case "Pending":
                            hlStatus.Text      = "Pending";
                            hlStatus.LabelType = LabelType.Default;
                            return;
                        }
                    }
                }
            }
        }
示例#43
0
    protected void LI_Blocs_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        try
        {
            News      news = DataMapping.GetNews_EN(Request.QueryString["newsid"]);
            News.Bloc bloc = (News.Bloc)e.Item.DataItem;

            string add = "" + Request.QueryString["add"];
            if (bloc == null)
            {
                return;
            }
            if (Request.QueryString["nbfiles"] != "" && Request.QueryString["nbfiles"] != null)
            {
                bloc.type = "BlocFiles";
            }



            var panel = e.Item.FindControl("Panel1") as Panel;
            panel.CssClass = panel.CssClass + " " + bloc.type + " " + style;
            Panel pnl_content = (Panel)e.Item.FindControl("pnl_content");
            if (bloc.type.Contains("Video"))
            {
                pnl_content.CssClass += " videoContainer";
            }

            var image = e.Item.FindControl("Image1") as Image;
            image.ImageUrl = bloc.photo;
            image.Visible  = image.ImageUrl != "" && image.ImageUrl != Const.no_image;

            HyperLink hlk = (HyperLink)e.Item.FindControl("hlk_modif");
            hlk.NavigateUrl = Functions.UrlAddParam(Globals.NavigateURL(), "edit", "true");
            hlk.NavigateUrl = Functions.UrlAddParam(hlk.NavigateUrl, "newsid", Request.QueryString["newsid"]);
            hlk.NavigateUrl = Functions.UrlAddParam(hlk.NavigateUrl, "blocid", bloc.id);



            HiddenField hfd_blocid = (HiddenField)e.Item.FindControl("hfd_blocid");
            hfd_blocid.Value = bloc.id;


            LinkButton ibt_up   = (LinkButton)e.Item.FindControl("ibt_up");
            LinkButton ibt_down = (LinkButton)e.Item.FindControl("ibt_down");
            if (HasPermission())
            {
                Panel pnl = (Panel)e.Item.FindControl("pnl_modif");
                pnl.Visible = true;


                ibt_up.Visible = bloc.ord > 10 && (Request.QueryString["edit"] == "" || Request.QueryString["edit"] == null) && (Request.QueryString["add"] == "" || Request.QueryString["add"] == null) && (Request.QueryString["delete"] == "" || Request.QueryString["delete"] == null);

                ibt_down.Visible = bloc.ord < 10 * (news.GetListBlocs().Count) && (Request.QueryString["edit"] == "" || Request.QueryString["edit"] == null) && (Request.QueryString["add"] == "" || Request.QueryString["add"] == null) && (Request.QueryString["delete"] == "" || Request.QueryString["delete"] == null);
            }

            var             image2   = e.Item.FindControl("Image2") as Image;
            TextBox         tbx      = (TextBox)e.Item.FindControl("tbx_contenu");
            RadioButtonList rbl_type = (RadioButtonList)e.Item.FindControl("rbl_type");

            foreach (ListItem li in rbl_type.Items)
            {
                if ("Bloc" + li.Value == bloc.type)
                {
                    li.Selected = true;
                }
            }

            image2.ImageUrl = bloc.photo;
            image2.Visible  = image2.ImageUrl != "" && image2.ImageUrl != Const.no_image;

            string edit = ("" + Request.QueryString["edit"]);

            var Panel2 = e.Item.FindControl("Panel2") as Panel;
            if (edit == "true" || add == "true")
            {
                panel.Visible  = false;
                Panel2.Visible = true;
                hlk.Visible    = false;
            }
            string supp = ("" + Request.QueryString["delete"]);
            if (supp == "true")
            {
                pnl_delete.Visible = true;
                hlk.Visible        = false;
            }

            int cric = Functions.CurrentCric;



            Label      contenu    = (Label)e.Item.FindControl("lbl_contenu");
            Label      lbl_img    = (Label)e.Item.FindControl("lbl_img");
            FileUpload ful        = (FileUpload)e.Item.FindControl("ful_img");
            Button     btn_upload = (Button)e.Item.FindControl("btn_upload");
            Panel      pnl_links  = (Panel)e.Item.FindControl("pnl_links");
            Panel      pnl_files  = (Panel)e.Item.FindControl("pnl_files");
            Panel      pnl_video  = (Panel)e.Item.FindControl("pnl_video");



            switch (bloc.type)
            {
            case "BlocNoPhoto":
                lbl_img.Visible    = false;
                contenu.Visible    = true;
                ful.Visible        = false;
                btn_upload.Visible = false;
                image2.Visible     = false;
                tbx.Visible        = true;
                break;

            case "BlocPhoto":
                lbl_img.Visible    = true;
                contenu.Visible    = false;
                ful.Visible        = true;
                btn_upload.Visible = true;
                tbx.Visible        = false;
                image2.Visible     = true;
                break;

            case "BlocLinks":
                lbl_img.Visible    = false;
                contenu.Visible    = false;
                ful.Visible        = false;
                btn_upload.Visible = false;
                image2.Visible     = false;
                tbx.Visible        = false;
                pnl_links.Visible  = true;
                break;

            case "BlocFiles":
                lbl_img.Visible    = false;
                contenu.Visible    = false;
                ful.Visible        = false;
                btn_upload.Visible = false;
                image2.Visible     = false;
                tbx.Visible        = false;
                pnl_files.Visible  = true;
                break;

            case "BlocVideo":
                lbl_img.Visible    = false;
                contenu.Visible    = false;
                ful.Visible        = false;
                btn_upload.Visible = false;
                image2.Visible     = false;
                tbx.Visible        = false;
                pnl_video.Visible  = true;
                break;

            default:
                lbl_img.Visible    = true;
                contenu.Visible    = true;
                ful.Visible        = true;
                btn_upload.Visible = true;
                image2.Visible     = true;
                tbx.Visible        = true;
                break;
            }



            DropDownList ddl_target1 = (DropDownList)e.Item.FindControl("ddl_target1");
            DropDownList ddl_target2 = (DropDownList)e.Item.FindControl("ddl_target2");
            DropDownList ddl_target3 = (DropDownList)e.Item.FindControl("ddl_target3");
            DropDownList ddl_target4 = (DropDownList)e.Item.FindControl("ddl_target4");

            BindDDL(ddl_target1);
            BindDDL(ddl_target2);
            BindDDL(ddl_target3);
            BindDDL(ddl_target4);



            if (bloc.type == "BlocVideo" && bloc.content != null)
            {
                Label Texte1 = (Label)e.Item.FindControl("Texte1");
                Video video  = new Video();
                video       = (Video)Functions.Deserialize(bloc.content, video.GetType());
                Texte1.Text = video.getLink();
                TextBox tbx_urlYT = (TextBox)e.Item.FindControl("tbx_urlYT");
                tbx_urlYT.Text = video.Url;
            }

            if (bloc.type == "BlocLinks" && bloc.content != null)
            {
                Label       Texte1 = (Label)e.Item.FindControl("Texte1");
                List <Link> links  = new List <Link>();
                links       = (List <Link>)Functions.Deserialize(bloc.content, links.GetType());
                Texte1.Text = createListLinks(links);
                for (int i = 0; i < links.Count; i++)
                {
                    TextBox tbx_link = (TextBox)e.Item.FindControl("tbx_link" + (i + 1));
                    tbx_link.Text = links.ElementAt(i).Url;
                    DropDownList ddl = (DropDownList)e.Item.FindControl("ddl_target" + (i + 1));
                    ddl.SelectedIndex = links.ElementAt(i).Target == "" ? 0 : 1;
                    TextBox tbx_texte = (TextBox)e.Item.FindControl("tbx_text" + (i + 1));
                    tbx_texte.Text = links.ElementAt(i).Texte;
                }
            }
            if (bloc.type == "BlocFiles" && bloc.content != null)
            {
                try
                {
                    Label           Texte1 = (Label)e.Item.FindControl("Texte1");
                    List <AIS_File> files  = new List <AIS_File>();
                    if (bloc.content != null && bloc.content != "")
                    {
                        files = (List <AIS_File>)Functions.Deserialize(bloc.content, files.GetType());
                    }

                    //if (hfd_files.Value != "")
                    //    files = (List<AIS_File>) Functions.Deserialize(hfd_files.Value, files.GetType());



                    Panel pnl_filesUploaded = (Panel)e.Item.FindControl("pnl_filesUploaded");


                    #region Edit mode

                    if (files.Count > 0)
                    {
                        if (hfd_files.Value == "")
                        {
                            hfd_files.Value = bloc.content;
                        }
                        GridView gvw_filesUploaded = (GridView)e.Item.FindControl("gvw_filesUploaded");
                        gvw_filesUploaded.DataSource = files;
                        gvw_filesUploaded.DataBind();
                    }



                    #endregion Edit mode

                    #region Display mode

                    Texte1.Text = createListFile(files);

                    #endregion Display mode



                    btn_upload.Text = "Changer l'image";
                }
                catch (Exception ee)
                {
                    Functions.Error(ee);
                }
            }

            LinkButton lbt_delete = (LinkButton)e.Item.FindControl("lbt_delete");
            lbt_delete.CommandArgument = bloc.id;

            String  Stringscript = "<script> CKEDITOR.replace('" + tbx.ClientID + "', { uiColor: '#CCEAEE'});</script> ";
            Literal script       = (Literal)e.Item.FindControl("script");
            script.Text = Stringscript;
        }
        catch (Exception ee)
        {
            Functions.Error(ee);
        }
    }
示例#44
0
        protected void grdSecurityGroups_OnDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DropDownList ddl        = (DropDownList)e.Row.FindControl("ddlPrivacySettings");
                HiddenField  hf         = (HiddenField)e.Row.FindControl("hfPropertyURI");
                Label        items      = (Label)e.Row.FindControl("lblItems");
                Image        lockimage  = (Image)e.Row.FindControl("imgLock");
                Image        blankimage = (Image)e.Row.FindControl("imgBlank");
                SecurityItem si         = (SecurityItem)e.Row.DataItem;
                LinkButton   lb         = (LinkButton)e.Row.FindControl("lbUpdate");
                Literal      litSetting = (Literal)e.Row.FindControl("litSetting");

                string objecttype = string.Empty;

                items.Text = si.ItemCount.ToString();

                if (!si.CanEdit)
                {
                    lockimage.Visible  = true;
                    blankimage.Visible = true;
                }

                ddl.DataSource     = this.Dropdown;
                ddl.DataTextField  = "Text";
                ddl.DataValueField = "Value";
                ddl.DataBind();
                ddl.SelectedValue = si.PrivacyCode.ToString();
                ddl.Visible       = false;
                litSetting.Text   = si.PrivacyLevel;

                //ddl.Attributes.Add("onchange", "JavaScript:showstatus()");
                hf.Value = si.ItemURI;
                if (si.ItemURI.StartsWith(Profiles.ORNG.Utilities.OpenSocialManager.ORNG_ONTOLOGY_PREFIX))
                {
                    ((Control)e.Row.FindControl("imgOrng")).Visible = true;
                }


                switch (si.ObjectType)
                {
                case "1":
                    objecttype = "Literal";
                    break;

                case "0":
                    objecttype = "Entity";
                    break;
                }

                string editlink = "javascript:GoTo('" + Root.Domain + "/edit/default.aspx?subject=" + this.Subject.ToString() + "&predicateuri=" + hf.Value.Replace("#", "!") + "&module=DisplayItemToEdit&ObjectType=" + objecttype + "')";

                if (e.Row.RowState == DataControlRowState.Alternate)
                {
                    e.Row.Attributes.Add("onmouseover", "doListTableRowOver(this);");
                    e.Row.Attributes.Add("onmouseout", "doListTableRowOut(this,0);");
                    e.Row.Attributes.Add("onfocus", "doListTableRowOver(this);");
                    e.Row.Attributes.Add("onblur", "doListTableRowOut(this,0);");
                    e.Row.Attributes.Add("tabindex", "0");
                    e.Row.Attributes.Add("class", "evenRow");
                    e.Row.Attributes.Add("onclick", editlink);
                    e.Row.Attributes.Add("onkeypress", "if (event.keyCode == 13) " + editlink);
                    blankimage.ImageUrl = Root.Domain + "/edit/images/icons_blankAlt.gif";
                    blankimage.Attributes.Add("style", "opacity:0.0;filter:alpha(opacity=0);");
                }
                else
                {
                    e.Row.Attributes.Add("onmouseover", "doListTableRowOver(this);");
                    e.Row.Attributes.Add("onmouseout", "doListTableRowOut(this,1);");
                    e.Row.Attributes.Add("onfocus", "doListTableRowOver(this);");
                    e.Row.Attributes.Add("onblur", "doListTableRowOut(this,1);");
                    e.Row.Attributes.Add("tabindex", "0");
                    e.Row.Attributes.Add("class", "oddRow");
                    e.Row.Attributes.Add("onclick", editlink);
                    e.Row.Attributes.Add("onkeypress", "if (event.keyCode == 13) " + editlink);
                    blankimage.ImageUrl = Root.Domain + "/edit/images/icons_blankAlt.gif";
                    blankimage.Attributes.Add("style", "opacity:0.0;filter:alpha(opacity=0);");
                }

                e.Row.Cells[1].CssClass = "colItemCnt";
                e.Row.Cells[2].CssClass = "colSecurity";
            }
        }
        private void BuildEqualsSameLiteral(BooleanExpression search, ScalarExpression firstParam, Literal literal)
        {
            var newExpression = new BooleanParenthesisExpression();
            var expression    = new BooleanBinaryExpression();

            newExpression.Expression = expression;

            expression.BinaryExpressionType = BooleanBinaryExpressionType.Or;
            var isnull = new BooleanIsNullExpression();

            isnull.Expression          = firstParam;
            expression.FirstExpression = isnull;

            var second = new BooleanComparisonExpression();

            second.FirstExpression      = firstParam;
            second.SecondExpression     = literal;
            expression.SecondExpression = second;

            var sql = ScriptDom.GenerateTSql(newExpression);

            _replacementsToMake.Add(new Replacements
            {
                Original         = _script.Substring(search.StartOffset, search.FragmentLength),
                OriginalLength   = search.FragmentLength,
                OriginalOffset   = search.StartOffset,
                Replacement      = sql,
                OriginalFragment = _currentFragment
            });
        }
示例#46
0
        protected void gMain_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ImageButton ib = (ImageButton)e.Row.FindControl("imgDelete");
                ib.Attributes.Add("onClick", "javascript: return confirm('" + AppLogic.GetString("admin.common.ConfirmDeletion", SkinID, LocaleSetting) + "')");

                //Click to edit
                if ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == DataControlRowState.Alternate))
                {
                    e.Row.Attributes.Add("ondblclick", "javascript:__doPostBack('gMain','Edit$" + e.Row.RowIndex + "')");
                }
            }
            if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
            {
                DataRowView myrow = (DataRowView)e.Row.DataItem;


                DropDownList ddXmlPackage = (DropDownList)e.Row.FindControl("ddEditXMLPackage");
                ddXmlPackage.Items.Clear();
                ListItem myNode = new ListItem();
                myNode.Value = AppLogic.GetString("admin.eventhandler.SelectPackage", SkinID, LocaleSetting);
                ddXmlPackage.Items.Add(myNode);

                String Location             = CommonLogic.SafeMapPath("~/XMLPackages");
                System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(Location);
                foreach (System.IO.FileInfo f in dir.GetFiles("event.*"))
                {
                    //LOAD FILES
                    ListItem myNode1 = new ListItem();
                    myNode1.Value = f.Name.ToUpperInvariant();
                    ddXmlPackage.Items.Add(myNode1);
                }

                if (ddXmlPackage.Items.Count > 1)
                {
                    ddXmlPackage.SelectedValue = myrow["XMLPackage"].ToString().ToUpperInvariant();
                }
                try
                {
                    if (ViewState["FirstTimeEdit"].ToString() == "0")
                    {
                        TextBox txt = (TextBox)e.Row.FindControl("txtEventName");
                        txt.Visible = false;
                        Literal lt = (Literal)e.Row.FindControl("ltEventName");
                        lt.Visible = true;
                    }
                    else
                    {
                        TextBox txt = (TextBox)e.Row.FindControl("txtEventName");
                        txt.Visible = true;
                        Literal lt = (Literal)e.Row.FindControl("ltEventName");
                        lt.Visible = false;
                    }
                }
                catch
                {
                    TextBox txt = (TextBox)e.Row.FindControl("txtEventName");
                    txt.Visible = false;
                    Literal lt = (Literal)e.Row.FindControl("ltEventName");
                    lt.Visible = true;
                }
            }
        }
示例#47
0
    protected void btn_assistant_Click(object sender, EventArgs e)
    {
        try
        {
            PortalSettings ps       = new PortalSettings();
            int            portalId = ps.PortalId;
            pnl_friendly.Visible = true;
            pnl_install.Visible  = true;
            pnl_start.Visible    = false;
            TabController            TC     = new TabController();
            string                   check  = "";
            System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(Server.MapPath("DesktopModules/AIS/Installer/Modules.xml") /*"C:\\inetpub\\wwwroot\\DNN\\DesktopModules\\AIS\\Installer\\Modules.xml"*/);
            bool install = false;
            while (reader.Read())
            {
                Label   lbl  = new Label();
                Literal line = new Literal();
                line.Text = "<br />";
                if (reader.Name == "tab" && reader.HasAttributes)
                {
                    TabInfo ti = TC.GetTabByName(reader.GetAttribute("name"), portalId);
                    if (ti == null)
                    {
                        lbl.Text      = "Tab " + reader.GetAttribute("name") + " does not exist";
                        lbl.ForeColor = System.Drawing.Color.Red;
                        pnl_friendly.Controls.Add(lbl);
                        pnl_friendly.Controls.Add(line);
                        install = true;
                    }
                    else if (ti.IsDeleted)
                    {
                        lbl.Text      = "Tab " + ti.TabName + " is in the bin : please restore it or delete it permanently";
                        lbl.ForeColor = System.Drawing.Color.Red;
                        pnl_friendly.Controls.Add(lbl);
                        pnl_friendly.Controls.Add(line);
                    }
                }
                if (reader.Name == "module" && reader.HasAttributes)
                {
                    if (DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName")) != null)
                    {
                        DesktopModuleInfo dmi = DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"));


                        TabInfo ti = new TabInfo();
                        ti.TabName = reader.GetAttribute("tab");


                        switch (checkPage(ti, DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"))))
                        {
                        case "OK":
                            if (check != ti.TabName)
                            {
                                lbl.Text      = "Module " + dmi.FriendlyName + " is already implemented in tab " + ti.TabName;
                                lbl.ForeColor = System.Drawing.Color.Green;
                                pnl_friendly.Controls.Add(lbl);
                                pnl_friendly.Controls.Add(line);
                                check = ti.TabName;
                            }
                            break;

                        case "Page":

                            break;

                        case "Bin":

                            break;

                        default:
                            lbl.Text      = "Module " + dmi.FriendlyName + " does not exist in tab " + ti.TabName;
                            lbl.ForeColor = System.Drawing.Color.Red;
                            pnl_friendly.Controls.Add(lbl);
                            pnl_friendly.Controls.Add(line);
                            install = true;
                            break;
                        }
                    }
                    else
                    {
                        lbl.Text      = "Module " + reader.GetAttribute("friendlyName") + " does not exist in site";
                        lbl.ForeColor = System.Drawing.Color.Red;
                        pnl_friendly.Controls.Add(lbl);
                        pnl_friendly.Controls.Add(line);
                    }
                }
            }
            btn_install.Visible = install;
        }
        catch (Exception exc)
        {
            superlabel.Text += exc.Message;
        }
    }
        private void PromptForNeededInfo(OpenIdRpxHelper rpxHelper, OpenIdRpxAuthInfo authInfo)
        {
            if (Email.IsValidEmailAddressSyntax(authInfo.Email))
            {
                divEmailInput.Visible   = false;
                divEmailDisplay.Visible = true;
                litEmail.Text           = authInfo.Email;
                hdnEmail.Value          = authInfo.Email;
                //email is verified go ahead and track new registration in analytics
                //or we won't have another opportunity to track it
                if (authInfo.VerifiedEmail.Length > 0)
                {
                    AnalyticsAsyncTopScript asyncAnalytics = Page.Master.FindControl("analyticsTop") as AnalyticsAsyncTopScript;
                    if (asyncAnalytics != null)
                    {
                        asyncAnalytics.PageToTrack = "/RegistrationConfirmed.aspx";
                    }
                    else
                    {
                        mojoGoogleAnalyticsScript analytics = Page.Master.FindControl("mojoGoogleAnalyticsScript1") as mojoGoogleAnalyticsScript;
                        if (analytics != null)
                        {
                            analytics.PageToTrack = "/RegistrationConfirmed.aspx";
                        }
                    }
                }
            }
            else
            {
                divEmailInput.Visible   = true;
                divEmailDisplay.Visible = false;
            }

            pnlNeededProfileProperties.Visible = true;
            pnlSubscribe.Visible = displaySettings.ShowNewsLetters;
            pnlOpenID.Visible    = false;

            litOpenIDURI.Text          = authInfo.Identifier;
            hdnIdentifier.Value        = authInfo.Identifier;
            hdnPreferredUsername.Value = authInfo.PreferredUsername;
            hdnDisplayName.Value       = authInfo.DisplayName;

            if (authInfo.ProviderName.Length > 0)
            {
                litHeading.Text = string.Format(CultureInfo.InvariantCulture, Resource.RpxRegistrationHeadingFormat, authInfo.ProviderName);
            }

            //PopulateRequiredProfileControls();
            pnlRequiredProfileProperties.Visible = true;


            litInfoNeededMessage.Text = Resource.OpenIDAdditionalInfoNeededMessage;

            if (termsOfUse.Length > 0)
            {
                Literal agreement = new Literal();
                agreement.Text = termsOfUse;
                divAgreement.Controls.Add(agreement);
            }
            else
            {
                chkAgree.Visible = false;
            }
        }
 /// <summary>
 /// 接受模式窗体返回数据
 /// </summary>
 /// <param name="tb">textbox对象</param>
 /// <param name="lb">lable对象</param>
 /// <param name="url">url</param>
 private void showResoult(int StorageInID, string url)
 {
     backScript      = (Literal)GetControltByMaster("backScript");
     backScript.Text = JSDialogAid.UploadData(StorageInID, url);
 }
示例#50
0
        protected override void CreateChildControls()
        {
            Literal literal;

            this.Controls.Clear();
            this.Controls.Add(new LiteralControl("<div class=\"" + this.ClassName + "\" ><b class='MyPagerLeft' >"));
            int num = 0;

            if (this.PageCount > 0)
            {
                literal = new Literal();
                string[] strArray = new string[] { "记录数:", this.RecordCount.ToString(), "条 &nbsp;页次:", (this.CurrentPageIndex + 1).ToString(), "/", this.PageCount.ToString(), "&nbsp;&nbsp;</b>" };
                literal.Text = string.Concat(strArray);
                this.Controls.Add(literal);
            }
            else
            {
                literal = new Literal {
                    Text = "记录数:" + this.RecordCount.ToString() + "条 &nbsp;页次:0/0&nbsp;&nbsp;</b>"
                };
                this.Controls.Add(literal);
            }
            this.Controls.Add(new LiteralControl("<b class='MyPagerRight' >"));
            HyperLink child = new HyperLink {
                Text    = "首页",
                ToolTip = "首页",
                Target  = "_self"
            };
            string str = RequestHelper.RawUrl.AddUrlQueryString("PageIndex", "0");

            child.NavigateUrl = str;
            if (this.CurrentPageIndex == 0)
            {
                child.Attributes.Add("onclick", "return false;");
            }
            this.Controls.Add(child);
            if (this.CurrentPageIndex <= 5)
            {
                for (num = 1; num <= 9; num++)
                {
                    if (num > this.PageCount)
                    {
                        break;
                    }
                    child = new HyperLink {
                        Text    = num.ToString(),
                        ToolTip = "第" + num.ToString() + "页"
                    };
                    str = RequestHelper.RawUrl.AddUrlQueryString("PageIndex", num - 1);
                    child.NavigateUrl = str;
                    if (num == (this.CurrentPageIndex + 1))
                    {
                        child.CssClass = "pager-current";
                        child.Attributes.Add("onclick", "return false;");
                    }
                    this.Controls.Add(child);
                }
            }
            else
            {
                for (num = (this.CurrentPageIndex + 1) - 4; num <= ((this.CurrentPageIndex + 1) + 4); num++)
                {
                    if (num > this.PageCount)
                    {
                        break;
                    }
                    child = new HyperLink {
                        Text    = num.ToString(),
                        ToolTip = "第" + num.ToString() + "页"
                    };
                    str = RequestHelper.RawUrl.AddUrlQueryString("PageIndex", num - 1);
                    child.NavigateUrl = str;
                    if (num == (this.CurrentPageIndex + 1))
                    {
                        child.CssClass = "pager-current";
                        child.Attributes.Add("onclick", "return false;");
                    }
                    this.Controls.Add(child);
                }
            }
            child = new HyperLink {
                Text        = "末页",
                ToolTip     = "末页",
                NavigateUrl = str
            };
            if (this.CurrentPageIndex != (this.PageCount - 1))
            {
                str = RequestHelper.RawUrl.AddUrlQueryString("PageIndex", this.PageCount - 1);
            }
            else
            {
                child.Attributes.Add("onclick", "return false;");
            }
            this.Controls.Add(child);
            this.Controls.Add(new LiteralControl("</b>"));
            this.Controls.Add(new LiteralControl("</div>"));
        }
        /// <summary> Adds the controls for this result viewer to the place holder on the main form </summary>
        /// <param name="MainPlaceHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form into which the the bulk of the result viewer's output is displayed</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles and sorted by serial hierarchy </returns>
        public override void Add_HTML(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Brief_ResultsWriter.Add_HTML", "Rendering results in brief view");
            }

            // If results are null, or no results, return empty string
            if ((PagedResults == null) || (ResultsStats == null) || (ResultsStats.Total_Items <= 0))
            {
                return;
            }

            const string VARIES_STRING = "<span style=\"color:Gray\">( varies )</span>";

            // Get the text search redirect stem and (writer-adjusted) base url
            string textRedirectStem = Text_Redirect_Stem;
            string base_url         = RequestSpecificValues.Current_Mode.Base_URL;

            if (RequestSpecificValues.Current_Mode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)
            {
                base_url = RequestSpecificValues.Current_Mode.Base_URL + "l/";
            }

            // Start the results
            StringBuilder resultsBldr = new StringBuilder(2000);

            resultsBldr.AppendLine("<section class=\"sbkBrv_Results\">");

            // Set the counter for these results from the page
            int current_page   = RequestSpecificValues.Current_Mode.Page.HasValue ? RequestSpecificValues.Current_Mode.Page.Value : 1;
            int result_counter = ((current_page - 1) * Results_Per_Page) + 1;

            Tracer.Add_Trace("Brief_ResultsViewer.Add_HTML", "There are [" + PagedResults.Count + "] results @ [" + Results_Per_Page + "] per page.");

            // Step through all the results
            int current_row = 0;

            foreach (iSearch_Title_Result titleResult in PagedResults)
            {
                bool multiple_title = titleResult.Item_Count > 1;

                // Always get the first item for things like the main link and thumbnail
                iSearch_Item_Result firstItemResult = titleResult.Get_Item(0);

                // Determine the internal link to the first (possibly only) item
                string internal_link = base_url + titleResult.BibID + "/" + firstItemResult.VID + textRedirectStem;

                // For browses, just point to the title
                if (RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Aggregation)                 // browse info only
                {
                    internal_link = base_url + titleResult.BibID + "/" + firstItemResult.VID + textRedirectStem;
                }

                // Start this row
                string title = firstItemResult.Title.Replace("<", "&lt;").Replace(">", "&gt;");
                if (multiple_title)
                {
                    title = titleResult.GroupTitle.Replace("<", "&lt;").Replace(">", "&gt;");
                    resultsBldr.AppendLine("\t<section class=\"sbkBrv_SingleResult\">");
                }
                else
                {
                    resultsBldr.AppendLine("\t<section class=\"sbkBrv_SingleResult\" onclick=\"window.location.href='" + internal_link.Replace("'", "\\'") + "';\" >");
                }

                // Add the counter as the first column
                resultsBldr.AppendLine("\t\t<div class=\"sbkBrv_SingleResultNum\">" + result_counter + "</div>");
                resultsBldr.Append("\t\t<div class=\"sbkBrv_SingleResultThumb\">");
                //// Is this restricted?
                bool restricted_by_ip = false;
                if ((titleResult.Item_Count == 1) && (firstItemResult.IP_Restriction_Mask > 0))
                {
                    int comparison = firstItemResult.IP_Restriction_Mask & CurrentUserMask;
                    if (comparison == 0)
                    {
                        restricted_by_ip = true;
                    }
                }

                // Calculate the thumbnail
                string thumb = titleResult.BibID.Substring(0, 2) + "/" + titleResult.BibID.Substring(2, 2) + "/" + titleResult.BibID.Substring(4, 2) + "/" + titleResult.BibID.Substring(6, 2) + "/" + titleResult.BibID.Substring(8) + "/" + firstItemResult.VID + "/" + (firstItemResult.MainThumbnail).Replace("\\", "/").Replace("//", "/");

                // Draw the thumbnail
                if ((thumb.ToUpper().IndexOf(".JPG") < 0) && (thumb.ToUpper().IndexOf(".GIF") < 0))
                {
                    resultsBldr.AppendLine("<a href=\"" + internal_link + "\"><img src=\"" + Static_Resources_Gateway.Nothumb_Jpg + "\" border=\"0px\" class=\"resultsThumbnail\" alt=\"MISSING THUMBNAIL\" /></a></div>");
                }
                else
                {
                    resultsBldr.AppendLine("<a href=\"" + internal_link + "\"><img src=\"" + UI_ApplicationCache_Gateway.Settings.Servers.Image_URL + thumb + "\" class=\"resultsThumbnail\" alt=\"" + title.Replace("\"", "") + "\" /></a></div>");
                }

                resultsBldr.AppendLine("\t\t<div class=\"sbkBrv_SingleResultDesc\">");

                // If this was access restricted, add that
                if (restricted_by_ip)
                {
                    resultsBldr.AppendLine("\t\t\t<span class=\"RestrictedItemText\">" + UI_ApplicationCache_Gateway.Translation.Get_Translation("Access Restricted", RequestSpecificValues.Current_Mode.Language) + "</span>");
                }

                if (multiple_title)
                {
                    resultsBldr.AppendLine("\t\t\t<span class=\"briefResultsTitle\"><a href=\"" + internal_link + "\">" + titleResult.GroupTitle.Replace("<", "&lt;").Replace(">", "&gt;") + "</a></span>");
                }
                else
                {
                    resultsBldr.AppendLine(
                        "\t\t\t<span class=\"briefResultsTitle\"><a href=\"" +
                        internal_link + "\" onclick=\"cancelPropagation(event);\">" + firstItemResult.Title.Replace("<", "&lt;").Replace(">", "&gt;") +
                        "</a></span>");
                }

                // Add each element to this table
                resultsBldr.AppendLine("\t\t\t<dl class=\"sbkBrv_SingleResultDescList\">");

                if ((!String.IsNullOrEmpty(titleResult.Primary_Identifier_Type)) && (!String.IsNullOrEmpty(titleResult.Primary_Identifier)))
                {
                    resultsBldr.AppendLine("\t\t\t\t<dt>" + UI_ApplicationCache_Gateway.Translation.Get_Translation(titleResult.Primary_Identifier_Type, RequestSpecificValues.Current_Mode.Language) + ":</dt><dd>" + titleResult.Primary_Identifier + "</dd>");
                }

                if ((RequestSpecificValues.Current_User != null) && (RequestSpecificValues.Current_User.LoggedOn) && (RequestSpecificValues.Current_User.Is_Internal_User))
                {
                    resultsBldr.AppendLine("\t\t\t\t<dt>BibID:</dt><dd>" + titleResult.BibID + "</dd>");

                    if (titleResult.OPAC_Number > 1)
                    {
                        resultsBldr.AppendLine("\t\t\t\t<dt>OPAC:</dt><dd>" + titleResult.OPAC_Number + "</dd>");
                    }

                    if (titleResult.OCLC_Number > 1)
                    {
                        resultsBldr.AppendLine("\t\t\t\t<dt>OCLC:</dt><dd>" + titleResult.OCLC_Number + "</dd>");
                    }
                }

                for (int i = 0; i < ResultsStats.Metadata_Labels.Count; i++)
                {
                    string field = ResultsStats.Metadata_Labels[i];

                    // Somehow the metadata for this item did not fully save in the database.  Break out, rather than
                    // throw the exception
                    if ((titleResult.Metadata_Display_Values == null) || (titleResult.Metadata_Display_Values.Length <= i))
                    {
                        break;
                    }

                    string value = titleResult.Metadata_Display_Values[i];
                    Metadata_Search_Field thisField = UI_ApplicationCache_Gateway.Settings.Metadata_Search_Field_By_Name(field);
                    string display_field            = string.Empty;
                    if (thisField != null)
                    {
                        display_field = thisField.Display_Term;
                    }
                    if (display_field.Length == 0)
                    {
                        display_field = field.Replace("_", " ");
                    }

                    if (value == "*")
                    {
                        resultsBldr.AppendLine("\t\t\t\t<dt>" + UI_ApplicationCache_Gateway.Translation.Get_Translation(display_field, RequestSpecificValues.Current_Mode.Language) + ":</dt><dd>" + HttpUtility.HtmlDecode(VARIES_STRING) + "</dd>");
                    }
                    else if (value.Trim().Length > 0)
                    {
                        if (value.IndexOf("|") > 0)
                        {
                            bool     value_found = false;
                            string[] value_split = value.Split("|".ToCharArray());

                            foreach (string thisValue in value_split)
                            {
                                if (thisValue.Trim().Trim().Length > 0)
                                {
                                    if (!value_found)
                                    {
                                        resultsBldr.Append("\t\t\t\t<dt>" + UI_ApplicationCache_Gateway.Translation.Get_Translation(display_field, RequestSpecificValues.Current_Mode.Language) + ":</dt>");
                                        value_found = true;
                                    }
                                    resultsBldr.Append("<dd>" + HttpUtility.HtmlDecode(thisValue) + "</dd>");
                                }
                            }

                            if (value_found)
                            {
                                resultsBldr.AppendLine();
                            }
                        }
                        else
                        {
                            resultsBldr.AppendLine("\t\t\t\t<dt>" + UI_ApplicationCache_Gateway.Translation.Get_Translation(display_field, RequestSpecificValues.Current_Mode.Language) + ":</dt><dd>" + HttpUtility.HtmlDecode(value) + "</dd>");
                        }
                    }
                }

                resultsBldr.AppendLine("\t\t\t</dl>");

                if (!String.IsNullOrEmpty(titleResult.Snippet))
                {
                    resultsBldr.AppendLine("\t\t\t<div class=\"sbkBrv_SearchResultSnippet\">&ldquo;..." + titleResult.Snippet.Replace("<em>", "<span class=\"texthighlight\">").Replace("</em>", "</span>") + "...&rdquo;</div>");
                }

                // Add children, if there are some
                if (multiple_title)
                {
                    // Add this to the place holder
                    Literal thisLiteral = new Literal
                    {
                        Text = resultsBldr.ToString().Replace("&lt;role&gt;", "<i>").Replace("&lt;/role&gt;", "</i>")
                    };
                    MainPlaceHolder.Controls.Add(thisLiteral);
                    resultsBldr.Remove(0, resultsBldr.Length);

                    Add_Issue_Tree(MainPlaceHolder, titleResult, current_row, textRedirectStem, base_url);
                }

                resultsBldr.AppendLine("\t\t</div>");

                resultsBldr.AppendLine("\t</section>");
                resultsBldr.AppendLine();

                // Increment the result counters
                result_counter++;
                current_row++;
            }

            // End this table
            resultsBldr.AppendLine("</section>");

            // Add this to the HTML page
            Literal mainLiteral = new Literal
            {
                Text = resultsBldr.ToString().Replace("&lt;role&gt;", "<i>").Replace("&lt;/role&gt;", "</i>")
            };

            MainPlaceHolder.Controls.Add(mainLiteral);
        }
示例#52
0
        /// <summary>
        /// Render
        /// This function creates a tree view in a table from the SitemapItems list
        /// </summary>
        /// <param name="list">The list.</param>
        /// <returns>A web control.</returns>
        /// <remarks></remarks>
        public virtual WebControl Render(IList <SitemapItem> list)
        {
            // init table with a width of 98%
            var t = new Table {
                Width = this.TableWidth, BorderWidth = 0, CellSpacing = 0, CellPadding = 0
            };

            var cols = this.MaxLevel(list) + 2;

            // an array of chars is used to determine what images to show on each row
            // the chars have the following meaning:
            // + --> crossed line
            // | --> straight line
            // \ --> line for last node on branch
            // N --> node
            // R --> root node
            // S --> space
            var strRow = new char[cols];

            // init row to spaces
            for (var i = 0; i < cols; ++i)
            {
                strRow[i] = 'S';
            }

            for (var i = 0; i < list.Count; ++i)
            {
                // replace the cross of the previous row in a straight line on the current row
                // do the same for last_node_line and Spaces
                for (var j = 0; j < cols; ++j)
                {
                    if (strRow[j] == '+')
                    {
                        strRow[j] = '|';
                    }

                    if (strRow[j] == '\\')
                    {
                        strRow[j] = 'S';
                    }
                }

                // show a root node image if nestlevel = 0
                if (list[i].NestLevel == 0)
                {
                    strRow[list[i].NestLevel] = 'R';
                }
                else
                {
                    strRow[list[i].NestLevel] = 'N';
                }

                // everything after the node can be replaces by spaces
                for (var j = list[i].NestLevel + 1; j < cols; ++j)
                {
                    strRow[j] = ' ';
                }

                // show no lines before the node when it's a root node
                if (list[i].NestLevel > 0)
                {
                    if (this.LastItemAtLevel(i, list))
                    {
                        // if it's the last node at that level of the current branch,
                        // show a last node line
                        strRow[list[i].NestLevel - 1] = '\\';
                    }
                    else
                    {
                        // else show a crossed line
                        strRow[list[i].NestLevel - 1] = '+';
                    }
                }

                // the images are determined in the char array, now make a TableRow from it
                var       r = new TableRow();
                TableCell c;

                // only use the char array till the node
                for (var j = 0; j <= list[i].NestLevel; ++j)
                {
                    c = new TableCell();
                    var img = new Image {
                        BorderWidth = 0, Width = this.ImagesWidth, Height = this.ImagesHeight
                    };

                    c.Width = this.ImagesWidth;

                    // what image to use
                    switch (strRow[j])
                    {
                    case '+':
                        img.ImageUrl = this.ImageCrossedLineUrl;
                        break;

                    case '\\':
                        img.ImageUrl = this.ImageLastNodeLineUrl;
                        break;

                    case '|':
                        img.ImageUrl = this.ImageStraightLineUrl;
                        break;

                    case 'S':
                        img.ImageUrl = this.ImageSpacerUrl;
                        break;

                    case 'N':
                        img.ImageUrl = this.ImageNodeUrl;
                        break;

                    case 'R':
                        img.ImageUrl = this.ImageRootNodeUrl;
                        break;
                    }

                    c.Controls.Add(img);
                    r.Cells.Add(c);
                }

                // the images are done for this row, now make the hyperlink
                c = new TableCell
                {
                    Width = new Unit(100, UnitType.Percentage), ColumnSpan = cols - 1 - list[i].NestLevel
                };

                // make sure it fills the all the space left
                var lit = new Literal {
                    Text = "&nbsp;"
                };
                c.Controls.Add(lit);
                var l = new HyperLink {
                    Text = list[i].Name, NavigateUrl = list[i].Url, CssClass = this.CssStyle
                };

                // row is done and add everything to the table
                c.Controls.Add(l);
                r.Cells.Add(c);
                t.Rows.Add(r);
            }

            return(t);
        }
示例#53
0
 public void AddMessage(Literal lbl, string msg, bool type)
 {
     lbl.Text = "<div class='alert alert-" + (type ? "success" : "danger") + "'>" + msg + "</div>";
 }
示例#54
0
        private void ProductBusiness()
        {
            if (this.ProductInfo != null)
            {
                this.BuildSku();
                HtmlInputHidden htmlInputHidden = this.hidden_StoreId;
                int             num             = this.ProductInfo.StoreId;
                htmlInputHidden.Value = num.ToString();
                HtmlInputHidden htmlInputHidden2 = this.hidden_SKUSubmitOrderProductId;
                num = this.ProductInfo.ProductId;
                htmlInputHidden2.Value = num.ToString();
                this.imgSKUSubmitOrderProduct.ImageUrl = this.ProductInfo.SubmitOrderImg;
                this.lblSKUSubmitOrderPrice.Text       = this.ProductInfo.MinSalePrice.F2ToString("f2");
                Label label = this.lblSKUSubmitOrderStockNow;
                num        = this.ProductInfo.Stock;
                label.Text = num.ToString();
                this.hidden_SKUSubmitOrderProductMinPrice.Value = this.ProductInfo.MinSalePrice.F2ToString("f2");
                HtmlInputHidden htmlInputHidden3 = this.hidden_SKUSubmitOrderProductStock;
                num = this.ProductInfo.Stock;
                htmlInputHidden3.Value = num.ToString();
                this.buyButton.Visible = false;
                if (this.IsServiceProduct)
                {
                    this.btnAddCart.Visible = false;
                    this.buyButton.Style.Add("width", "100%");
                    this.buyButton.Visible = true;
                }
                else
                {
                    string str = "<div id=\"addcartButton2\" style='float: left;width:50% ' type=\"shoppingBtn\" class=\"add_cart\">加入购物车</div>";
                    switch (this.ProductInfo.ExStatus)
                    {
                    case DetailException.StopService:
                    {
                        DateTime value;
                        if (this.CountDownId > 0)
                        {
                            Literal literal = this.ltlBottomStatus;
                            value        = this.ProductInfo.StoreInfo.CloseEndTime.Value;
                            literal.Text = string.Format("<h4>歇业中</h4><p>营业时间:{0}</p>", value.ToString("yyyy年MM月dd号 HH:mm"));
                        }
                        else
                        {
                            value = this.ProductInfo.StoreInfo.CloseEndTime.Value;
                            string text = string.Format("歇业中 营业时间:{0}</ p > ", value.ToString("yyyy年MM月dd号 HH:mm"));
                            this.setBuyButtonEx(text);
                            this.ltlBottomStatus.Text = text;
                        }
                        break;
                    }

                    case DetailException.NoStock:
                        this.setBuyButtonEx("已售罄");
                        this.ltlBottomStatus.Text = "已售罄";
                        break;

                    case DetailException.OverServiceArea:
                        this.setBuyButtonEx("服务范围超区");
                        this.ltlBottomStatus.Text = ((this.CountDownId > 0) ? "服务范围超区" : "<div id=\"addcartButton2\" class=\"add_cart b_r_0 mg_0 addcartFunction\" style=\"width:50%;float: left\">加入购物车</div><div class=\"chaoqu\">服务范围超区</div>");
                        break;

                    case DetailException.IsNotWorkTime:
                        if (this.CountDownId > 0)
                        {
                            this.ltlBottomStatus.Text = "<div class=\"nottheTime\">非营业时间</div>";
                        }
                        else if (base.site.Store_IsOrderInClosingTime)
                        {
                            this.ltlBottomStatus.Text = str + " <button class=\"buy b_r_0 mg_0\" id=\"buyButton\" style=\"width: 50%\">立即购买</button>";
                        }
                        else
                        {
                            this.buyButton.Visible    = true;
                            this.ltlBottomStatus.Text = str + "<div class=\"nottheTime\">非营业时间</div>";
                        }
                        break;

                    default:
                        this.buyButton.Visible = true;
                        if (this.CountDownId > 0)
                        {
                            if (this.CountDownInfo.IsJoin)
                            {
                                this.ltlBottomStatus.Text = " <button class=\"buy b_r_0 mg_0\" id=\"buyButton\" onclick='BuyProduct()' style=\"width: 100%\">立即购买</button>";
                            }
                        }
                        else
                        {
                            this.ltlBottomStatus.Text = " <button id=\"btnAddCart\" class=\"add_cart btn b_r_0 mg_0 addcartFunction\" style=\"width: 50%\">加入购物车</button><button class=\"btn btn-warning btn-yes\" id=\"buyButton\"  onclick='BuyProduct()' style=\"width: 50%\">立即购买</button>";
                        }
                        break;
                    }
                }
            }
        }
        public static GridPanel SetPublishInfo(GridPanel publishFields, PublishingInfoArgsEntity summary, bool completed)
        {
            var owner = new Literal
            {
                Text = "Owner: " + summary.Owner
            };

            publishFields.Controls.Add(owner);

            var mode = new Literal
            {
                Text = "Publish Mode: " + summary.PublishMode
            };

            publishFields.Controls.Add(mode);

            var processedCount = new Literal
            {
                Text = "Total Item Processed: " + summary.PublishedCount
            };

            publishFields.Controls.Add(processedCount);

            var totalItems = new Literal
            {
                Text = "Total Items to be processed: " + summary.PublishQueue
            };

            publishFields.Controls.Add(totalItems);

            if (completed && summary.PublishedItems != null)
            {
                var itemCreated = new Literal
                {
                    Text = "Item Created: " + summary.ItemCreated
                };

                publishFields.Controls.Add(itemCreated);

                var itemSkipped = new Literal
                {
                    Text = "Item Skipped: " + summary.ItemSkipped
                };

                publishFields.Controls.Add(itemSkipped);

                var itemDeleted = new Literal
                {
                    Text = "Item Deleted: " + summary.ItemDeleted
                };

                publishFields.Controls.Add(itemDeleted);

                var itemUpdated = new Literal
                {
                    Text = "Item Updated: " + (summary.ItemUpdated + 1)
                };

                publishFields.Controls.Add(itemUpdated);
            }

            return(publishFields);
        }
示例#56
0
        protected override void OnLoad(EventArgs e)
        {
            Log.Verbose("Page loaded {Page}.", this.Page);

            if (string.IsNullOrWhiteSpace(this.OverridePath))
            {
                this.OverridePath = this.Page.Request.Url.AbsolutePath;
            }

            Literal contentMenuLiteral = ((Literal)PageUtility.FindControlIterative(this.Master, "ContentMenuLiteral"));

            if (contentMenuLiteral == null)
            {
                return;
            }

            string menu = "<div id=\"tree\" style='display:none;'><ul id='treeData'>";

            int    officeId = CurrentUser.GetSignInView().OfficeId.ToInt();
            int    userId   = CurrentUser.GetSignInView().UserId.ToInt();
            string culture  = CurrentUser.GetSignInView().Culture;

            if (userId.Equals(0) || officeId.Equals(0))
            {
                return;
            }

            this.menus = Data.Core.Menu.GetMenuCollection(officeId, userId, culture).ToArray();

            if (!this.VerifyAccess())
            {
                return;
            }


            Menu[] collection = menus.Where(x => x.ParentMenuId == null).ToArray();

            if (collection.Length > 0)
            {
                for (int i = 0; i < collection.Length; i++)
                {
                    string menuText = collection[i].MenuText;
                    string id       = collection[i].MenuId.ToString(CultureInfo.InvariantCulture);

                    string items = GetMenu(collection[i].MenuId);

                    menu += string.Format(Thread.CurrentThread.CurrentCulture,
                                          "<li id='node{0}'>" +
                                          "<a id='anchorNode{0}' href='javascript:void(0);' title='{1}'>{1}</a>" +
                                          "{2}" +
                                          "</li>",
                                          id,
                                          menuText,
                                          items);
                }
            }

            menu += "</ul></div>";

            contentMenuLiteral.Text = menu;

            this.menus = null;

            base.OnLoad(e);
        }
    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 EDIT button
        var btnEdit = e.Item.FindControl("btnEdit") as CMSAccessibleButton;

        if (btnEdit != null)
        {
            btnEdit.ToolTip = GetString("general.edit");

            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
        var btnDelete = e.Item.FindControl("btnDelete") as CMSAccessibleButton;

        if (btnDelete != null)
        {
            btnDelete.ToolTip       = GetString("general.delete");
            btnDelete.OnClientClick = GetDeleteScript(argument);
        }

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

        if (fileImage != null)
        {
            string url;
            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);
                }

                fileImage.ImageUrl = ResolveUrl(url);
            }
            else
            {
                fileImage.Visible = false;

                Literal literalImage = e.Item.FindControl("ltrImage") as Literal;
                if (literalImage != null)
                {
                    literalImage.Text = UIHelper.GetFileIcon(Page, ext, FontIconSizeEnum.Dashboard);
                }
            }
        }

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

        if (pnlItemInageContainer != null)
        {
            pnlItemInageContainer.Attributes["onclick"] = selectAction;
            pnlItemInageContainer.Attributes["style"]   = "cursor:pointer;";
        }
    }
示例#58
0
        protected override void CreateChildControls()
        {
            //base.CreateChildControls();

            // TODO: add custom rendering code here.
            // Label label = new Label();
            // label.Text = "Hello World";
            // this.Controls.Add(label);
            this._gviewMyMessage = new SPGridView();

            HyperLinkField lf = new HyperLinkField();

            lf.HeaderText = "消息主题";
            //lf.DataTextField = "MessageTitle";
            //lf.DataNavigateUrlFields = new string[] { "MessageInfoID", "ReceiverID" };
            //lf.DataNavigateUrlFormatString = "MyMessage.aspx?curMessageInfoID={0}&curReceiverID={1}";

            //DataNavigateUrlFormatString不支持javascript
            //string relativeUrl = "MyMessage.aspx?curMessageInfoID={0}&curReceiverID={1}";
            //lf.DataNavigateUrlFormatString = "javascript:window.showModalDialog('" + relativeUrl + "','0','dialogWidth:300px;dialogHeight:450px');";
            //lf.DataNavigateUrlFormatString = "javascript:window.showModalDialog('MyMessage.aspx?curMessageInfoID={0}&curReceiverID={1}','0','dialogWidth:300px;dialogHeight:450px');";

            this._gviewMyMessage.Columns.Add(lf);

            BoundField bfCreateTime = new BoundField();

            bfCreateTime.HeaderText       = "日期";
            bfCreateTime.DataField        = "CreateTime";
            bfCreateTime.DataFormatString = "{0:yyyy-MM-dd}";
            this._gviewMyMessage.Columns.Add(bfCreateTime);

            BoundField bfMsgFromEmp = new BoundField();

            bfMsgFromEmp.HeaderText = "来自";
            bfMsgFromEmp.DataField  = "MsgFromEmp";
            this._gviewMyMessage.Columns.Add(bfMsgFromEmp);

            BoundField bfMessageStatus = new BoundField();

            bfMessageStatus.HeaderText = "状态";
            bfMessageStatus.DataField  = "MessageStatus";
            this._gviewMyMessage.Columns.Add(bfMessageStatus);

            this._gviewMyMessage.AutoGenerateColumns = false;
            this._gviewMyMessage.GridLines           = GridLines.None;
            this._gviewMyMessage.CssClass            = "ms-vh2 padded headingfont";
            this._gviewMyMessage.RowDataBound       += new GridViewRowEventHandler(_gviewMyMessage_RowDataBound);

            //this._gviewMyMessage.AllowPaging = true;
            //this._gviewMyMessage.PageSize = 1;
            //this._gviewMyMessage.PageIndexChanging +=new GridViewPageEventHandler(_gviewMyMessage_PageIndexChanging);
            //this._gviewMyMessage.PagerTemplate = new SPGridViewPagerTemplate("{0} - {1}", _gviewMyMessage);

            using (WebPartMMSProDBDataContext dc = new WebPartMMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString))
            {
                this._gviewMyMessage.DataSource = (from m in dc.MessageInfo
                                                   join r in dc.MessageReceiver on m.MessageInfoID equals r.MessageInfoID
                                                   where m.MessageStatus == "未读" && m.MessageType == "私有消息" && dc.EmpInfo.SingleOrDefault(e => e.EmpID == r.ReceiverID).Account == SPContext.Current.Web.CurrentUser.LoginName
                                                   orderby m.MessageInfoID descending
                                                   select new
                {
                    m.MessageInfoID,
                    r.ReceiverID,
                    m.MessageTitle,
                    m.CreateTime,
                    MsgFromEmp = dc.EmpInfo.SingleOrDefault(ee => ee.EmpID == m.Creater).EmpName,
                    m.MessageStatus
                }).Take(6);

                this._gviewMyMessage.DataBind();
            }
            Literal L1 = new Literal();

            L1.Text = "<table style='width:100%; text-align:right'><tr><td><a href='WorkPages/DocAndIndexManager/MoreMyMessage.aspx'>更多我的消息...</a></td></tr></table>";
            this.Controls.Add(this._gviewMyMessage);
            this.Controls.Add(L1);
            this.Title = "我的消息";
        }
        protected void dgnews_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DropDownList ddlgrade = (DropDownList)e.Row.FindControl("ddlgrade");
                // DropDownList ddlstatus = (DropDownList)e.Row.FindControl("ddlstatus");
                TextBox txtremark = (TextBox)e.Row.FindControl("txtremark");
                // TextBox txthours = (TextBox)e.Row.FindControl("txthours");
                TextBox txtcomments = (TextBox)e.Row.FindControl("txtcomments");

                Literal ltrgrade    = (Literal)e.Row.FindControl("ltrgrade");
                Literal ltrcomments = (Literal)e.Row.FindControl("ltrcomments");

                // Literal ltrhours = (Literal)e.Row.FindControl("ltrhours");
                Literal ltrremark = (Literal)e.Row.FindControl("ltrremark");
                // Literal ltrstatus = (Literal)e.Row.FindControl("ltrstatus");
                LinkButton lbtndel = (LinkButton)e.Row.FindControl("lbtndelete");
                // LinkButton lbtnstatus = (LinkButton)e.Row.FindControl("lbtnstatus");
                //if (DataBinder.Eval(e.Row.DataItem, "status") != null)
                //    ddlstatus.Text = DataBinder.Eval(e.Row.DataItem, "status").ToString();
                if (DataBinder.Eval(e.Row.DataItem, "grade") != null)
                {
                    ddlgrade.Text = DataBinder.Eval(e.Row.DataItem, "grade").ToString();
                }

                HtmlImage imgassignedby = (HtmlImage)e.Row.FindControl("imgassignedby");
                if (DataBinder.Eval(e.Row.DataItem, "assignedbyid").ToString().ToLower() == "self assigned")
                {
                    imgassignedby.Src = "images/graydot.png";
                }
                else
                {
                    imgassignedby.Src = "images/greendot.png";
                }
                //Hide DELETE button
                lbtndel.Visible = false;

                //Check whether work on task has started or not
                if (DataBinder.Eval(e.Row.DataItem, "status").ToString().ToLower().Trim() == "not started" || DataBinder.Eval(e.Row.DataItem, "status").ToString() == "")
                {
                    //If work has started then
                    //Check whether logged in user is a manager or not
                    //If it is a manager then , it can delete the task yet not started
                    if (ViewState["add"] != null && ViewState["add"].ToString() == "1")
                    {
                        lbtndel.Visible = true;
                    }
                    //If logged in user is not a manager - then check whether it is self assigned task?
                    //If it is self assigned task, then user can delete it. so show the delete button
                    else if (DataBinder.Eval(e.Row.DataItem, "createdby").ToString() == Session["userid"].ToString())
                    {
                        lbtndel.Visible = true;
                    }
                }

                if (ViewState["add"] != null && ViewState["add"].ToString() == "1")
                {
                    ddlgrade.Enabled    = false;
                    ddlgrade.ToolTip    = "Task Grade can be given after completion of task";
                    txtcomments.Enabled = true;
                    txtremark.Visible   = true;


                    if (DataBinder.Eval(e.Row.DataItem, "empid").ToString() == Session["userid"].ToString())
                    {
                        if (DataBinder.Eval(e.Row.DataItem, "status").ToString().ToLower().Trim() == "completed")
                        {
                            //txtremark.Visible = false;
                            // txthours.Visible = false;
                            // ddlstatus.Visible = false;

                            //ltrhours.Visible = true;
                            //ltrremark.Visible = true;
                            //ltrstatus.Visible = true;
                            ddlgrade.Enabled = true;
                        }
                    }
                    else
                    {
                        if (DataBinder.Eval(e.Row.DataItem, "status").ToString().ToLower().Trim() == "completed")
                        {
                            ddlgrade.Enabled = true;
                        }
                        //txthours.Visible = false;
                        //txtremark.Visible = false;
                        //ddlstatus.Visible = false;

                        //ltrhours.Visible = true;
                        //ltrremark.Visible = true;
                        //ltrstatus.Visible = true;
                    }
                }
                else
                {
                    // lbtndel.Visible = false;
                    ddlgrade.Visible    = false;
                    txtcomments.Visible = false;
                    ltrcomments.Visible = true;
                    ltrgrade.Visible    = true;
                    txtremark.Visible   = false;
                    ltrremark.Visible   = true;

                    if (DataBinder.Eval(e.Row.DataItem, "status").ToString().ToLower().Trim() == "completed")
                    {
                        //txthours.Enabled = false;
                        //txtremark.Enabled = false;
                        //ddlstatus.Enabled = false;
                    }
                    else
                    {
                        if (DataBinder.Eval(e.Row.DataItem, "empid").ToString() == Session["userid"].ToString())
                        {
                            txtremark.Visible = true;
                            ltrremark.Visible = false;
                        }
                        //txthours.Enabled = false;
                        //txtremark.Enabled = false;
                        //ddlstatus.Enabled = false;
                    }
                }
            }
        }
示例#60
0
    protected void lvStudents_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        Literal ltAccountNo = (Literal)e.Item.FindControl("ltAccountNo");
        Literal ltEmail     = (Literal)e.Item.FindControl("ltEmail");
        Literal ltCode      = (Literal)e.Item.FindControl("ltCode");

        if (e.CommandName == "activate")
        {
            using (SqlConnection con = new SqlConnection(Helper.GetCon()))
            {
                con.Open();
                string query = @"UPDATE Account SET Status=@Status, RoleID=7,
                Password=@Password,
                DateModified=@DateModified
                WHERE AccountNo=@AccountNo AND Status!='Archived';
                UPDATE Students SET Status=@Status,
                DateModified=@DateModified
                WHERE AccountNo=@AccountNo AND Status!='Archived'";
                using (SqlCommand cmd = new SqlCommand(query, con))
                {
                    cmd.Parameters.AddWithValue("@Status", "Active");
                    cmd.Parameters.AddWithValue("@DateModified", DateTime.Now);
                    cmd.Parameters.AddWithValue("@Password", Helper.Hash("temppassword"));
                    cmd.Parameters.AddWithValue("@AccountNo", ltAccountNo.Text);
                    cmd.ExecuteNonQuery();
                    Helper.Log("Update", "Activated account '" + ltAccountNo.Text + "'.");
                    Session["update"] = "yes";

                    string URL     = Helper.GetURL() + "Account/SignIn";
                    string message = "Your account is now activated.<br/><br/." +
                                     "Please use the following credentials to sign in:<br/><br/>" +
                                     "Username: <strong>" + ltAccountNo.Text + "</strong> / <strong>" + ltEmail.Text + "</strong><br/>" +
                                     "Password: <strong>temppassword</strong><br/>" +
                                     "Website: <strong>https://project-capstone.azurewebsites.net</strong><br/><br/>" +
                                     "Please change your temporary password as soon as possible.<br/><br/>" +
                                     "Thank you.<br/><br/>" +
                                     "<hr/>" +
                                     "<small><em>Please do not reply to this email; this address is not monitored.</em></small>";
                    Helper.SendEmail(ltEmail.Text, "Account Activated", message);

                    Response.Redirect("~/Students");
                }
            }
        }

        else if (e.CommandName == "remove")
        {
            using (SqlConnection con = new SqlConnection(Helper.GetCon()))
            {
                con.Open();
                string query = @"UPDATE Students SET Status=@Status,
                DateModified=@DateModified
                WHERE Code=@Code AND AccountNo=@AccountNo";
                using (SqlCommand cmd = new SqlCommand(query, con))
                {
                    cmd.Parameters.AddWithValue("@Status", "Archived");
                    cmd.Parameters.AddWithValue("@DateModified", DateTime.Now);
                    cmd.Parameters.AddWithValue("@AccountNo", ltAccountNo.Text);
                    cmd.Parameters.AddWithValue("@Code", ltCode.Text);
                    cmd.ExecuteNonQuery();
                    Helper.Log("Delete", "Removed account '" + ltAccountNo.Text + "'.");
                    Session["update"] = "yes";
                    Response.Redirect("~/Students");
                }
            }
        }
    }