Esempio n. 1
0
    // Modify for Admin
    // render navigation on admin side
    public void BuildNavigationAdmin(int categoryID)
    {
        pnlNavi.Controls.Clear();
        var hlM = new HyperLink
                     {
                         NavigateUrl = UrlService.GetAdminAbsoluteLink("catalog.aspx?CategoryID=0"),
                         CssClass = "Link",
                         Text = Resource.Client_MasterPage_Catalog
                     };
        pnlNavi.Controls.Add(hlM);
        var categoryList = CategoryService.GetParentCategories(categoryID);
        for (var i = categoryList.Count - 1; i >= 0; i--)
        {
            var lblSeparator = new Label { CssClass = "Link", Text = @" > " };

            pnlNavi.Controls.Add(lblSeparator);

            var hl = new HyperLink
            {
                NavigateUrl = UrlService.GetAdminAbsoluteLink("catalog.aspx?CategoryID=" + categoryList[i].CategoryId),
                CssClass = "Link",
                Text = SQLDataHelper.GetString(categoryList[i].Name)
            };
            pnlNavi.Controls.Add(hl);
        }
    }
    // Project repeater data bound
    void projectRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        BusinessLogic.Project project = (BusinessLogic.Project)e.Item.DataItem;
        HtmlGenericControl imageContainer = (HtmlGenericControl)e.Item.FindControl("imgContainer");

        // Get project thumbnail
        HyperLink projectLink = new HyperLink();
        projectLink.NavigateUrl = "/give/projects/" + project.SeoURL;

        Image projectImage = new Image();
        projectImage.CssClass = "shadow";

        var thumbnail = project.RelatedMedias.FirstOrDefault(x => x.MediaType.Type == "Thumbnail");

        if (thumbnail != null)
        {
            projectImage.ImageUrl = ResolveUrl(thumbnail.URL);
            projectImage.AlternateText = thumbnail.DescriptionOrAltText;
        }
        else // Thumbnail not provided
        {
            projectImage.ImageUrl = ResolveUrl("~/Images/Project/NoImageProvided.jpg");
        }

        // Add image to container
        projectLink.Controls.Add(projectImage);
        imageContainer.Controls.Add(projectLink);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int itemid = Convert.ToInt16(Session["ItemID"]);

        SqlDataSource1.SelectCommand = "select image from newsitemsimages where id = " + itemid;
        DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
        if (dv.Table.Rows.Count != 0)
        {            
            Panel big_img = new Panel();
            big_img.Style.Add("float", "left");
            big_img.ID = "bigimg";
            Image big_img_url = new Image();
            big_img_url.ImageUrl = dv.Table.Rows[0][0].ToString();
            big_img.Controls.Add(big_img_url);
            picture.Controls.Add(big_img);
        }
        if (dv.Table.Rows.Count > 1) {
            Panel small_img = new Panel();
            small_img.Style.Add("float", "left");
            small_img.Style.Add("height", "70px");
            small_img.Style.Add("width", "255px");
            small_img.Style.Add("overflow-y", "scroll");
            small_img.ID = "smallimg";

            for (int i = 0; i < dv.Table.Rows.Count; i++)
            {
                HyperLink link = new HyperLink();
                link.NavigateUrl = "#";
                Image small_img_url = new Image();
                small_img_url.ImageUrl = dv.Table.Rows[i][0].ToString();
                link.Controls.Add(small_img_url);
                small_img.Controls.Add(link);
    
                //smallimg.Controls.Add(small_img); <div id="smallimg" style="float: left; height: 70px; width: 255px; overflow-y: scroll">
            }
            picture.Controls.Add(small_img);
        }

        SqlDataSource1.SelectCommand = "select content, price, gid, name from NewsItems where id = " + itemid;
        dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
        Div1.InnerText = dv.Table.Rows[0][0].ToString();
        Label3.Text = "$" + dv.Table.Rows[0][1].ToString();
        product_name.InnerText = "Product Detail for " + dv.Table.Rows[0][3];

        Session.Add("GID", dv.Table.Rows[0][2]);

        SqlDataSource1.SelectCommand = "select Poster, Content from comments where PostID = " + itemid + " order by Date DESC";
        dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
        foreach (DataRow comment in dv.Table.Rows)
        {
            TableRow row = new TableRow();
            TableCell name = new TableCell();
            TableCell text = new TableCell();
            name.Text = comment[0].ToString();
            text.Text = comment[1].ToString();
            row.Cells.Add(name);
            row.Cells.Add(text);
            comment_table.Rows.Add(row);
        }
    }
Esempio n. 4
0
    //gets the first 8 products in the products list and displays them on the latest products section
    public void getLatestProducts()
    {
        List<Product> p = (List<Product>)Session["Products"];

        try
        {
            for (int i = 0; i < 8; i++)
            {
                Product product = p[i];
                Image img = new Image();
                HyperLink link = new HyperLink();
                HtmlGenericControl a = new HtmlGenericControl("a");
                HtmlGenericControl newLi = new HtmlGenericControl("li");

                string prodID = Convert.ToString(product.ProdID);

                img.ImageUrl = product.ProdImage;
                img.ID = prodID;

                link.NavigateUrl = "Product.aspx?id=" + prodID;
                link.Controls.Add(img);

                newLi.Controls.Add(link);

                latestProducts.Controls.Add(newLi);
            }
        }
        catch (Exception)
        {

        }
    }
    private void cargar_botones_internos()
    {
        TableRow filaTabla;
        TableCell celdaTabla;
        HyperLink link;
        Image imagen;

        int contadorFilas = 0;

        filaTabla = new TableRow();
        filaTabla.ID = "row_" + contadorFilas.ToString();

        celdaTabla = new TableCell();
        celdaTabla.ID = "cell_1_row_" + contadorFilas.ToString();
        link = new HyperLink();
        link.ID = "link_salir";
        link.NavigateUrl = "javascript:window.close();";
        link.CssClass = "botones_menu_principal";
        imagen = new Image();
        imagen.ImageUrl = "~/imagenes/areas/bMenuSalirEstandar.png";
        imagen.Attributes.Add("onmouseover", "this.src='../imagenes/areas/bMenuSalirAccion.png'");
        imagen.Attributes.Add("onmouseout", "this.src='../imagenes/areas/bMenuSalirEstandar.png'");
        imagen.CssClass = "botones_menu_principal";
        link.Controls.Add(imagen);

        celdaTabla.Controls.Add(link);

        filaTabla.Cells.Add(celdaTabla);

        Table_MENU.Rows.Add(filaTabla);
    }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string ContentID = Request.QueryString["ContentID"].ToString();
        OA.OAService service=new OA.OAService();
        DataSet ds = service.FileContent_Select("Subject,Content,Attachment_ID,Attachment_Name", "Content_ID=" + ContentID, "");
        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        {
            lblText.Text = ds.Tables[0].Rows[0]["Subject"].ToString();
            tdContent.InnerHtml = ds.Tables[0].Rows[0]["Content"].ToString();

            // 添加附件信息
            string strDirName = ds.Tables[0].Rows[0]["Attachment_ID"].ToString();
            string strFiles = ds.Tables[0].Rows[0]["Attachment_Name"].ToString();

            string[] strfile = strFiles.Split('*');
            for (int i = 0; i < strfile.Length; i++)
            {
                // ../../OA/News/092/ckmsg.txt
                HyperLink hl = new HyperLink();
                string strPath = "..\\..\\..\\Attachment\\Files\\" + strDirName + "\\" + strfile[i];
                hl.NavigateUrl = strPath;
                hl.Text = strfile[i];
                hl.Style.Add("cursor", "hand");
                hl.Style.Add("font-Size", "14px");
                hl.Target = "black";
                DivAnnex.Controls.Add(hl);
                Label lbl = new Label();
                lbl.Width = 20;
                DivAnnex.Controls.Add(lbl);
            }
        }
    }
 public static HyperLink Create(string Path, string Text, string Content)
 {
     var link = new HyperLink(ROOT, Path);
     link.Text = Text;
     link.Content = Content;
     return link;
 }
    public void RowDataBound(object sender, GridRowEventArgs e)
    {
        if (e.Row.RowType == GridRowType.DataRow)
        {
            if (lastGroupHeader != null)
            {
                Literal textContainer = lastGroupHeader.Cells[0].Controls[0].Controls[lastGroupHeader.Cells[0].Controls[0].Controls.Count - 1].Controls[0] as Literal;
                textContainer.Text = ((GridDataControlFieldCell)e.Row.Cells[2]).Text;

                textContainer.Text += "&#160;&#187;&#160;";

                HyperLink link = new HyperLink();
                link.CssClass = "header-link";
                link.Attributes["onclick"] = "alert('In a real application the category form should open.')";
                link.NavigateUrl = "aspnet_grouping_custom_headers.aspx?CategoryID=" + ((GridDataControlFieldCell)e.Row.Cells[1]).Text;
                link.Text = "Edit Category";

                textContainer.Parent.Controls.Add(link);

                lastGroupHeader = null;
            }            
            
        }
        else if (e.Row.RowType == GridRowType.GroupHeader)
        {
            if (e.Row.GroupLevel == 0)
            {
                lastGroupHeader = e.Row;
            }
        }
        
    }
    protected void AddUrls(string strAppKey, string strName, string strIcon, int count)
    {
        HyperLink link = new HyperLink();
          
        link.ID = "CentrifyApp" + count;
        link.NavigateUrl = Session["NewPodURL"].ToString() + CentRunAppURL + strAppKey + "&Auth=" + Session["OTP"].ToString();
        link.Text = strName;

        //If image is unsecured global
        if (strIcon.Contains("vfslow"))
        {
            link.ImageUrl = Session["NewPodURL"].ToString() + strIcon;
        }
        else//If image needs a cookie or header to access
        {
            link.ImageUrl = "Helpers/GetSecureImage.aspx?Icon=" + strIcon;
        }
       
        link.ImageHeight = 75;
        link.ImageWidth = 75;

        if (count % 7 == 0)
        {
            Apps.Controls.Add(new LiteralControl("<br />"));
        }
        else
        {
            Apps.Controls.Add(new LiteralControl("&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"));

        }

        Apps.Controls.Add(link);
    }
Esempio n. 10
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);
        }
    }
    protected void setTable()
    {
        DataTable myDataTable = new DataTable();
        JobsModule myJobsModule = new JobsModule();
        myJobsModule.setUserId((String)Session["userId"]);

        myDataTable = myJobsModule.getEmployersJobPositions().Copy();

        myDataTable.Columns.Add("Delete", typeof(String)).SetOrdinal(0);
        myDataTable.Columns.Add("List of Applied Applicants", typeof(String)).SetOrdinal(4);

        JobPositionsGridView.DataSource = myDataTable;
        JobPositionsGridView.DataBind();

        foreach (GridViewRow row in JobPositionsGridView.Rows)
        {
            LinkButton lb = new LinkButton();
            lb.Text = "Delete";
            lb.Click += new EventHandler(LinkButtonClicked);
            row.Cells[0].Controls.Add(lb);

            HyperLink hp = new HyperLink();
            hp.Text = row.Cells[2].Text;
            hp.NavigateUrl = "~/ShowJobPositionsManager.aspx?pId=" + row.Cells[1].Text;
            row.Cells[2].Controls.Add(hp);

            HyperLink hp2 = new HyperLink();
            hp2.Text = "Show Applied Applicants";
            hp2.NavigateUrl = "~/ListOfAppliedApplicants.aspx?pId=" + row.Cells[1].Text;
            row.Cells[4].Controls.Add(hp2);
        }
    }
Esempio n. 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Unload += PageUnload;

        ronUtil2 get = new ronUtil2();

        DropDownList1.DataSource = get.getStudentIds();
        if(!IsPostBack)
        DropDownList1.DataBind();

        int[] ID = get.getAdvisorIDs();

        for (int ii = 0; ii < ID.Length; ii++)
        {
            TableCell[] td = new TableCell[8];
            HyperLink link = new HyperLink();
            link.NavigateUrl = "~/Schedule.aspx?AdvisorID=" + ID[ii];
            for (int i = 0; i < 8; i++) { td[i] = new TableCell(); }

            link.Text = get.getName(ID[ii]);
            link.ForeColor=System.Drawing.Color.Yellow;
        //    link.Font.Bold = true;
            td[0].Controls.Add(link);
            td[1].Text = get.getDepartment(ID[ii]);
            td[2].Text = get.getMonday(ID[ii]);
            td[3].Text = get.getTuesday(ID[ii]);
            td[4].Text = get.getWednesday(ID[ii]);
            td[5].Text = get.getThursday(ID[ii]);
            td[6].Text = get.getFriday(ID[ii]);

            TableRow tRow = new TableRow();
            myTable.Rows.Add(tRow);
            tRow.Cells.AddRange(td);
        }
    }
Esempio n. 13
0
 private HtmlTableCell AddSiteCellInnerHTML(string name, string banner, string url)
 {
     HtmlTableCell cell = new HtmlTableCell();
     Panel pnl = new Panel();
     pnl.CssClass = "sitesbanerhome";
     if(IsSitePage)
     {
         pnl.CssClass = "sitespagebaner";
     }
     HyperLink hl = new HyperLink();
     hl.NavigateUrl = url;
     hl.Attributes["rel"] = "nofollow";
     hl.Target = "_blank";
     if (banner != "")
     {
         Image i = new Image();
         i.ImageUrl = Path.Combine(Utils.GaleryImagePath, banner);
         hl.Controls.Add(i);
     }
     else
     {
         hl.Text = name;
     }
     pnl.Controls.Add(hl);
     cell.Controls.Add(pnl);
     return cell;
 }
Esempio n. 14
0
    // add selected users to selected role
    public static void AddSelectedUsersToSelectedRole(GridView GridView1, DropDownList ddlAddUsersToRole, HyperLink Msg)
    {
        foreach (GridViewRow row in GridView1.Rows)
        {
            CheckBox cb = (CheckBox)row.FindControl("chkRows");
            if (cb != null && cb.Checked)
            {
                // assign selected user names from gridview to variable
                string userName;
                userName = GridView1.DataKeys[row.RowIndex].Value.ToString();

                // if user already exist in the selected role, skip onto the others
                if (!Roles.IsUserInRole(userName, ddlAddUsersToRole.SelectedItem.Text))
                {
                    // the magic happens here!
                    Roles.AddUserToRole(userName, ddlAddUsersToRole.SelectedItem.Text);
                }

                Msg.Text = "User(s) were sucessfully <strong>ADDED</strong> to <strong>" + ddlAddUsersToRole.SelectedItem.Text.ToUpper() + "</strong> Role!";
                Msg.Visible = true;
            }

            // display message if no selection is made
            DisplayMessageIfNoSelectionIsMade(Msg, cb);
        }
    }
Esempio n. 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string absPath = MapPath("~/");
            try
            {
                int i = 0;
                foreach (string s in Directory.GetFiles(absPath))
                {
                    FileInfo fi = new FileInfo(s);

                    if (fi.Extension == ".aspx")
                    {
                        HyperLink hl = new HyperLink();
                        hl.Enabled = true;
                        hl.Text = fi.Name;
                   //     hl.Target = "_blank";
                        hl.NavigateUrl = fi.Name;
                        Label lbl = new Label();
                        lbl.Text = "&nbsp&nbsp&nbsp";
                        PlaceHolderHypLinks.Controls.Add(hl);
                        PlaceHolderHypLinks.Controls.Add(lbl);

                        i++;
                        if (i == 4)
                        {
                            Label lb = new Label();
                            lb.Text = "<br />";
                            PlaceHolderHypLinks.Controls.Add(lb);
                            i = 0;
                        }
                    }
                }
            }
            catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); }
    }
    private void cargar_menu_botones_internos()
    {
        tools _tools = new tools();
        SecureQueryString QueryStringSeguro;
        QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro());

        QueryStringSeguro["img_area"] = "contratacion";
        QueryStringSeguro["nombre_area"] = "CONTRATOS Y RELACIONES LABORALES";
        QueryStringSeguro["accion"] = "inicial";

        TableRow filaTabla;
        TableCell celdaTabla;
        HyperLink link;
        Image imagen;

        int contadorFilas = 0;

        filaTabla = new TableRow();
        filaTabla.ID = "row_" + contadorFilas.ToString();

        celdaTabla = new TableCell();
        celdaTabla.ID = "cell_1_row_" + contadorFilas.ToString();
        link = new HyperLink();
        link.ID = "link_ARP";
        QueryStringSeguro["nombre_modulo"] = "GENERAR AUTOLIQUIDACION";
        link.NavigateUrl = "~/contratacion/GenerarAutoliquidacion.aspx?data=" + HttpUtility.UrlEncode(QueryStringSeguro.ToString());
        link.CssClass = "botones_menu_principal";
        link.Target = "_blank";
        imagen = new Image();
        imagen.ImageUrl = "~/imagenes/areas/bGenerarAutoliquidacionEstandar.png";
        imagen.Attributes.Add("onmouseover", "this.src='../imagenes/areas/bGenerarAutoliquidacionAccion.png'");
        imagen.Attributes.Add("onmouseout", "this.src='../imagenes/areas/bGenerarAutoliquidacionEstandar.png'");
        imagen.CssClass = "botones_menu_principal";
        link.Controls.Add(imagen);

        celdaTabla.Controls.Add(link);

        filaTabla.Cells.Add(celdaTabla);

        celdaTabla = new TableCell();
        celdaTabla.ID = "cell_3_row_" + contadorFilas.ToString();
        link = new HyperLink();
        link.ID = "link_AFP";
        QueryStringSeguro["nombre_modulo"] = "REPORTES";
        link.NavigateUrl = "~/Reportes/autoliquidacion.aspx?data=" + HttpUtility.UrlEncode(QueryStringSeguro.ToString());
        link.CssClass = "botones_menu_principal";
        link.Target = "_blank";
        imagen = new Image();
        imagen.ImageUrl = "~/imagenes/areas/bReportesEstandar.png";
        imagen.Attributes.Add("onmouseover", "this.src='../imagenes/areas/bReportesAccion.png'");
        imagen.Attributes.Add("onmouseout", "this.src='../imagenes/areas/bReportesEstandar.png'");
        imagen.CssClass = "botones_menu_principal";
        link.Controls.Add(imagen);

        celdaTabla.Controls.Add(link);

        filaTabla.Cells.Add(celdaTabla);

        Table_MENU.Rows.Add(filaTabla);
    }
Esempio n. 17
0
    private void SetUserInGroupInfo(User user)
    {
        int[] groups = user.Groups;
        for (int i = 0; i < groups.Length; i++)
        {
            Group group = AdminServer.TheInstance.SecurityManager.GetGroup(groups[i]);

            TableRow row = new TableRow();
            TableCell cell = new TableCell();
            HyperLink linkRemoveGroup = new HyperLink();
            linkRemoveGroup.NavigateUrl = "UserGroup.aspx?userId=" + _user.SecurityObject.Id + "&groupId=" + group.SecurityObject.Id;
            linkRemoveGroup.Text = StringDef.Remove;
            linkRemoveGroup.SkinID = "SmallButton";
            cell.Controls.Add(linkRemoveGroup);
            row.Cells.Add(cell);
            cell = new TableCell();
            cell.Text = (i + 1).ToString();
            row.Cells.Add(cell);
            cell = new TableCell();
            cell.Text = group.SecurityObject.Id.ToString();
            row.Cells.Add(cell);
            cell = new TableCell();
            HyperLink linkEditGroup = new HyperLink();
            linkEditGroup.NavigateUrl = "EditGroup.aspx?groupId=" + group.SecurityObject.Id;
            linkEditGroup.Text = group.SecurityObject.Name;
            linkEditGroup.SkinID = "PlainText";
            cell.Controls.Add(linkEditGroup);
            row.Cells.Add(cell);
            cell = new TableCell();
            cell.Text = group.SecurityObject.Comment;
            row.Cells.Add(cell);

            TableUserInGroup.Rows.Add(row);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (projects_directory == null)
        {
            projects_directory = new Panel();

            // Generate Projects Row (bottom projects directory) based on contents of Projects folder
            string[] files = { "ConcurrentContainers", "WiiMotion", "GameBoyEmulator", "SerializeQueue", "BubbleGrow", "GreyWeaver", "PreviewLite" };
            foreach (string file_name in files)
            {
                Panel panel = new Panel();
                panel.CssClass = "col-sm-3 col-xs-6";

                HyperLink link = new HyperLink();
                link.NavigateUrl = "~/Projects/" + file_name + ".aspx";

                Image image = new Image();
                image.CssClass = "img-responsive portfolio-item";
                image.ImageUrl = "~/data/" + file_name + ".png";

                link.Controls.Add(image);
                panel.Controls.Add(link);
                projects_directory.Controls.Add(panel);
            }
        }

        ProjectsRow.Controls.Add(projects_directory);
    }
Esempio n. 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Connection String
        string connString = System.Configuration.ConfigurationManager.ConnectionStrings["database"].ConnectionString;
        SqlConnection conn = new SqlConnection(connString);
        string query = "SELECT * FROM Announcement ORDER BY date DESC, Time DESC";
        SqlCommand cmd2 = new SqlCommand();
        cmd2.Connection = conn;
        cmd2.CommandText = query;

        conn.Open();

        var reader2 = cmd2.ExecuteReader();

        while (reader2.Read())
        {
            string date = reader2["date"].ToString();
            Announcements.Controls.Add(new LiteralControl("<br/><b>" + reader2["announcement"].ToString() + "</b><br/>"));
            Announcements.Controls.Add(new LiteralControl("<br/>Date:&nbsp;&nbsp;" + date.Substring(0, 9) + "&nbsp;&nbsp;" + reader2["time"].ToString() + "<br/><br/><hr/>"));

            //Delete
            HyperLink hl1 = new HyperLink();
            hl1.ID = reader2["id"].ToString();
            hl1.Text = "Delete";
            hl1.CssClass = "more-link";
            hl1.NavigateUrl = "~/professor/deleteAnnouncements.aspx?id=" + reader2["id"].ToString();
            Announcements.Controls.Add(hl1);
            Announcements.Controls.Add(new LiteralControl("</br></br>"));
        }
    }
Esempio n. 20
0
    protected void submitComment(object sender, EventArgs e)
    {
        //Connection String
        string connString = System.Configuration.ConfigurationManager.ConnectionStrings["database"].ConnectionString;
        string query = "UPDATE studentAssignments set checked='yes',ta_comment=@comment WHERE UserId=@userid AND id=@id";

        //Get Connection
        SqlConnection conn = new SqlConnection(connString);
        conn.Open();

        SqlCommand cmd = new SqlCommand();
        cmd.Parameters.AddWithValue("@comment", comments.Text);
        cmd.Parameters.AddWithValue("@userid", Context.Request["userid"]);
        cmd.Parameters.AddWithValue("@id", Context.Request["id"]);
        cmd.Connection = conn;
        cmd.CommandText = query;
        cmd.ExecuteNonQuery();

        conn.Close();

        submittedGrade.Controls.Clear();

        HyperLink hl1 = new HyperLink();

        submittedGrade.Controls.Add(new LiteralControl("<br/> Comment Submitted Successfully<br/>"));
        hl1.NavigateUrl = "~/ta/studentAssignments.aspx";
        hl1.Text = "Go Back";
        submittedGrade.Controls.Add(hl1);
    }
Esempio n. 21
0
 public UniversalQuestion()
 {
     l = new Label();
     fl = new Label();
     fl.Visible = false;
     fh = new HyperLink();
     fh.Visible = false;
 }
Esempio n. 22
0
        public void Add_EntryWithMessage_Ok()
        {
            // Arrange:
            var entry = new HyperLink(new Uri("http://www.google.com"));

            // Act:
            this.repository.Add(entry);
        }
    protected void GetFeedsFrom(string FeedSource)
    {
        string url = null;

        switch (FeedSource)
        {
            case "Liiga":
                url = ConfigurationManager.AppSettings["rssfeeditSF"];
                break;
            case "Micro":
                url = ConfigurationManager.AppSettings["rssfeeditMS"];
                break;
            case "IS":
                url = ConfigurationManager.AppSettings["rssfeeditIS"];
                break;
            default:
                break;
        }

        lblBody.Text = url;
        //Luetaan XML XmlDocument olioon
        XmlDocument doc = new XmlDocument();
        myDataSource.DataFile = url;
        doc = myDataSource.GetXmlDocument();

        //1 Vaihe: Luetaan Channel title
        XmlNode node = doc.SelectSingleNode("/rss/channel");
        string otsikko = node["title"].InnerText;
        lblHeader.Text = otsikko;

        //2 Vaihe: Loopitetaan item-nodit läpi
        XmlNodeList nodes = doc.SelectNodes("/rss/channel/item");
        int i = 0;
        string rsstitle;
        string rsslink;

        foreach (XmlNode item in nodes)
        {
            i++;
            //uusi rivi tableen
            TableRow row = new TableRow();
            //riville kaksi solua, ekaan nro ja toiseen hyperlinkki
            TableCell cell = new TableCell();
            cell.Text = i.ToString();
            //toka
            TableCell cell2 = new TableCell();
            rsstitle = item["title"].InnerText;
            rsslink = item["link"].InnerText;
            HyperLink hl = new HyperLink();
            hl.Text = rsstitle;
            hl.NavigateUrl = rsslink;
            cell2.Controls.Add(hl);
            //Lisätään solut riville ja rivit tauluun
            row.Cells.Add(cell);
            row.Cells.Add(cell2);
            myDataTable.Rows.Add(row);
        }
    }
Esempio n. 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptManager.RegisterClientScriptBlock(
                Page,
                typeof(Page),
                "filter-client-script",
                String.Format(
                    @"<script pin=""pin"" type=""text/javascript"" src=""{0}""></script>",
                    Page.ClientScript.GetWebResourceUrl(typeof(Sage.SalesLogix.Client.GroupBuilder.BaseFilter), "Sage.SalesLogix.Client.GroupBuilder.jscript.Filter_ClientScript.js")
                ),
                false);
        /*
        ScriptManager.GetCurrent(Page).Scripts.Add(
            new ScriptReference("Sage.SalesLogix.Client.GroupBuilder.jscript.Filter_ClientScript.js",
            "Sage.SalesLogix.Client.GroupBuilder"));
        */

        IUserOptionsService _UserOptions = ApplicationContext.Current.Services.Get<IUserOptionsService>(true);
        StringBuilder script = new StringBuilder();
        script.AppendFormat(
            "\nvar {0};$(document).ready(function(){{if (!{0} && (Sage.FilterManager))\n{{ {0} = new Sage.FilterManager({{id: \"{0}\",clientId: \"{1}\", allText: \"({2})\"}});{0}.init();}}}});\n",
            ID, ClientID, GetLocalResourceObject("All").ToString());
        script.Append("var UserNameLookup={");
        IRepository<User> users = EntityFactory.GetRepository<User>();
        foreach (User u in users.FindAll())
            script.AppendFormat("\"{0}\": \"{1}, {2}\", ", u.Id, u.UserInfo.LastName, u.UserInfo.FirstName);
        script.Append("\"null\": \"null\"};\n");
        script.Append("var LocalizedActivityStrings={");
        string[] ActivityTypes = new string[] { "atToDo", "atAppointment", "atPhoneCall", "atPersonal" };
        foreach (string v in ActivityTypes)
            script.AppendFormat("\"{0}\": \"{1}\", ", v, GetLocalResourceObject(v).ToString());
        script.Append("\"null\": \"null\"};\n");
        script.AppendFormat("Sage.FilterStrings={{\"allText\": \"({0})\"}};\n",
                            GetLocalResourceObject("All").ToString());
        script.AppendFormat("Sage.AppliedActivityFilterData={0};\n", FilterManager.GetPersistedData(FilterManager.AppliedFiltersKey));
        script.AppendFormat("Sage.HiddenActivityFilterData={0};\n", FilterManager.GetPersistedData(FilterManager.HiddenFiltersKey));
        ScriptManager.RegisterStartupScript(this.Page, typeof(Page), ID, script.ToString(), true);

        HyperLink clear = new HyperLink();
        clear.NavigateUrl = string.Format("javascript:{0}.ClearFilters();", ID);
        clear.Attributes.Add("style", "display: block; margin-bottom: 0.5em");
        clear.Text = GetLocalResourceObject("Clear_Filters").ToString();
        this.Controls.Add(clear);

        string[] ActivityEntities = { "Activity", "UserNotification", "LitRequest", "Event" };
        foreach (string table in ActivityEntities)
        {
            IList<BaseFilter> filterList = FilterManager.GetFiltersForEntity(table, this.Page.Server.MapPath(@"Filters\"));
            foreach (BaseFilter f in filterList)
            {
                this.Controls.Add(f);
            }
        }

        edit.NavigateUrl = string.Format("javascript:{0}.EditFilters();", ID);
        edit.Text = GetLocalResourceObject("Edit_Filters").ToString();
        Page.Header.Controls.Add(new LiteralControl("<link href='SmartParts/TaskPane/Filters/Filters.css' rel='stylesheet' type='text/css' />"));
    }
Esempio n. 25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Panel pnl_item = new Panel();
     HyperLink hlink_alltext = new HyperLink();
     hlink_alltext.Text = "地图";
     hlink_alltext.NavigateUrl = "right.aspx";
     pnl_item.Controls.Add(hlink_alltext);
     div_left.Controls.Add(pnl_item);
 }
 private Control CreateHyperLink(DateTime date)
 {
     HyperLink link = new HyperLink();
     link.Text = date.Day.ToString();
     link.NavigateUrl = string.Format("javascript:ShowNotes('{0}');", date.ToString("M/d/yyyy", CultureInfo.InvariantCulture));
     link.Style[HtmlTextWriterStyle.Display] = "block";
     link.Style[HtmlTextWriterStyle.Padding] = "4px";
     return link;
 }
 protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
 {
     string ctrl = Request.QueryString["ctl"];
     HyperLink hpl = new HyperLink();
     hpl.Text = ((LiteralControl)e.Cell.Controls[0]).Text;
     hpl.NavigateUrl = "javascript:SetDate('" + e.Day.Date.ToShortDateString() + "','" + ctrl + "');";
     e.Cell.Controls.Clear();
     e.Cell.Controls.Add(hpl);
 }
    protected void assignment_select_change(object sender, EventArgs e)
    {
        //Connection String
        string connString = System.Configuration.ConfigurationManager.ConnectionStrings["database"].ConnectionString;
        string query = "SELECT * FROM studentAssignments WHERE id=@id ORDER BY dateOfSubmission DESC";

        //Get Connection
        SqlConnection conn = new SqlConnection(connString);
        conn.Open();

        SqlCommand cmd = new SqlCommand();
        cmd.Parameters.AddWithValue("@id", assignmentNumber.SelectedValue);
        cmd.Connection = conn;
        cmd.CommandText = query;
        var reader = cmd.ExecuteReader();

        int i = 1;

        while (reader.Read())
        {
            assignments.Controls.Add(new LiteralControl("<h2>"+reader["username"].ToString() + "</h2>"));

            //File Link
            HyperLink hl = new HyperLink();
            hl.ID = "Hyperlink" + i++;
            hl.Text = reader["name"].ToString() + ".zip";
            hl.NavigateUrl = "~/common/getStudentAssignments.ashx?id="+reader["id"].ToString()+"&UserId=" + reader["Userid"].ToString();
            hl.Target = "_blank";
            hl.CssClass = "more-link";
            assignments.Controls.Add(hl);
            if (reader["late"].Equals("yes"))
                assignments.Controls.Add(new LiteralControl("<br/><br/> <b>Late Submission</b>"));
            else
                assignments.Controls.Add(new LiteralControl("<br/>"));

            assignments.Controls.Add(new LiteralControl("</br>"));
            assignments.Controls.Add(new LiteralControl("Due Date of Submission: &nbsp;&nbsp;" + reader["dateOfSubmission"].ToString() + "<br/>"));

            if(reader["checked"].ToString().Equals("no"))
            {

                HyperLink hl1 = new HyperLink();

                hl1.NavigateUrl = "~/ta/submitComment.aspx?UserId=" + reader["Userid"].ToString() + "&id=" + reader["id"].ToString() +"&name="+reader["username"].ToString();
                assignments.Controls.Add(hl1);
                hl1.Text = "Submit Comment to Professor";
                hl1.CssClass = "more-link";
                assignments.Controls.Add(new LiteralControl("<br/><br/><hr/>"));

            }
            else
                assignments.Controls.Add(new LiteralControl("<br/><b>Assignment Graded</b><br/>"));

        }
        conn.Close();
    }
Esempio n. 29
0
 protected void SellersGridView_RowDataBound(Object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         HyperLink hlControl = new HyperLink();
         hlControl.Text = e.Row.Cells[2].Text;
         hlControl.NavigateUrl = "~/AdminPrivate/GiftCards.aspx?SellerID=" + e.Row.Cells[7].Text;
         e.Row.Cells[2].Controls.Add(hlControl);
     }
 }
Esempio n. 30
0
 private HtmlTableCell AddCityCellInnerHTML(string name, string countryName, string name_en)
 {
     HtmlTableCell cell = new HtmlTableCell();
     HyperLink hl = new HyperLink();
     hl.NavigateUrl = SiteURL + "/" + Utils.GenerateFriendlyURL("city", new string[] {
                    countryName, name_en}, false); ;
     hl.Text = name;
     cell.Controls.Add(hl);
     return cell;
 }
Esempio n. 31
0
    private void FileUpLoadApp(string ChkType, FileUpload UpLoadBar, TextBox UpLoadText, string UpLoadStr, string UpLoadType, System.Web.UI.WebControls.Image UpLoadView, HyperLink UpLoadLink)
    {
        GBClass001 MyBassAppPj = new GBClass001();
        string     SwcFileName = "";
        string     CaseId      = LBSWC000.Text + "";

        if (UpLoadBar.HasFile)
        {
            string filename = UpLoadBar.FileName;   // UpLoadBar.FileName 只有 "檔案名稱.附檔名",並沒有 Client 端的完整理路徑

            string extension = Path.GetExtension(filename).ToLowerInvariant();

            // 判斷是否為允許上傳的檔案附檔名

            switch (ChkType)
            {
            case "DOC":
                List <string> allowedExtextsion02 = new List <string> {
                    ".pdf", ".odt", ".xls", ".xlsx", ".doc", ".docx"
                };

                if (allowedExtextsion02.IndexOf(extension) == -1)
                {
                    error_msg.Text = MyBassAppPj.AlertMsg("請選擇pdf、odt或doc檔案格式上傳,謝謝!!");
                    return;
                }
                // 限制檔案大小,限制為 50MB
                int filesize2 = UpLoadBar.PostedFile.ContentLength;

                if (filesize2 > 50000000)
                {
                    error_msg.Text = MyBassAppPj.AlertMsg("請選擇 50 Mb 以下檔案上傳,謝謝!!");
                    return;
                }
                break;
            }


            // 檢查 Server 上該資料夾是否存在,不存在就自動建立
            string serverDir = ConfigurationManager.AppSettings["SwcFileTemp"] + CaseId;

            if (Directory.Exists(serverDir) == false)
            {
                Directory.CreateDirectory(serverDir);
            }

            Session[UpLoadStr] = "有檔案";
            //SwcFileName = CaseId + UpLoadType + System.IO.Path.GetExtension(UpLoadBar.FileName);
            SwcFileName     = CaseId + UpLoadType + System.IO.Path.GetExtension(UpLoadBar.FileName);
            UpLoadText.Text = SwcFileName;

            // 判斷 Server 上檔案名稱是否有重覆情況,有的話必須進行更名
            // 使用 Path.Combine 來集合路徑的優點
            //  以前發生過儲存 Table 內的是 \\ServerName\Dir(最後面沒有 \ 符號),
            //  直接跟 FileName 來進行結合,會變成 \\ServerName\DirFileName 的情況,
            //  資料夾路徑的最後面有沒有 \ 符號變成還需要判斷,但用 Path.Combine 來結合的話,
            //  資料夾路徑沒有 \ 符號,會自動補上,有的話,就直接結合

            string serverFilePath = Path.Combine(serverDir, SwcFileName);
            string fileNameOnly   = Path.GetFileNameWithoutExtension(SwcFileName);
            int    fileCount      = 1;

            //while (File.Exists(serverFilePath))
            //{
            //    // 重覆檔案的命名規則為 檔名_1、檔名_2 以此類推
            //    filename = string.Concat(fileNameOnly, "_", fileCount, extension);
            //    serverFilePath = Path.Combine(serverDir, filename);
            //    fileCount++;
            //}

            // 把檔案傳入指定的 Server 內路徑
            try
            {
                UpLoadBar.SaveAs(serverFilePath);
                //error_msg.Text = "檔案上傳成功";

                switch (ChkType)
                {
                case "DOC":
                    UpLoadLink.Text        = SwcFileName;
                    UpLoadLink.NavigateUrl = "..\\UpLoadFiles\\temp\\" + CaseId + "\\" + SwcFileName + "?ts=" + System.DateTime.Now.Millisecond;
                    UpLoadLink.Visible     = true;
                    break;
                }
            }
            catch (Exception ex)
            {
                //error_msg.Text = "檔案上傳失敗";
            }
        }
        else
        {
            Session[UpLoadStr] = "";
        }
    }
    /// <summary>
    /// Unigrid external databound handler.
    /// </summary>
    protected object UniGrid_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerCSafe())
        {
        // Display link instead of title
        case "title":
            if (parameter != DBNull.Value)
            {
                DataRowView row   = (DataRowView)parameter;
                string      url   = ValidationHelper.GetString(row["ReportURL"], "");
                string      title = HTMLHelper.HTMLEncode(ValidationHelper.GetString(row["ReportTitle"], ""));

                HyperLink link    = new HyperLink();
                string    culture = ValidationHelper.GetString(row["ReportCulture"], "");
                if (culture != String.Empty)
                {
                    url = URLHelper.AddParameterToUrl(url, URLHelper.LanguageParameterName, culture);
                }
                link.NavigateUrl = url;
                link.Target      = "_blank";
                link.Text        = title;
                link.ToolTip     = HTMLHelper.HTMLEncode(url);
                link.Style.Add("cursor", "help");
                return(link);
            }
            return(sourceName);

        // Insert status label
        case "status":
            if (parameter != DBNull.Value)
            {
                switch (parameter.ToString().ToLowerCSafe())
                {
                default:
                    return(ResHelper.GetString("general.new"));

                case "1":
                    return("<span class=\"AbuseSolved\">" + ResHelper.GetString("general.solved") + "</span>");

                case "2":
                    return("<span class=\"AbuseRejected\">" + ResHelper.GetString("general.rejected") + "</span>");
                }
            }
            return(sourceName);

        case "solve":
            if (parameter != DBNull.Value)
            {
                string status = ValidationHelper.GetString(((DataRowView)((GridViewRow)parameter).DataItem).Row["ReportStatus"], "");
                var    button = ((CMSGridActionButton)sender);
                switch (status)
                {
                // Disables the button and changes its icon
                case "1":
                    button.Enabled = false;
                    break;

                case "2":
                    button.Enabled = true;
                    break;
                }
            }
            break;

        case "reject":
            if (parameter != DBNull.Value)
            {
                string status = ValidationHelper.GetString(((DataRowView)((GridViewRow)parameter).DataItem).Row["ReportStatus"], "");
                var    button = ((CMSGridActionButton)sender);

                switch (status)
                {
                // Disables the button and changes its icon
                case "1":
                    button.Enabled = true;
                    break;

                case "2":
                    button.Enabled = false;
                    break;
                }
            }
            break;

        case "objecttype":
            string objectType = ImportExportHelper.GetSafeObjectTypeName(parameter.ToString());
            if (!string.IsNullOrEmpty(objectType))
            {
                parameter = ResHelper.GetString("ObjectType." + objectType);
            }
            else
            {
                return("-");
            }
            break;

        case "comment":
            string resultText = parameter.ToString();
            parameter = HTMLHelper.HTMLEncode(TextHelper.LimitLength(resultText, 297, "..."));
            break;
        }

        return(parameter.ToString());
    }
Esempio n. 33
0
        private void CargarData()
        {
            idAccidente = objUtilidades.descifrarCadena(Request.QueryString["id"]);
            List <at_it_el_pa> ListAccidentes = new List <at_it_el_pa>();

            ListAccidentes = Mgr_Acc_Inc.Get_Accidente(idAccidente);

            foreach (var item in ListAccidentes)
            {
                lbSucursal.Text   = item.trabajador.puesto_trabajo.area.sucursal.nombre;
                lbEmpresa.Text    = item.trabajador.puesto_trabajo.area.sucursal.empresa.nombre;
                txtFechaAcc.Text  = item.fecha_accidente.Value.ToString("yyyy-MM-dd");
                txtHoraAcc.Text   = item.hora_accidente.Value.ToString("hh:mm:ss");
                lbTrabajador.Text = item.trabajador.primer_nombre + " " + item.trabajador.primer_apellido;

                if (item.id_area == 0)
                {
                    lbArea.Text = "Ninguno";
                }
                else
                {
                    lbArea.Text = item.area.nombre;
                }

                if (item.id_puesto == 0)
                {
                    lbPuestoTrabajo.Text = "Ninguno";
                }
                else
                {
                    lbPuestoTrabajo.Text = item.puesto_trabajo.nombre;
                }

                txtSitioIncidente.Text = item.sitio;
                txtDescTarea.Text      = item.descripcion;
                txtCondIns.Text        = item.condiciones_inseguras;
                txtActos.Text          = item.actos_inseguros;
                txtFacTrab.Text        = item.factores_inseguros;
                txtFactPersonales.Text = item.factores_personales;


                txtDiasIncapacidad.Text     = Convert.ToString(item.dias_incapacidad);
                txtDiasCargados.Text        = Convert.ToString(item.dias_cargados);
                txtDiasPerdidosAusTrab.Text = Convert.ToString(item.dias_perdidos_ausencia);
                txtDiasPerdidosctRest.Text  = Convert.ToString(item.dias_perdidos_restingido);

                if (Convert.ToString(item.tipo_enfermedad) == "A")
                {
                    lbTipoEnfermedad.Text = "Enfermedades en la piel";
                }
                else if (Convert.ToString(item.tipo_enfermedad) == "B")
                {
                    lbTipoEnfermedad.Text = "Enfermedades respiratorias";
                }
                else if (Convert.ToString(item.tipo_enfermedad) == "C")
                {
                    lbTipoEnfermedad.Text = "Envenenamiento";
                }
                else if (Convert.ToString(item.tipo_enfermedad) == "D")
                {
                    lbTipoEnfermedad.Text = "Enfermedades debidas a agentes físicos";
                }
                else if (Convert.ToString(item.tipo_enfermedad) == "E")
                {
                    lbTipoEnfermedad.Text = "Enfermedades producidas por traumas repetitivos";
                }
                else if (Convert.ToString(item.tipo_enfermedad) == "F")
                {
                    lbTipoEnfermedad.Text = "Otras enfermedades osteomusculares";
                }
                else if (Convert.ToString(item.tipo_enfermedad) == "G")
                {
                    lbTipoEnfermedad.Text = "Demás enfermedades profesionales";
                }

                if (Convert.ToString(item.dias_no_perdidos) == "true")
                {
                    chkSinDias.Text = "Si";
                }
                else
                {
                    chkSinDias.Text = "No";
                }

                int contadorArchivos = 0;
                ControlesDinamicos.CrearLiteral("<ul>", pSoportes);

                HyperLink HyperLink1;
                foreach (var item1 in item.soporte)
                {
                    contadorArchivos++;
                    ControlesDinamicos.CrearLiteral("<li>", pSoportes);
                    HyperLink1             = new HyperLink();
                    HyperLink1.NavigateUrl = item1.url;
                    HyperLink1.Target      = "_blank";
                    HyperLink1.Text        = "Archivo " + contadorArchivos;
                    pSoportes.Controls.Add(HyperLink1);
                    ControlesDinamicos.CrearLiteral("</ li >", pSoportes);
                }
                ControlesDinamicos.CrearLiteral("</ ul > ", pSoportes);
            }
        }
Esempio n. 34
0
        protected void rpt_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Recipe recipe;

            MyBuyList.Shared.Entities.Menu menu;

            recipe = e.Item.DataItem as Recipe;

            if (recipe == null)
            {
                menu = e.Item.DataItem as MyBuyList.Shared.Entities.Menu;
                HyperLink lblMenuName = e.Item.FindControl("lblMenuName") as HyperLink;
                if (lblMenuName != null)
                {
                    lblMenuName.NavigateUrl += menu.MenuId;
                    if (menu.MenuName.Length > 23)
                    {
                        lblMenuName.Text = menu.MenuName.TrimToMax(23);
                    }
                    else
                    {
                        lblMenuName.Text = menu.MenuName;
                    }
                }

                HyperLink lnkRecentMenuPic = e.Item.FindControl("lnkRecentMenuPic") as HyperLink;
                if (lnkRecentMenuPic != null)
                {
                    lnkRecentMenuPic.NavigateUrl += menu.MenuId;
                }

                Image imgThumbnail = e.Item.FindControl("imgThumbnail") as Image;
                if (imgThumbnail != null)
                {
                    imgThumbnail.ImageUrl = ResolveUrl(menu.Picture != null ? string.Format("~/ShowPicture.ashx?MenuId={0}", menu.MenuId) : "~/Images/Img_Default.jpg");
                }
            }
            else
            {
                HyperLink lblRecipeName = e.Item.FindControl("lblRecipeName") as HyperLink;
                if (lblRecipeName != null)
                {
                    lblRecipeName.NavigateUrl += recipe.RecipeId;
                    if (recipe.RecipeName.Length > 23)
                    {
                        lblRecipeName.Text = recipe.RecipeName.TrimToMax(23);
                    }
                    else
                    {
                        lblRecipeName.Text = recipe.RecipeName;
                    }
                }

                HyperLink lnkRecentRecipePic = e.Item.FindControl("lnkRecentRecipePic") as HyperLink;
                if (lnkRecentRecipePic != null)
                {
                    lnkRecentRecipePic.NavigateUrl += recipe.RecipeId;
                }

                Image imgThumbnail = e.Item.FindControl("imgThumbnail") as Image;
                if (imgThumbnail != null)
                {
                    imgThumbnail.ImageUrl = ResolveUrl(recipe.Picture != null ? string.Format("~/ShowPicture.ashx?RecipeId={0}", recipe.RecipeId) : "~/Images/Img_Default.jpg");
                }
            }
        }
Esempio n. 35
0
        protected void createTable(int count)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("ID", typeof(string));
            dt.Columns.Add("Time", typeof(string));
            dt.Columns.Add("Title", typeof(string));
            dt.Columns.Add("Type", typeof(string));
            dt.Columns.Add("Creator", typeof(string));
            string id = "", title = "", type = "", creator = "", time = "";

            connect.Open();
            SqlCommand cmd = connect.CreateCommand();

            for (int i = 1; i <= count; i++)
            {
                //Get the topic ID:
                cmd.CommandText = "select [topicId] from(SELECT rowNum = ROW_NUMBER() OVER(ORDER BY topicId ASC), * FROM [Topics] where topic_isApproved = 1 and topic_isDenied = 0 and topic_isDeleted = 0) as t where rowNum = '" + i + "'";
                id = cmd.ExecuteScalar().ToString();
                //Get type:
                cmd.CommandText = "select [topic_time] from(SELECT rowNum = ROW_NUMBER() OVER(ORDER BY topicId ASC), * FROM [Topics] where topic_isApproved = 1 and topic_isDenied = 0 and topic_isDeleted = 0) as t where rowNum = '" + i + "'";
                time            = cmd.ExecuteScalar().ToString();
                //Get title:
                cmd.CommandText = "select [topic_title] from(SELECT rowNum = ROW_NUMBER() OVER(ORDER BY topicId ASC), * FROM [Topics] where topic_isApproved = 1 and topic_isDenied = 0 and topic_isDeleted = 0) as t where rowNum = '" + i + "'";
                title           = cmd.ExecuteScalar().ToString();
                //Get type:
                cmd.CommandText = "select [topic_type] from(SELECT rowNum = ROW_NUMBER() OVER(ORDER BY topicId ASC), * FROM [Topics] where topic_isApproved = 1 and topic_isDenied = 0 and topic_isDeleted = 0) as t where rowNum = '" + i + "'";
                type            = cmd.ExecuteScalar().ToString();
                //Get creator's ID:
                cmd.CommandText = "select [topic_createdBy] from(SELECT rowNum = ROW_NUMBER() OVER(ORDER BY topicId ASC), * FROM [Topics] where topic_isApproved = 1 and topic_isDenied = 0 and topic_isDeleted = 0) as t where rowNum = '" + i + "'";
                string creatorId = cmd.ExecuteScalar().ToString();
                //Get creator's name:
                cmd.CommandText = "select user_firstname from users where userId = '" + creatorId + "' ";
                creator         = cmd.ExecuteScalar().ToString();
                cmd.CommandText = "select user_lastname from users where userId = '" + creatorId + "' ";
                creator         = creator + " " + cmd.ExecuteScalar().ToString();
                if (!type.Equals("Consultation"))
                {
                    dt.Rows.Add(id, Layouts.getTimeFormat(time), title, type, creator);
                }
            }
            grdTopics.DataSource = dt;
            grdTopics.DataBind();
            //grdTopics.AutoGenerateColumns = true;
            //Hide the header called "ID":
            grdTopics.HeaderRow.Cells[1].Visible = false;
            //Hide IDs column and content which are located in column index 1:
            for (int i = 0; i < grdTopics.Rows.Count; i++)
            {
                grdTopics.Rows[i].Cells[1].Visible = false;
            }
            for (int row = 0; row < grdTopics.Rows.Count; row++)
            {
                id = grdTopics.Rows[row].Cells[1].Text;
                //Get creator's ID:
                cmd.CommandText = "select [topic_createdBy] FROM [Topics] where topicId = " + id + " ";
                string creatorId = cmd.ExecuteScalar().ToString();
                //Get creator's name:
                cmd.CommandText = "select user_firstname from users where userId = '" + creatorId + "' ";
                creator         = cmd.ExecuteScalar().ToString();
                cmd.CommandText = "select user_lastname from users where userId = '" + creatorId + "' ";
                creator         = creator + " " + cmd.ExecuteScalar().ToString();
                HyperLink creatorLink = new HyperLink();
                creatorLink.Text = creator + " ";
                //creatorLink.NavigateUrl = "Profile.aspx?id=" + creatorId;
                grdTopics.Rows[row].Cells[5].Controls.Add(creatorLink);
            }
            connect.Close();
        }
Esempio n. 36
0
        /// <summary>
        /// Render The GuestBar
        /// </summary>
        private void RenderGuestControls()
        {
            if (!this.PageContext.IsGuest)
            {
                return;
            }

            this.GuestUserMessage.Visible = true;

            this.GuestMessage.Text = this.GetText("TOOLBAR", "WELCOME_GUEST_FULL");

            var endPoint = new Label {
                Text = "."
            };

            var isLoginAllowed    = false;
            var isRegisterAllowed = false;

            if (Config.IsAnyPortal)
            {
                this.GuestMessage.Text = this.GetText("TOOLBAR", "WELCOME_GUEST");
            }
            else
            {
                if (Config.AllowLoginAndLogoff)
                {
                    // show login
                    var loginLink = new HyperLink
                    {
                        Text    = this.GetText("TOOLBAR", "LOGIN"),
                        ToolTip = this.GetText("TOOLBAR", "LOGIN")
                    };

                    if (this.Get <YafBoardSettings>().UseLoginBox&& !(this.Get <IYafSession>().UseMobileTheme ?? false))
                    {
                        loginLink.NavigateUrl = "javascript:void(0);";

                        loginLink.CssClass = "LoginLink";
                    }
                    else
                    {
                        var returnUrl = this.GetReturnUrl().IsSet()
                                               ? "ReturnUrl={0}".FormatWith(this.GetReturnUrl())
                                               : string.Empty;

                        loginLink.NavigateUrl = !this.Get <YafBoardSettings>().UseSSLToLogIn
                                                    ? YafBuildLink.GetLinkNotEscaped(ForumPages.login, returnUrl)
                                                    : YafBuildLink.GetLinkNotEscaped(ForumPages.login, true, returnUrl)
                                                .Replace("http:", "https:");
                    }

                    this.GuestUserMessage.Controls.Add(loginLink);

                    isLoginAllowed = true;
                }

                if (!this.Get <YafBoardSettings>().DisableRegistrations)
                {
                    if (isLoginAllowed)
                    {
                        this.GuestUserMessage.Controls.Add(
                            new Label {
                            Text = "&nbsp;{0}&nbsp;".FormatWith(this.GetText("COMMON", "OR"))
                        });
                    }

                    // show register link
                    var registerLink = new HyperLink
                    {
                        Text        = this.GetText("TOOLBAR", "REGISTER"),
                        NavigateUrl =
                            this.Get <YafBoardSettings>().ShowRulesForRegistration
                                ? YafBuildLink.GetLink(ForumPages.rules)
                                : (!this.Get <YafBoardSettings>().UseSSLToRegister
                                       ? YafBuildLink.GetLink(ForumPages.register)
                                       : YafBuildLink.GetLink(ForumPages.register, true).Replace("http:", "https:"))
                    };

                    this.GuestUserMessage.Controls.Add(registerLink);

                    this.GuestUserMessage.Controls.Add(endPoint);

                    isRegisterAllowed = true;
                }
                else
                {
                    this.GuestUserMessage.Controls.Add(endPoint);

                    this.GuestUserMessage.Controls.Add(
                        new Label {
                        Text = this.GetText("TOOLBAR", "DISABLED_REGISTER")
                    });
                }

                // If both disallowed
                if (isLoginAllowed || isRegisterAllowed)
                {
                    return;
                }

                this.GuestUserMessage.Controls.Clear();
                this.GuestUserMessage.Controls.Add(
                    new Label {
                    Text = this.GetText("TOOLBAR", "WELCOME_GUEST_NO")
                });
            }
        }
Esempio n. 37
0
    public void DataPage(string sqlcom, DataList MarketDetailDl, Label lblCurPage, Label lblTnum, Label lblEachPage, HyperLink lnkFirst, HyperLink lnkLast, HyperLink lnkPrev, HyperLink lnkNext, HttpRequest Request)
    {
        DataAccess data = new DataAccess();

        data.Connection();
        SqlCommand cmd = data.excute(sqlcom);
        DataSet    ds  = data.Fill(cmd);

        MarketDetailDl.DataSource = ds.Tables[0].DefaultView;
        MarketDetailDl.DataBind();
        PagedDataSource objPage = new PagedDataSource();     //创建分页类

        objPage.DataSource = ds.Tables["Table"].DefaultView; //设置数据源

        objPage.AllowPaging = true;
        objPage.PageSize    = 5;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            CurPage = Math.Min(CurPage, objPage.PageCount);
            CurPage = Math.Max(CurPage, 1);
        }
        else
        {
            CurPage = 1;
        }
        objPage.CurrentPageIndex = CurPage - 1;
        TotalPage        = objPage.PageCount;
        Tnum             = objPage.DataSourceCount;
        EachPage         = objPage.Count;
        lblCurPage.Text  = "第 " + CurPage.ToString() + " / " + TotalPage.ToString() + " 页";
        lblTnum.Text     = "共: " + Tnum + " 条记录";
        lblEachPage.Text = "每页有: " + EachPage.ToString() + " 条记录";

        if (objPage.CurrentPageIndex != 0)
        {
            lnkFirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - CurPage + 1);
        }
        if (objPage.CurrentPageIndex != TotalPage - 1)
        {
            lnkLast.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(TotalPage);
        }

        if (!objPage.IsFirstPage)
        {
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        }
        if (!objPage.IsLastPage)
        {
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
        }

        MarketDetailDl.DataSource = objPage;
        MarketDetailDl.DataBind();
    }
Esempio n. 38
0
        /// <summary>
        /// ItemDataBound
        /// </summary>
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string        img, alt, publishedTask;
                HtmlTableRow  tr  = (HtmlTableRow)e.Item.FindControl("trList");
                HtmlInputText txt = null;
                if (e.Item.ItemIndex % 2 == 0)
                {
                    tr.Attributes.Add("class", "even");
                }
                else
                {
                    tr.Attributes.Add("class", "old");
                }

                try
                {
                    PNK_ProductCategory data = (PNK_ProductCategory)e.Item.DataItem;

                    //Role
                    Literal ltr = null;
                    ltr      = (Literal)e.Item.FindControl("ltrchk");
                    ltr.Text = string.Format(@"<INPUT class='txt' TYPE='checkbox' ID='cb{0}' NAME='cid[]' value='{1}' onclick='isChecked(this.checked);' >",
                                             e.Item.ItemIndex, data.Id);

                    //Check
                    if (data.Published == "1")
                    {
                        img           = "tick.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "unpublish";
                    }
                    else
                    {
                        img           = "publish_x.png";
                        alt           = LocalizationUtility.GetText(ltrAminUnPublish.Text);
                        publishedTask = "publish";
                    }

                    //Order
                    txt       = (HtmlInputText)e.Item.FindControl("txtOrder");
                    txt.Value = DBConvert.ParseString(data.Ordering);

                    //Id
                    HtmlInputButton btId = (HtmlInputButton)e.Item.FindControl("btId");
                    btId.Value = DBConvert.ParseString(data.Id);

                    //Base img
                    HtmlImage baseImage = (HtmlImage)e.Item.FindControl("baseImage");
                    baseImage.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductCategoryUpload"], data.BaseImage);
                    HtmlAnchor hypBaseImage = (HtmlAnchor)e.Item.FindControl("hypBaseImage");

                    //set link
                    HyperLink hdflink = new HyperLink();
                    hdflink           = (HyperLink)e.Item.FindControl("hdflink");
                    hypBaseImage.HRef = hdflink.NavigateUrl = template_path + LinkHelper.GetAdminLink("edit_productcategory", data.Id);

                    //HtmlTableCell td = (HtmlTableCell)e.Item.FindControl("tdName");
                    //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'Edit')", e.Item.ItemIndex));
                    //td = (HtmlTableCell)e.Item.FindControl("trUpdateDate");
                    //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'Edit')", e.Item.ItemIndex));
                    ImageButton imgctr = (ImageButton)e.Item.FindControl("btnPublish");
                    imgctr.ImageUrl = string.Format("/Admin/images/{0}", img);
                    imgctr.Attributes.Add("alt", alt);
                    HtmlTableCell btn = (HtmlTableCell)e.Item.FindControl("tdbtn");
                    btn.Attributes.Add("onclick", string.Format(" return listItemTask('cb{0}', '{1}')", e.Item.ItemIndex, publishedTask));

                    //Name
                    ltr = (Literal)e.Item.FindControl("ltrName");
                    hypBaseImage.Attributes["title"] = baseImage.Alt = baseImage.Attributes["title"] = ltr.Text = data.ProductCategoryDesc.TreeNameDesc;
                    // Utils.GetScmplitBySpace(data.ProductCategoryDesc.Name, data.PathTree);
                    //Server.HtmlDecode(getScmplit(data.Lvl) + "&bull; | " + data.Lvl + " | " + data.ProductCategoryDesc.Name);
                }
                catch { }
            }
        }
Esempio n. 39
0
        protected void getHouse(string sql, string sql1, string sql2)
        {
            SqlConnection con = new SqlConnection();

            con.ConnectionString = "server=.;database=Rent;uid=Rent;pwd=Rent;";
            con.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection = con;
            SqlDataAdapter da = new SqlDataAdapter(sql, con);
            DataTable      dt = new DataTable();

            da.Fill(dt);

            System.Web.UI.WebControls.Image HouseImage = new System.Web.UI.WebControls.Image();
            HouseImage.ImageUrl = dt.Rows[0].ItemArray[15].ToString();
            HouseImage.Width    = 710;
            HouseImage.Height   = 445;
            Label ltitle = new Label();

            ltitle.Text = dt.Rows[0].ItemArray[17].ToString();
            Label lprice = new Label();

            lprice.Text = dt.Rows[0].ItemArray[9].ToString() + "元/月";
            Label ltype = new Label();

            ltype.Text = dt.Rows[0].ItemArray[8].ToString();
            Label larea = new Label();

            larea.Text = dt.Rows[0].ItemArray[10].ToString() + "㎡";
            Label laddress = new Label();

            laddress.Text = dt.Rows[0].ItemArray[1].ToString() + " | " + dt.Rows[0].ItemArray[2].ToString() + " | " + dt.Rows[0].ItemArray[3].ToString()
                            + " | " + dt.Rows[0].ItemArray[4].ToString();
            Label laddress1 = new Label();

            laddress1.Text = dt.Rows[0].ItemArray[5].ToString()
                             + " | " + dt.Rows[0].ItemArray[6].ToString()
                             + " | " + dt.Rows[0].ItemArray[7].ToString();

            /*显示经纪人信息*/
            SqlCommand cmd1 = new SqlCommand();

            cmd1.Connection = con;
            SqlDataAdapter da1 = new SqlDataAdapter(sql1, con);
            DataTable      dt1 = new DataTable();

            da1.Fill(dt1);

            HyperLink linkagentName = new HyperLink();

            linkagentName.Text        = "经纪人姓名:" + dt1.Rows[0].ItemArray[2].ToString();
            linkagentName.NavigateUrl = "agentMainInfo.aspx?agentID=" + dt1.Rows[0].ItemArray[0].ToString();

            Label lagentTel = new Label();

            lagentTel.Text = dt1.Rows[0].ItemArray[1].ToString();
            System.Web.UI.WebControls.Image AgentImage = new System.Web.UI.WebControls.Image();
            AgentImage.ImageUrl = dt1.Rows[0].ItemArray[8].ToString();
            AgentImage.Width    = 80;
            AgentImage.Height   = 106;

            HyperLink linkYaoYuYue = new HyperLink();

            linkYaoYuYue.Text        = "我要预约";
            linkYaoYuYue.NavigateUrl = "YaoYuYue.aspx";

            /*显示房东信息*/
            SqlCommand cmd2 = new SqlCommand();

            cmd2.Connection = con;
            SqlDataAdapter da2 = new SqlDataAdapter(sql2, con);
            DataTable      dt2 = new DataTable();

            da2.Fill(dt2);

            HyperLink linkownerName = new HyperLink();

            linkownerName.Text        = "房东姓名:" + dt2.Rows[0].ItemArray[1].ToString();
            linkownerName.NavigateUrl = "ownerMainInfo.aspx?ownerID=" + dt2.Rows[0].ItemArray[0].ToString();

            Label lownerTel = new Label();

            lownerTel.Text = dt2.Rows[0].ItemArray[2].ToString();
            System.Web.UI.WebControls.Image ownerImage = new System.Web.UI.WebControls.Image();
            ownerImage.ImageUrl = dt2.Rows[0].ItemArray[4].ToString();
            ownerImage.Width    = 80;
            ownerImage.Height   = 106;

            //
            /* 房源信息 */
            title.Controls.Add(ltitle);
            title.Style.Add("width", "1200px");
            title.Style.Add("margin", "0 auto");
            title.Style.Add("font-size", "32px");
            price.Style.Add("color", "#323942");


            down.Style.Add("width", "1200px");
            down.Style.Add("margin", "0 auto");
            down.Style.Add("height", "450px");

            image.Controls.Add(HouseImage);
            image.Style.Add("float", "left");

            info.Style.Add("float", "right");
            info.Style.Add("width", "410px");
            info.Style.Add("height", "445px");

            price.Controls.Add(lprice);
            price.Style.Add("width", "410px");
            price.Style.Add("height", "25px");
            price.Style.Add("margin-bottom", "28px");
            price.Style.Add("text-align", "center");
            price.Style.Add("font-size", "32px");
            price.Style.Add("color", "#FB5033");

            info1.Style.Add("padding", "15px 0px 15px 0px");
            info1.Style.Add("width", "410px");
            info1.Style.Add("height", "56px");
            info1.Style.Add("border-top", "1px solid grey");
            info1.Style.Add("border-bottom", "1px solid grey");
            info1.Style.Add("line-height", "28px");
            info1.Style.Add("font-size", "19px");
            info1.Style.Add("color", "#535D6A");

            Htype.Controls.Add(ltype);
            Htype.Style.Add("width", "204px");
            Htype.Style.Add("height", "100%");
            Htype.Style.Add("float", "left");
            Htype.Style.Add("border-right", "1px solid grey");
            Htype.Style.Add("text-align", "center");

            Harea.Controls.Add(larea);
            Harea.Style.Add("width", "205px");
            Harea.Style.Add("height", "100%");
            Harea.Style.Add("float", "left");
            Harea.Style.Add("text-align", "center");

            info2.Style.Add("width", "410px");
            info2.Style.Add("height", "97px");

            Haddress.Controls.Add(laddress);
            Haddress.Style.Add("font-size", "15px");
            Haddress.Style.Add("padding-bottom", "25px");

            Haddress1.Controls.Add(laddress1);
            Haddress1.Style.Add("font-size", "15px");

            /* 房东信息 */
            owner.Style.Add("width", "410px");
            owner.Style.Add("height", "106px");
            owner.Style.Add("margin-bottom", "28px");

            oimage.Controls.Add(ownerImage);
            oimage.Style.Add("width", "80px");
            oimage.Style.Add("height", "106px");
            oimage.Style.Add("float", "left");

            ownerInfo.Style.Add("width", "316px");
            ownerInfo.Style.Add("height", "106px");
            ownerInfo.Style.Add("float", "right");

            ownerName.Controls.Add(linkownerName);
            ownerName.Style.Add("padding-bottom", "25px");
            ownerName.Style.Add("padding-top", "17px");
            ownerName.Style.Add("font-size", "23px");
            ownerName.Style.Add("color", "#323942");

            ownerTel.Controls.Add(lownerTel);
            ownerTel.Style.Add("font-size", "23px");
            ownerTel.Style.Add("color", "#FB5033");

            /* 经济人信息 */
            agent.Style.Add("width", "410px");
            agent.Style.Add("height", "106px");

            agentInfo.Style.Add("width", "316px");
            agentInfo.Style.Add("height", "106px");
            agentInfo.Style.Add("float", "right");

            aimage.Controls.Add(AgentImage);
            aimage.Style.Add("width", "80px");
            aimage.Style.Add("height", "106px");
            aimage.Style.Add("float", "left");

            agentName.Controls.Add(linkagentName);
            agentName.Style.Add("padding-bottom", "25px");
            agentName.Style.Add("padding-top", "17px");
            agentName.Style.Add("font-size", "23px");
            agentName.Style.Add("color", "#323942");

            agentTel.Controls.Add(lagentTel);
            agentTel.Style.Add("font-size", "23px");
            agentTel.Style.Add("color", "#FB5033");

            YaoYuYue.Controls.Add(linkYaoYuYue);
            YaoYuYue.Style.Add("font-size", "32px");
            YaoYuYue.Style.Add("text-align", "center");
        }
Esempio n. 40
0
        /// <summary>
        /// Handles the ItemDataBound event of the rptrGroups control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterItemEventArgs"/> instance containing the event data.</param>
        protected void rptrGroups_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var group = e.Item.DataItem as Group;
                if (group != null)
                {
                    HyperLink hlEditGroup = e.Item.FindControl("hlEditGroup") as HyperLink;
                    if (hlEditGroup != null)
                    {
                        hlEditGroup.Visible = _allowEdit;
                        var pageParams = new Dictionary <string, string>();
                        pageParams.Add("PersonId", Person.Id.ToString());
                        pageParams.Add("GroupId", group.Id.ToString());
                        hlEditGroup.NavigateUrl = LinkedPageUrl(AttributeKey.GroupEditPage, pageParams);
                    }

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

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

                        var groupHeaderLava = GetAttributeValue(AttributeKey.GroupHeaderLava);
                        var groupFooterLava = GetAttributeValue(AttributeKey.GroupFooterLava);

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

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

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

                        var orderedMembers = new List <GroupMember>();

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

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

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

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

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

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

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

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

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

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

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

                        pnlGroupAttributes.Visible = phGroupAttributes.Controls.Count > 0 || phMoreGroupAttributes.Controls.Count > 0;
                    }
                }
            }
        }
Esempio n. 41
0
        void _gviewTaskForOut_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //throw new NotImplementedException();
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                HyperLink hl = e.Row.Cells[0].FindControl("hlItem") as HyperLink;
                switch (hl.ToolTip)
                {
                case "物资调拨审核信息":
                    if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "正常出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageOut/NormalOutProduceAuditInfo.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    else if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "委外出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageCommitOut/CommitOutProduceAuditInfo.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    break;

                case "物资调拨审核":
                    if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "正常出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageOut/NormalOutProduceAudit.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    else if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "委外出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageCommitOut/CommitOutProduceAudit.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    break;

                case "物资出库":
                    if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "正常出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageOut/NormalOutAssetDetails.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    else if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "委外出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageCommitOut/CommitOutAssetDetails.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    break;

                case "物资出库审核":
                    if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "正常出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageOut/NormalOutAssetAudit.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    else if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "委外出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageCommitOut/CommitOutAssetAudit.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    break;

                case "物资出库审核信息":
                    if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "正常出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageOut/NormalOutAssetAuditInfo.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    else if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "委外出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageCommitOut/CommitOutAssetAuditInfo.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    break;

                case "主任审批":
                    if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "正常出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageOut/NormalOutDirectorConfirm.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    else if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Trim() == "委外出库")
                    {
                        hl.NavigateUrl = SPContext.Current.Web.Url + "/WorkPages/StorageCommitOut/CommitOutDirectorConfirm.aspx?TaskID=" + DataBinder.Eval(e.Row.DataItem, "TaskID").ToString();
                    }
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 42
0
        protected void doLoad()
        {
            System.Diagnostics.Debug.WriteLine("USER NOT AUTHENTICATED!!!");

            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                System.Diagnostics.Debug.WriteLine("USER NOT AUTHENTICATED!!!");
                Rating1.Visible      = false;
                RadioButton1.Visible = false;
                Label1.Visible       = false;
                Label3.Visible       = false;
                Label4.Visible       = true;
                Label2.Visible       = false;
                ola.Visible          = false;
                TextBox1.Visible     = false;
                Button1.Visible      = false;
            }
            else
            {
                Rating1.Visible      = true;
                RadioButton1.Visible = true;
                Label1.Visible       = true;
                Label3.Visible       = true;
                Label4.Visible       = false;
                Label2.Visible       = true;
                TextBox1.Visible     = true;
                Button1.Visible      = true;
                ola.Visible          = true;
            }

            Label2.Text = Auxiliar.GetAvgScore(Int32.Parse(Request.QueryString["id"])).ToString();

            int score = Auxiliar.GetScore(HttpContext.Current.User.Identity.Name.ToString(), Int32.Parse(Request.QueryString["id"]));

            System.Diagnostics.Debug.WriteLine(score);
            int playedTrue = Auxiliar.Playing(HttpContext.Current.User.Identity.Name.ToString(), Int32.Parse(Request.QueryString["id"]));

            RadioButton1.Checked = false;
            if (playedTrue == 1)
            {
                RadioButton1.Checked = true;
            }


            if (score != 0)
            {
                Rating1.CurrentRating = score;
            }

            if (RadioButton1.Checked == true)
            {
                Rating1.Visible  = true;
                TextBox1.Visible = true;
                Button1.Visible  = true;
            }
            else
            {
                Rating1.Visible  = false;
                TextBox1.Visible = false;
                Button1.Visible  = false;
            }

            Button1.Visible = true;

            XmlDocument asfvafaw      = new XmlDocument();
            String      xsltFileName1 = Server.MapPath("~/XML/Reviews.xml");

            asfvafaw.Load(xsltFileName1);

            XmlDataSource3.Data  = asfvafaw.OuterXml;
            GridView1.DataSource = XmlDataSource3;
            GridView1.DataBind();


            try
            {
                XmlDocument reviews = Auxiliar.getReviews(Int32.Parse(Request.QueryString["id"]));

                GridView1.DataSource = null;
                GridView1.DataBind();

                DataSet xmlData    = new DataSet();
                var     xmlReader1 = new XmlNodeReader(reviews);
                xmlData.ReadXml(xmlReader1);

                GridView1.DataSource = xmlData;
                GridView1.DataBind();
            }
            catch
            {
            }

            XmlDocument Games = Auxiliar.GamesInfoPush(Int32.Parse(Request.QueryString["id"]));
            //XmlDocument Games = Auxiliar.GamesInfo(Int32.Parse(Request.QueryString["id"]));
            var trans = new XslTransform();

            String xsltFileName = Server.MapPath("~/XSLT/infoGame.xslt");

            trans.Load(xsltFileName);

            var reader         = trans.Transform(Games, null, (XmlResolver)null);
            var transformedDoc = new XmlDocument();

            transformedDoc.Load(reader);
            System.Diagnostics.Debug.WriteLine("olaaaaaaaaaaaaaaaaaaaa");

            var ds        = new DataSet();
            var xmlReader = new XmlNodeReader(transformedDoc);

            ds.ReadXml(xmlReader);
            SeriesDetailsView.DataSource = ds;
            SeriesDetailsView.FieldHeaderStyle.Font.Bold     = true;
            SeriesDetailsView.RowStyle.BackColor             = System.Drawing.Color.White;
            SeriesDetailsView.FieldHeaderStyle.BackColor     = System.Drawing.Color.LightGray;
            SeriesDetailsView.FieldHeaderStyle.BorderColor   = System.Drawing.Color.Black;
            SeriesDetailsView.FieldHeaderStyle.Width         = 90;
            SeriesDetailsView.FieldHeaderStyle.VerticalAlign = VerticalAlign.Middle;
            System.Diagnostics.Debug.WriteLine("olaaaaaaaaaaaaaaaaaaaa");

            SeriesDetailsView.DataBind();

            System.Diagnostics.Debug.WriteLine("olaaaaaaaaaaaaaaaaaaaa");

            for (int i = 0; i < 4; i++)
            {
                SeriesDetailsView.Rows[i].Visible = false;
                System.Diagnostics.Debug.WriteLine(SeriesDetailsView.Rows[i].Visible);
            }

            SeriesDetailsView.Rows[0].Enabled = false;


            Image[]     image     = new Image[transformedDoc.SelectNodes("//Similar").Count];
            Label[]     label     = new Label[transformedDoc.SelectNodes("//Similar").Count];
            HyperLink[] hyperlink = new HyperLink[transformedDoc.SelectNodes("//Similar").Count];

            for (int i = 0; i < transformedDoc.SelectNodes("//Similar").Count; i++)
            {
                label[i] = new Label();

                image[i] = new Image();
                image[i].Attributes.Add("class", "img-responsive center-block");
                image[i].Attributes.Add("style", "height:200px");

                XmlDocument x = new XmlDocument();
                x.Load("http://thegamesdb.net/api/GetArt.php?id=" + transformedDoc.SelectNodes("//Similar/@idJogo").Item(i).InnerText);
                image[i].ImageUrl = "http://thegamesdb.net/banners/" + x.SelectNodes("//Images/boxart[@side='front']").Item(0).InnerText;

                HtmlGenericControl createDiv = new HtmlGenericControl("DIV");
                createDiv.Attributes.Add("class", "grid-item col-md-3 col-sm-8 sortable");
                createDiv.Attributes.Add("style", "margin-top: 20px;");

                this.SimilarGames.Controls.Add(createDiv);
                createDiv.Controls.Add(image[i]);
                label[i] = new Label();
                HtmlGenericControl createDivText = new HtmlGenericControl("DIV");
                createDivText.Attributes.Add("class", "titles");
                createDivText.Attributes.Add("style", "text-align: center; margin-top: 5px;");
                createDiv.Controls.Add(createDivText);
                hyperlink[i]             = new HyperLink();
                hyperlink[i].NavigateUrl = String.Format("videoGameInfo.aspx?id={0}", transformedDoc.SelectNodes("//Similar/@idJogo").Item(i).InnerText);

                x.Load("http://thegamesdb.net/api/GetGame.php?id=" + transformedDoc.SelectNodes("//Similar/@idJogo").Item(i).InnerText);
                hyperlink[i].Text = x.SelectNodes("//Game/GameTitle").Item(0).InnerText;

                label[i].Controls.Add(hyperlink[i]);
                createDivText.Controls.Add(label[i]);
            }


            Label1.Text = SeriesDetailsView.Rows[2].Cells[1].Text;
            //System.Diagnostics.Debug.WriteLine(SeriesDetailsView.Rows[9].Cells[0].Text);
            channelImage.Src = "http://thegamesdb.net/banners/" + SeriesDetailsView.Rows[7].Cells[1].Text;
            channelImage.DataBind();
            XmlDocument xdoc  = XmlDataSource2.GetXmlDocument();
            XmlNodeList list4 = xdoc.GetElementsByTagName("User");

            foreach (XmlNode x in list4)
            {
                if (x.Attributes["id"].Value == HttpContext.Current.User.Identity.Name.ToString())
                {
                    Idplayer = x.Attributes["id"].Value;
                    XmlNodeList list3 = x.ChildNodes;
                    foreach (XmlNode c in list3)
                    {
                        if (c.Attributes["idJogo"].Value == Request.QueryString["id"])
                        {
                            gameReviewed = true;
                        }
                    }
                }
            }
            lastVal = -1;
        }
Esempio n. 43
0
        private void OnDataBinding(object sender, EventArgs e)
        {
            HyperLink    lnk          = (HyperLink)sender;
            DataGridItem objContainer = (DataGridItem)lnk.NamingContainer;
            DataRowView  row          = objContainer.DataItem as DataRowView;

            if (row != null)
            {
                try
                {
                    // 04/27/2006 Paul.  We need the module in order to determine if access is allowed.
                    Guid   gASSIGNED_USER_ID = Guid.Empty;
                    string sMODULE_NAME      = sURL_MODULE;
                    if (row.DataView.Table.Columns.Contains(sURL_ASSIGNED_FIELD))
                    {
                        gASSIGNED_USER_ID = Sql.ToGuid(row[sURL_ASSIGNED_FIELD]);
                    }
                    if (row.DataView.Table.Columns.Contains(sDATA_FIELD))
                    {
                        if (row[sDATA_FIELD] != DBNull.Value)
                        {
                            lnk.Text = Sql.ToString(row[sDATA_FIELD]);

                            bool     bAllowed     = false;
                            string[] arrURL_FIELD = sURL_FIELD.Split(' ');
                            object[] objURL_FIELD = new object[arrURL_FIELD.Length];
                            for (int i = 0; i < arrURL_FIELD.Length; i++)
                            {
                                if (!Sql.IsEmptyString(arrURL_FIELD[i]))
                                {
                                    // 07/26/2007 Paul.  Make sure to escape the javascript string.
                                    if (row[arrURL_FIELD[i]] != DBNull.Value)
                                    {
                                        objURL_FIELD[i] = Sql.EscapeJavaScript(Sql.ToString(row[arrURL_FIELD[i]]));
                                    }
                                    else
                                    {
                                        objURL_FIELD[i] = String.Empty;
                                    }
                                }
                            }

                            int nACLACCESS = ACL_ACCESS.ALL;
                            if (!Sql.IsEmptyString(sMODULE_NAME))
                            {
                                nACLACCESS = Security.GetUserAccess(sMODULE_NAME, "view");
                            }
                            // 05/02/2006 Paul.  Admin has full access.
                            if (Security.IS_ADMIN)
                            {
                                bAllowed = true;
                            }
                            else if (nACLACCESS == ACL_ACCESS.OWNER)
                            {
                                // 05/02/2006 Paul.  Owner can only view if USER_ID matches the assigned user id.
                                // 05/02/2006 Paul.  This role also prevents the user from seeing unassigned items.
                                // This may or may not be a good thing.
                                if (gASSIGNED_USER_ID == Security.USER_ID || Security.IS_ADMIN)
                                {
                                    bAllowed = true;
                                }
                            }
                            // 05/02/2006 Paul.  Allow access if the item is not assigned to anyone.
                            else if (nACLACCESS >= 0 || Sql.IsEmptyGuid(gASSIGNED_USER_ID))
                            {
                                bAllowed = true;
                            }
                            if (bAllowed)
                            {
                                lnk.NavigateUrl = "#";
                                lnk.Attributes.Add("onclick", String.Format(sURL_FORMAT, objURL_FIELD));
                            }
                        }
                    }
                    else
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), sDATA_FIELD + " column does not exist in recordset.");
                    }
                }
                catch (Exception ex)
                {
                    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                }
            }
        }
        protected void rptTripList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            SailsTrip item = e.Item.DataItem as SailsTrip;

            if (item != null)
            {
                #region Name

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

                #endregion

                #region Edit

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

                #endregion

                #region Number Of Days

                using (Label label_NumberOfDays = e.Item.FindControl("label_NumberOfDays") as Label)
                {
                    if (label_NumberOfDays != null)
                    {
                        label_NumberOfDays.Text = item.NumberOfDay.ToString();
                    }
                }

                #endregion

                #region Number Of Option

                Repeater rptOptions = e.Item.FindControl("rptOptions") as Repeater;
                if (rptOptions != null)
                {
                    IList options = new ArrayList();
                    int   num     = item.NumberOfOptions;
                    if (num == 0)
                    {
                        num = 1;
                    }
                    for (int ii = 1; ii <= num; ii++)
                    {
                        options.Add(ii);
                    }
                    _currentTrip          = item;
                    rptOptions.DataSource = options;
                    rptOptions.DataBind();
                }

                DropDownList ddlOption = (DropDownList)e.Item.FindControl("ddlOption");
                using (Label label_NumberofOption = e.Item.FindControl("label_NumberofOption") as Label)
                {
                    if (label_NumberofOption != null)
                    {
                        label_NumberofOption.Text = item.NumberOfOptions.ToString();

                        switch (item.NumberOfOptions)
                        {
                        case 2:
                            ddlOption.Items.Add(new ListItem(Enum.GetName(typeof(TripOption), TripOption.Option1), "1"));
                            ddlOption.Items.Add(new ListItem(Enum.GetName(typeof(TripOption), TripOption.Option2), "2"));
                            break;

                        case 3:
                            ddlOption.Items.Add(new ListItem(Enum.GetName(typeof(TripOption), TripOption.Option1), "1"));
                            ddlOption.Items.Add(new ListItem(Enum.GetName(typeof(TripOption), TripOption.Option2), "2"));
                            ddlOption.Items.Add(new ListItem(Enum.GetName(typeof(TripOption), TripOption.Option3), "3"));
                            break;

                        default:
                            ddlOption.Items.Add(new ListItem(Enum.GetName(typeof(TripOption), TripOption.Option1), "1"));
                            break;
                        }
                        ddlOption.DataBind();
                    }
                }
                #endregion
            }
        }
    protected void SayfayiDoldur()
    {
        ph.Controls.Clear();

        hata    h  = new hata();
        DataSet ds = new DataSet();

        ds = h.Incele(hata_id);

        if (ds.Tables[0].DefaultView.Count > 0)
        {
            /*
             * ilgili hatanýn ayrýntlarýný tabloda göster
             */
            for (int j = 0; j < ds.Tables[0].DefaultView.Table.Rows.Count; j++)
            {
                Table tablo = new Table();

                for (int i = 0; i < ds.Tables[0].DefaultView.Table.Columns.Count; i++)
                {
                    TableRow  satir         = new TableRow();
                    TableCell sutunAciklama = new TableCell();
                    TableCell sutun         = new TableCell();

                    sutunAciklama.BackColor       = System.Drawing.Color.Azure;
                    sutunAciklama.HorizontalAlign = HorizontalAlign.Left;
                    sutunAciklama.Text            = ds.Tables[0].DefaultView.Table.Columns[i].Caption;

                    sutun.BackColor       = System.Drawing.Color.BlanchedAlmond;
                    sutun.HorizontalAlign = HorizontalAlign.Left;


                    sutun.Text = ds.Tables[0].DefaultView.Table.Rows[j].ItemArray.GetValue(i).ToString();

                    if ((i == 0) || (i == 1) || (i == 2))
                    {
                        sutunAciklama.Height = 50;
                        sutun.Height         = 50;
                    }
                    //true veya false çýktýlarý anlamlý hale getirildi: evet veya hayýr þekline
                    else if ((i == 3) || (i == 9))
                    {
                        if (ds.Tables[0].DefaultView.Table.Rows[j].ItemArray.GetValue(i).ToString() == "False")
                        {
                            sutun.Text = "Hayýr";
                        }
                        else if (ds.Tables[0].DefaultView.Table.Rows[j].ItemArray.GetValue(i).ToString() == "True")
                        {
                            sutun.Text = "Evet";
                        }
                    }
                    sutunAciklama.Width = 150;
                    sutun.Width         = 400;

                    satir.Cells.Add(sutunAciklama);
                    satir.Cells.Add(sutun);

                    tablo.Rows.Add(satir);
                }

                //son satýra hata ile ilgili yapýlabilecek iþlem linkleri konulacak
                TableRow  linkler = new TableRow();
                TableCell link    = new TableCell();

                HyperLink hl2 = new HyperLink();
                hl2.NavigateUrl = "SorumluAta.aspx?id=" + hata_id;
                hl2.ID          = "hl2";
                hl2.Text        = "Sorumlu Ata";
                hl2.ForeColor   = System.Drawing.Color.Black;
                hl2.Font.Bold   = true;

                HyperLink hl = new HyperLink();
                hl.NavigateUrl = "Incele.aspx?id=" + hata_id;
                hl.ID          = "hl";
                hl.Text        = "Ýncele";
                hl.ForeColor   = System.Drawing.Color.Black;
                hl.Font.Bold   = true;

                Label lbl1 = new Label();
                lbl1.Text = " | ";

                link.ColumnSpan = 2;
                link.Controls.Add(hl);
                link.Controls.Add(lbl1);
                link.Controls.Add(hl2);

                linkler.Cells.Add(link);
                tablo.Rows.Add(linkler);

                tablo.Width = 550;
                ph.Controls.Add(tablo);

                Label l1 = new Label();
                l1.Text = "<br><br>";
                ph.Controls.Add(l1);
            }
        }
        else
        {
            lblHata.Text = "Böyle bir hata yüklenmemiþ";
        }
    }
        protected virtual internal void RenderItem(HtmlTextWriter writer, MenuItem item, int position)
        {
            Menu          owner       = Control;
            MenuItemStyle mergedStyle = owner.GetMenuItemStyle(item);

            string             imageUrl     = item.ImageUrl;
            int                depth        = item.Depth;
            int                depthPlusOne = depth + 1;
            string             toolTip      = item.ToolTip;
            string             navigateUrl  = item.NavigateUrl;
            string             text         = item.Text;
            bool               enabled      = item.IsEnabled;
            bool               selectable   = item.Selectable;
            MenuItemCollection childItems   = item.ChildItems;

            // Top separator
            string topSeparatorUrl = null;

            if (depth < owner.StaticDisplayLevels && owner.StaticTopSeparatorImageUrl.Length != 0)
            {
                topSeparatorUrl = owner.StaticTopSeparatorImageUrl;
            }
            else if (depth >= owner.StaticDisplayLevels && owner.DynamicTopSeparatorImageUrl.Length != 0)
            {
                topSeparatorUrl = owner.DynamicTopSeparatorImageUrl;
            }
            if (topSeparatorUrl != null)
            {
                Image separatorImage = new Image();
                separatorImage.ImageUrl = topSeparatorUrl;
                separatorImage.GenerateEmptyAlternateText = true; // XHtml compliance
                separatorImage.Page = Page;
                separatorImage.RenderControl(writer);
                RenderBreak(writer);
            }

            // Don't render the top spacing if this is the first root item
            if ((mergedStyle != null) && !mergedStyle.ItemSpacing.IsEmpty &&
                ((_titleItem != null) || (position != 0)))
            {
                RenderSpace(writer, mergedStyle.ItemSpacing, owner.Orientation);
            }

            // Item span
            Panel itemPanel = new SpanPanel();

            itemPanel.Enabled = enabled;
            itemPanel.Page    = Page;

            // Apply styles
            if (Page != null && Page.SupportsStyleSheets)
            {
                string styleClass = owner.GetCssClassName(item, false);
                if (styleClass.Trim().Length > 0)
                {
                    itemPanel.CssClass = styleClass;
                }
            }
            else if (mergedStyle != null)
            {
                itemPanel.ApplyStyle(mergedStyle);
            }

            // Tooltip
            if (item.ToolTip.Length != 0)
            {
                itemPanel.ToolTip = item.ToolTip;
            }

            // Render item begin tag
            itemPanel.RenderBeginTag(writer);

            // If there is a navigation url on this item, set up the navigation stuff if:
            // - the item is the current title item for this level
            // - the item has no children
            // - the item is a static item of depth + 1 < StaticDisplayLevels
            bool clickOpensThisNode = !((position == 0) ||
                                        (childItems.Count == 0) ||
                                        (depthPlusOne < owner.StaticDisplayLevels) ||
                                        (depthPlusOne >= owner.MaximumDepth));

            // Indent
            if (position != 0 &&
                depth > 0 &&
                owner.StaticSubMenuIndent != Unit.Pixel(0) &&
                depth < owner.StaticDisplayLevels)
            {
                Image spacerImage = new Image();
                spacerImage.ImageUrl = owner.SpacerImageUrl;
                spacerImage.GenerateEmptyAlternateText = true; // XHtml compliance
                double indent = owner.StaticSubMenuIndent.Value * depth;
                if (indent < Unit.MaxValue)
                {
                    spacerImage.Width = new Unit(indent, owner.StaticSubMenuIndent.Type);
                }
                else
                {
                    spacerImage.Width = new Unit(Unit.MaxValue, owner.StaticSubMenuIndent.Type);;
                }
                spacerImage.Height = Unit.Pixel(1);
                spacerImage.Page   = Page;
                spacerImage.RenderControl(writer);
            }

            // Render out the item icon, if it is set and if the item is not templated (VSWhidbey 501618)
            if (imageUrl.Length > 0 && item.NotTemplated())
            {
                Image newImage = new Image();
                newImage.ImageUrl = imageUrl;
                if (toolTip.Length != 0)
                {
                    newImage.AlternateText = toolTip;
                }
                else
                {
                    newImage.GenerateEmptyAlternateText = true; // XHtml compliance
                }
                newImage.Page = Page;
                newImage.RenderControl(writer);
                writer.Write(' ');
            }

            bool   applyInlineBorder;
            string linkClass;

            if (Page != null && Page.SupportsStyleSheets)
            {
                linkClass = owner.GetCssClassName(item, true, out applyInlineBorder);
            }
            else
            {
                linkClass         = String.Empty;
                applyInlineBorder = false;
            }
            if (enabled && (clickOpensThisNode || selectable))
            {
                string accessKey     = owner.AccessKey;
                string itemAccessKey = ((position == 0 || (position == 1 && depth == 0)) && accessKey.Length != 0) ?
                                       accessKey :
                                       null;
                if (navigateUrl.Length > 0 && !clickOpensThisNode)
                {
                    if (PageAdapter != null)
                    {
                        PageAdapter.RenderBeginHyperlink(writer,
                                                         owner.ResolveClientUrl(navigateUrl),
                                                         true,
                                                         SR.GetString(SR.Adapter_GoLabel),
                                                         itemAccessKey != null ?
                                                         itemAccessKey :
                                                         (_currentAccessKey < 10 ?
                                                          (_currentAccessKey++).ToString(CultureInfo.InvariantCulture) :
                                                          null));
                        writer.Write(HttpUtility.HtmlEncode(item.FormattedText));
                        PageAdapter.RenderEndHyperlink(writer);
                    }
                    else
                    {
                        HyperLink link = new HyperLink();
                        link.NavigateUrl = owner.ResolveClientUrl(navigateUrl);
                        string target = item.Target;
                        if (String.IsNullOrEmpty(target))
                        {
                            target = owner.Target;
                        }
                        if (!String.IsNullOrEmpty(target))
                        {
                            link.Target = target;
                        }
                        link.AccessKey = itemAccessKey;
                        link.Page      = Page;
                        if (writer is Html32TextWriter)
                        {
                            link.RenderBeginTag(writer);
                            SpanPanel lbl = new SpanPanel();
                            lbl.Page = Page;
                            RenderStyle(writer, lbl, linkClass, mergedStyle, applyInlineBorder);
                            lbl.RenderBeginTag(writer);
                            item.RenderText(writer);
                            lbl.RenderEndTag(writer);
                            link.RenderEndTag(writer);
                        }
                        else
                        {
                            RenderStyle(writer, link, linkClass, mergedStyle, applyInlineBorder);
                            link.RenderBeginTag(writer);
                            item.RenderText(writer);
                            link.RenderEndTag(writer);
                        }
                    }
                }
                // Otherwise, write out a postback that will open or select the item
                else
                {
                    if (PageAdapter != null)
                    {
                        PageAdapter.RenderPostBackEvent(writer,
                                                        owner.UniqueID,
                                                        (clickOpensThisNode ? 'o' : 'b') +
                                                        Escape(item.InternalValuePath),
                                                        SR.GetString(SR.Adapter_OKLabel),
                                                        item.FormattedText,
                                                        null,
                                                        itemAccessKey != null ?
                                                        itemAccessKey :
                                                        (_currentAccessKey < 10 ?
                                                         (_currentAccessKey++).ToString(CultureInfo.InvariantCulture) :
                                                         null));

                        // Expand image
                        if (clickOpensThisNode)
                        {
                            RenderExpand(writer, item, owner);
                        }
                    }
                    else
                    {
                        HyperLink link = new HyperLink();
                        link.NavigateUrl = Page.ClientScript.GetPostBackClientHyperlink(owner,
                                                                                        (clickOpensThisNode ? 'o' : 'b') + Escape(item.InternalValuePath), true);
                        link.AccessKey = itemAccessKey;
                        link.Page      = Page;
                        if (writer is Html32TextWriter)
                        {
                            link.RenderBeginTag(writer);
                            SpanPanel lbl = new SpanPanel();
                            lbl.Page = Page;
                            RenderStyle(writer, lbl, linkClass, mergedStyle, applyInlineBorder);
                            lbl.RenderBeginTag(writer);
                            item.RenderText(writer);
                            if (clickOpensThisNode)
                            {
                                RenderExpand(writer, item, owner);
                            }
                            lbl.RenderEndTag(writer);
                            link.RenderEndTag(writer);
                        }
                        else
                        {
                            RenderStyle(writer, link, linkClass, mergedStyle, applyInlineBorder);
                            link.RenderBeginTag(writer);
                            item.RenderText(writer);
                            if (clickOpensThisNode)
                            {
                                RenderExpand(writer, item, owner);
                            }
                            link.RenderEndTag(writer);
                        }
                    }
                }
            }
            else
            {
                item.RenderText(writer);
            }
            itemPanel.RenderEndTag(writer);

            // Bottom (or right) item spacing
            RenderBreak(writer);
            if ((mergedStyle != null) && !mergedStyle.ItemSpacing.IsEmpty)
            {
                RenderSpace(writer, mergedStyle.ItemSpacing, owner.Orientation);
            }

            // Bottom separator
            string bottomSeparatorUrl = null;

            if (item.SeparatorImageUrl.Length != 0)
            {
                bottomSeparatorUrl = item.SeparatorImageUrl;
            }
            else if ((depth < owner.StaticDisplayLevels) && (owner.StaticBottomSeparatorImageUrl.Length != 0))
            {
                bottomSeparatorUrl = owner.StaticBottomSeparatorImageUrl;
            }
            else if ((depth >= owner.StaticDisplayLevels) && (owner.DynamicBottomSeparatorImageUrl.Length != 0))
            {
                bottomSeparatorUrl = owner.DynamicBottomSeparatorImageUrl;
            }
            if (bottomSeparatorUrl != null)
            {
                Image separatorImage = new Image();
                separatorImage.ImageUrl = bottomSeparatorUrl;
                separatorImage.GenerateEmptyAlternateText = true; // XHtml compliance
                separatorImage.Page = Page;
                separatorImage.RenderControl(writer);
                RenderBreak(writer);
            }
        }
Esempio n. 47
0
        /// <summary>
        /// Render Li and a Item
        /// </summary>
        /// <param name="holder">
        /// The holder.
        /// </param>
        /// <param name="liCssClass">
        /// The li CSS Class.
        /// </param>
        /// <param name="linkCssClass">
        /// The link CSS Class.
        /// </param>
        /// <param name="linkText">
        /// The link text.
        /// </param>
        /// <param name="linkToolTip">
        /// The link tool tip.
        /// </param>
        /// <param name="linkUrl">
        /// The link URL.
        /// </param>
        /// <param name="noFollow">
        /// Add rel="nofollow" to the link
        /// </param>
        /// <param name="showUnread">
        /// The show unread.
        /// </param>
        /// <param name="unread">
        /// The unread.
        /// </param>
        /// <param name="unreadText">
        /// The unread text.
        /// </param>
        private static void RenderMenuItem(
            Control holder, string liCssClass, string linkCssClass, string linkText, string linkToolTip, string linkUrl, bool noFollow, bool showUnread, string unread, string unreadText)
        {
            var liElement = new HtmlGenericControl("li");

            if (liCssClass.IsSet())
            {
                liElement.Attributes.Add("class", liCssClass);
            }

            if (linkToolTip.IsNotSet())
            {
                linkToolTip = linkText;
            }

            var link = new HyperLink
            {
                Target      = "_top",
                ToolTip     = linkToolTip,
                NavigateUrl = linkUrl,
                Text        = linkText
            };

            if (noFollow)
            {
                link.Attributes.Add("rel", "nofollow");
            }

            if (linkCssClass.IsSet())
            {
                link.CssClass = linkCssClass;
            }

            var unreadDiv = new HtmlGenericControl("div");

            if (showUnread)
            {
                unreadDiv.Attributes.Add("class", "UnreadBox");

                liElement.Controls.Add(unreadDiv);
                unreadDiv.Controls.Add(link);
            }
            else
            {
                liElement.Controls.Add(link);
            }

            if (showUnread)
            {
                var unreadLabel = new HtmlGenericControl("span");

                unreadLabel.Attributes.Add("class", "Unread");

                var unreadlink = new HyperLink
                {
                    Target      = "_top",
                    ToolTip     = unreadText,
                    NavigateUrl = linkUrl,
                    Text        = unread
                };

                unreadLabel.Controls.Add(unreadlink);

                unreadDiv.Controls.Add(unreadLabel);
            }

            holder.Controls.Add(liElement);
        }
Esempio n. 48
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DAL.DALVenda        dalvenda  = new DAL.DALVenda();
            List <Modelo.Venda> listVenda = new List <Modelo.Venda>();

            listVenda = dalvenda.SelectAll();
            TableRow  tr1;
            TableCell tc0, tc1, tc2, tc3, tc4, tc5, tc6;

            for (int i = 0; i < listVenda.Count; i++)
            {
                Label l1 = new Label();
                l1.Text      = listVenda[i].datas.ToString("dd/MM/yyyy");
                l1.Font.Name = "Segoe UI Light";
                l1.Font.Size = 16;
                l1.Font.Bold = true;
                tc0          = new TableCell();
                tc0.Controls.Add(l1);
                tc0.Width = 150;

                Label l2 = new Label();
                l2.Text      = listVenda[i].Cliente.nome.ToString();
                l2.Font.Name = "Segoe UI Light";
                l2.Font.Size = 16;
                l2.Font.Bold = true;
                tc1          = new TableCell();
                tc1.Controls.Add(l2);
                tc1.Width = 150;

                Label l3 = new Label();
                l3.Text      = listVenda[i].desconto.ToString();
                l3.Font.Name = "Segoe UI Light";
                l3.Font.Size = 16;
                l3.Font.Bold = true;
                tc2          = new TableCell();
                tc2.Controls.Add(l3);
                tc2.Width = 150;

                Label l4 = new Label();
                l4.Text      = listVenda[i].valorTotal.ToString();
                l4.Font.Name = "Segoe UI Light";
                l4.Font.Size = 16;
                l4.Font.Bold = true;
                tc3          = new TableCell();
                tc3.Controls.Add(l4);
                tc3.Width = 170;

                HyperLink l5 = new HyperLink();
                l5.Text        = "Visualizar";
                l5.NavigateUrl = "~/AlterarItensVenda.aspx?idVenda=" + listVenda[i].idVenda;
                l5.Font.Name   = "Segoe UI Light";
                l5.Font.Size   = 16;
                l5.Font.Bold   = true;
                tc4            = new TableCell();
                tc4.Controls.Add(l5);
                tc4.Width = 190;

                HyperLink l6 = new HyperLink();
                l6.Text        = "Alterar";
                l6.NavigateUrl = "~/AlterarVenda.aspx?idVenda=" + listVenda[i].idVenda;
                l6.Font.Name   = "Segoe UI Light";
                l6.Font.Size   = 16;
                l6.Font.Bold   = true;
                tc5            = new TableCell();
                tc5.Controls.Add(l6);
                tc5.Width = 150;

                HyperLink l7 = new HyperLink();
                l7.Text        = "Excluir";
                l7.NavigateUrl = "~/ExcluirVenda.aspx?idVenda=" + listVenda[i].idVenda;
                l7.Font.Name   = "Segoe UI Light";
                l7.Font.Size   = 16;
                l7.Font.Bold   = true;
                tc6            = new TableCell();
                tc6.Controls.Add(l7);
                tc6.Width = 100;

                tr1 = new TableRow();
                tr1.Cells.Add(tc0);
                tr1.Cells.Add(tc1);
                tr1.Cells.Add(tc2);
                tr1.Cells.Add(tc3);
                tr1.Cells.Add(tc4);
                tr1.Cells.Add(tc5);
                tr1.Cells.Add(tc6);
                Table3.Rows.Add(tr1);
            }
        }
Esempio n. 49
0
        protected void rptAgencies_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is vAgency)
            {
                vAgency   agency  = (vAgency)e.Item.DataItem;
                HyperLink hplName = e.Item.FindControl("hplName") as HyperLink;
                if (hplName != null)
                {
                    hplName.Text        = agency.Name;
                    hplName.NavigateUrl = string.Format("AgencyView.aspx{0}&AgencyId={1}", GetBaseQueryString(), agency.Id);
                }

                HtmlAnchor aName = e.Item.FindControl("aName") as HtmlAnchor;
                if (aName != null)
                {
                    aName.InnerHtml = agency.Name;
                    aName.Attributes.CssStyle.Add("cursor", "pointer");

                    string script = string.Format("Done('{0}','{1}')", agency.Name.Replace("'", @"\'"), agency.Id);
                    aName.Attributes.Add("onclick", script);
                }

                HyperLink hplEdit = e.Item.FindControl("hplEdit") as HyperLink;
                if (hplEdit != null)
                {
                    hplEdit.NavigateUrl = string.Format("AgencyEdit.aspx{0}&AgencyId={1}", GetBaseQueryString(), agency.Id);
                }

                Literal litRole = e.Item.FindControl("litRole") as Literal;
                if (litRole != null)
                {
                    var hyperLink = e.Item.FindControl("hplPriceSetting") as HyperLink;
                    if (hyperLink != null)
                    {
                        if (agency.Role != null)
                        {
                            litRole.Text      = agency.Role.Name;
                            hyperLink.Visible = false;
                        }
                        else
                        {
                            litRole.Text      = "Customize Role";
                            hyperLink.Visible = true;
                        }
                    }
                    else
                    {
                        Debug.WriteLine("hplPriceSetting = null");
                    }
                }

                Literal litContract = e.Item.FindControl("litContract") as Literal;
                if (litContract != null)
                {
                    switch (agency.ContractStatus)
                    {
                    case 0:
                        litContract.Text = @"No contract";
                        break;

                    case 1:
                        litContract.Text = @"Expired";
                        break;

                    case 2:
                        litContract.Text = @"Contract in valid";
                        break;

                    case 3:
                        litContract.Text = @"Expire soon";
                        break;

                    case 4:
                        litContract.Text = @"Contract sent";
                        break;
                    }
                }

                var trItem = e.Item.FindControl("trItem") as HtmlTableRow;
                if (trItem != null)
                {
                    switch (agency.ContractStatus)
                    {
                    case 0:     // No contract
                        trItem.Attributes.Add("class", "danger");
                        break;

                    case 1:     // Contract expired
                        trItem.Attributes.Add("class", "active");
                        break;

                    case 2:     // Có hợp đồng và chưa hết hạn trong vòng 30 ngày
                        trItem.Attributes.Add("class", "success");
                        break;

                    case 3:     // Có hợp đồng nhưng sẽ hết hạn trong vòng 30 ngày
                        trItem.Attributes.Add("class", "warning");
                        break;

                    case 4:
                        trItem.Attributes.CssStyle.Add("background-color", "greenyellow");
                        break;
                    }
                }

                if (agency.ContractStatus != 0)
                {
                    if (string.IsNullOrEmpty(agency.Contract))
                    {
                        HyperLink hplContract = e.Item.FindControl("hplContract") as HyperLink;
                        if (hplContract != null)
                        {
                            hplContract.Visible = false;
                        }
                    }
                    else
                    {
                        HyperLink hplContract = e.Item.FindControl("hplContract") as HyperLink;
                        if (hplContract != null)
                        {
                            hplContract.Text        = @"[View]";
                            hplContract.NavigateUrl = agency.Contract;
                        }
                    }
                }

                ValueBinder.BindLiteral(e.Item, "litPayment", agency.PaymentPeriod);

                var litIndex = e.Item.FindControl("litIndex") as Literal;
                if (litIndex != null)
                {
                    litIndex.Text = (e.Item.ItemIndex + pagerBookings.PageSize * pagerBookings.CurrentPageIndex + 1) + ".";
                }

                var litSale = e.Item.FindControl("litSale") as Literal;
                if (litSale != null)
                {
                    if (agency.Sale != null)
                    {
                        litSale.Text = agency.Sale.UserName;
                    }
                }

                var hplPriceSetting = e.Item.FindControl("hplPriceSetting") as HyperLink;
                if (hplPriceSetting != null)
                {
                    hplPriceSetting.NavigateUrl =
                        string.Format("PriceConfiguration.aspx?NodeId={0}&SectionId={1}&agentid={2}", Node.Id, Section.Id,
                                      agency.Id);
                }

                HtmlTableCell tdLastBooking = e.Item.FindControl("tdLastBooking") as HtmlTableCell;
                if (tdLastBooking != null)
                {
                    if (agency.LastBooking.HasValue)
                    {
                        tdLastBooking.InnerHtml = string.Format("{0} (<a href='{1}'>list</a>) ",
                                                                agency.LastBooking.Value.ToString("dd/MM/yyyy"),
                                                                string.Format(
                                                                    "BookingList.aspx?NodeId={0}&SectionId={1}&ai={2}",
                                                                    Node.Id, Section.Id, agency.Id));
                    }
                    else
                    {
                        tdLastBooking.InnerText = "Never";
                    }
                }
            }
        }
Esempio n. 50
0
        private void UpdateOnClientClick(HyperLink link)
        {
            String url = Url;

            url = Control.ResolveUrl(url); // ResolveUrl会自行处理绝对路径的问题

            string jsFuncName = "LinkBoxFieldShow" + GetHashCode();

            #region 在页面注册脚本函数
            if (!Control.Page.ClientScript.IsClientScriptBlockRegistered(GetType(), jsFuncName))
            {
                var showJs = new StringBuilder();
                var moreJs = new StringBuilder();
                if (Width != Unit.Empty)
                {
                    showJs.AppendFormat("Width:{0},", (Int32)Width.Value);
                }
                if (Height != Unit.Empty)
                {
                    showJs.AppendFormat("Height:{0},", (Int32)Height.Value);
                }
                if (ClickedRowBackColor != Color.Empty)
                {
                    string color = new WebColorConverter().ConvertToString(ClickedRowBackColor);
                    showJs.AppendFormat(@"
BeforeShow:function(){{GridViewExtender.HighlightRow(ele,'{0}',true);}},
AfterClose:function(){{GridViewExtender.HighlightRow(ele,'{0}',false);}},
", color);
                    // 使用到GridViewExtender的地方引入相关的js
                    Control.Page.ClientScript.RegisterClientScriptResource(typeof(GridViewExtender), "XControl.View.GridViewExtender.js");
                }
                if (!string.IsNullOrEmpty(InWindow))
                {
                    showJs.AppendFormat("InWindow:{0},", InWindow);
                }
                if (!string.IsNullOrEmpty(ParentWindow))
                {
                    showJs.AppendFormat("ParentWindow:{0},", ParentWindow);
                }

                if (this.Control is GridView)
                {
                    moreJs.AppendFormat("stopEventPropagation(event);");
                    if (!Control.Page.ClientScript.IsClientScriptBlockRegistered(typeof(object), "stopEventPropagation"))
                    {
                        Control.Page.ClientScript.RegisterClientScriptBlock(typeof(object), "stopEventPropagation",
                                                                            Helper.JsMinSimple(!XControlConfig.Debug, @"
;function stopEventPropagation(e){
    try{
        if(typeof e != 'undefined'){
            if(typeof e.stopPropagation != 'undefined'){
                e.stopPropagation();
            }else if(typeof e.cancelBubble != 'undefined'){
                e.cancelBubble = true;
            }
        }
    }catch(ex){}
}
"), true);
                    }
                }

                Control.Page.ClientScript.RegisterClientScriptBlock(GetType(), jsFuncName,
                                                                    Helper.JsMinSimple(!XControlConfig.Debug, @"
;function {0}(ele, event, title, url, msgRow, msgTitle, msg, btnRow){{
    try{{
        ShowDialog({{
            ID:'win'+Math.random(),
            Title:title,
            URL:url,
            ShowMessageRow:msgRow,
            MessageTitle:msgTitle,
            Message:msg,
            {1}
            ShowButtonRow:btnRow
        }});
        {2}
    }}catch(ex){{{3}}};
    return false;
}}
", jsFuncName, showJs, moreJs, XTrace.Debug ? "alert(ex);" : ""), true);

                LinkBox.RegisterReloadFormJs(Control.Page.ClientScript, Control.Page.IsPostBack);
            }
            #endregion

            var title = link.ToolTip;
            if (String.IsNullOrEmpty(title))
            {
                title = Title;
            }
            OnClientClick = Helper.HTMLPropertyEscape(@"return {0}(this,event,'{1}','{2}',{3},'{4}','{5}',{6});",
                                                      jsFuncName,
                                                      Helper.JsStringEscape(title), Helper.JsStringEscape(url),
                                                      ShowMessageRow.ToString().ToLower(),
                                                      Helper.JsStringEscape(MessageTitle), Helper.JsStringEscape(Message),
                                                      ShowButtonRow.ToString().ToLower()
                                                      );
        }
    protected void OnRowDatabound(object sender, GridViewRowEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Image     i = (Image)e.Row.FindControl("imgPin");
            HyperLink h = (HyperLink)e.Row.FindControl("lnkZoom");
            if (m_fd.HasLatLongInfo)
            {
                int iRow = e.Row.DataItemIndex;

                DataRow drow = m_fd.Data.Rows[iRow];

                StringBuilder sbDesc = new StringBuilder();

                double lat = 0.0, lon = 0.0;

                foreach (DataColumn dc in m_fd.Data.Columns)
                {
                    bool fLat = (dc.ColumnName.CompareOrdinalIgnoreCase(KnownColumnNames.LAT) == 0);
                    bool fLon = (dc.ColumnName.CompareOrdinalIgnoreCase(KnownColumnNames.LON) == 0);
                    bool fPos = (dc.ColumnName.CompareOrdinalIgnoreCase(KnownColumnNames.POS) == 0);

                    if (fLat)
                    {
                        lat = Convert.ToDouble(drow[KnownColumnNames.LAT], CultureInfo.InvariantCulture);
                    }

                    if (fLon)
                    {
                        lon = Convert.ToDouble(drow[KnownColumnNames.LON], CultureInfo.InvariantCulture);
                    }

                    if (fPos)
                    {
                        LatLong ll = (LatLong)drow[KnownColumnNames.POS];
                        lat = ll.Latitude;
                        lon = ll.Longitude;
                    }

                    if (!(fLat || fLon || fPos))
                    {
                        object o = drow[dc.ColumnName];
                        if (o != null)
                        {
                            string sz = o.ToString();;
                            if (!String.IsNullOrEmpty(sz))
                            {
                                sbDesc.AppendFormat(CultureInfo.InvariantCulture, "{0}: {1}<br />", dc.ColumnName, sz);
                            }
                        }
                    }
                }

                i.Attributes["onclick"] = String.Format(CultureInfo.InvariantCulture, "javascript:dropPin(new google.maps.LatLng({0}, {1}), '{2}');", lat, lon, sbDesc.ToString());
                h.NavigateUrl           = String.Format(CultureInfo.InvariantCulture, "javascript:getMfbMap().gmap.setCenter(new google.maps.LatLng({0}, {1}));getMfbMap().gmap.setZoom(14);", lat, lon);
                i.ToolTip = String.Format(CultureInfo.CurrentCulture, Resources.FlightData.GraphDropPinTip, (new LatLong(lat, lon)).ToString());
            }
            else
            {
                i.Visible = h.Visible = false;
            }
        }
    }
Esempio n. 52
0
        public void CreateCompareTable()
        {
            this.tblCompareProducts.Rows.Clear();
            this.tblCompareProducts.Width = "100%";
            ProductCollection compareProducts = ProductManager.GetCompareProducts();

            if (compareProducts.Count > 0)
            {
                HtmlTableRow headerRow = new HtmlTableRow();
                this.AddCell(headerRow, "&nbsp;");
                HtmlTableRow productNameRow = new HtmlTableRow();
                this.AddCell(productNameRow, "&nbsp;");
                HtmlTableRow  priceRow = new HtmlTableRow();
                HtmlTableCell cell     = new HtmlTableCell();
                cell.InnerText = GetLocaleResourceString("Products.CompareProductsPrice");
                cell.Align     = "center";
                priceRow.Cells.Add(cell);

                List <int> allAttributeIDs = new List <int>();
                foreach (Product product in compareProducts)
                {
                    ProductSpecificationAttributeCollection productSpecificationAttributes = SpecificationAttributeManager.GetProductSpecificationAttributesByProductID(product.ProductID, null, true);
                    foreach (ProductSpecificationAttribute attribute in productSpecificationAttributes)
                    {
                        if (!allAttributeIDs.Contains(attribute.SpecificationAttributeOptionID))
                        {
                            allAttributeIDs.Add(attribute.SpecificationAttributeOptionID);
                        }
                    }
                }

                foreach (Product product in compareProducts)
                {
                    HtmlTableCell      headerCell        = new HtmlTableCell();
                    HtmlGenericControl headerCellDiv     = new HtmlGenericControl("div");
                    Button             btnRemoveFromList = new Button();
                    btnRemoveFromList.ToolTip          = GetLocaleResourceString("Products.CompareProductsRemoveFromList");
                    btnRemoveFromList.Text             = GetLocaleResourceString("Products.CompareProductsRemoveFromList");
                    btnRemoveFromList.CommandName      = "Remove";
                    btnRemoveFromList.Command         += new CommandEventHandler(this.btnRemoveFromList_Command);
                    btnRemoveFromList.CommandArgument  = product.ProductID.ToString();
                    btnRemoveFromList.CausesValidation = false;
                    btnRemoveFromList.CssClass         = "removeButton";
                    btnRemoveFromList.ID = "btnRemoveFromList" + product.ProductID.ToString();
                    headerCellDiv.Controls.Add(btnRemoveFromList);

                    HtmlGenericControl productImagePanel = new HtmlGenericControl("p");
                    productImagePanel.Attributes.Add("align", "center");

                    HtmlImage productImage = new HtmlImage();
                    productImage.Border = 0;
                    //productImage.Align = "center";
                    productImage.Alt = "Product image";
                    ProductPictureCollection productPictures = product.ProductPictures;
                    if (productPictures.Count > 0)
                    {
                        productImage.Src = PictureManager.GetPictureUrl(productPictures[0].Picture, SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125), true);
                    }
                    else
                    {
                        productImage.Src = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125));
                    }
                    productImagePanel.Controls.Add(productImage);

                    headerCellDiv.Controls.Add(productImagePanel);



                    headerCell.Controls.Add(headerCellDiv);
                    headerRow.Cells.Add(headerCell);
                    HtmlTableCell productNameCell = new HtmlTableCell();
                    HyperLink     productLink     = new HyperLink();
                    productLink.Text        = Server.HtmlEncode(product.Name);
                    productLink.NavigateUrl = SEOHelper.GetProductURL(product);
                    productLink.Attributes.Add("class", "link");
                    productNameCell.Align = "center";
                    productNameCell.Controls.Add(productLink);
                    productNameRow.Cells.Add(productNameCell);
                    HtmlTableCell priceCell = new HtmlTableCell();
                    priceCell.Align = "center";
                    ProductVariantCollection productVariantCollection = product.ProductVariants;
                    if (productVariantCollection.Count > 0)
                    {
                        ProductVariant productVariant = productVariantCollection[0];

                        //decimal oldPrice = productVariant.OldPrice;
                        //decimal oldPriceConverted = CurrencyManager.ConvertCurrency(oldPrice, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                        decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));
                        decimal finalPriceWithoutDiscount     = CurrencyManager.ConvertCurrency(finalPriceWithoutDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                        priceCell.InnerText = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                    }
                    priceRow.Cells.Add(priceCell);
                }
                productNameRow.Attributes.Add("class", "productName");
                priceRow.Attributes.Add("class", "productPrice");
                this.tblCompareProducts.Rows.Add(headerRow);
                this.tblCompareProducts.Rows.Add(productNameRow);
                this.tblCompareProducts.Rows.Add(priceRow);

                if (allAttributeIDs.Count > 0)
                {
                    foreach (int specificationAttributeID in allAttributeIDs)
                    {
                        //SpecificationAttribute attribute = SpecificationAttributeManager.GetSpecificationAttributeByID(specificationAttributeID);
                        SpecificationAttributeOption attributeOption = SpecificationAttributeManager.GetSpecificationAttributeOptionByID(specificationAttributeID);
                        HtmlTableRow productRow = new HtmlTableRow();
                        this.AddCell(productRow, Server.HtmlEncode(attributeOption.SpecificationAttribute.Name)).Align = "left";

                        foreach (Product product2 in compareProducts)
                        {
                            HtmlTableCell productCell = new HtmlTableCell();
                            {
                                ProductSpecificationAttributeCollection productSpecificationAttributes2 = SpecificationAttributeManager.GetProductSpecificationAttributesByProductID(product2.ProductID, null, true);
                                foreach (ProductSpecificationAttribute attribute2 in productSpecificationAttributes2)
                                {
                                    if (attributeOption.SpecificationAttributeOptionID == attribute2.SpecificationAttributeOptionID)
                                    {
                                        productCell.InnerHtml = (!String.IsNullOrEmpty(attribute2.SpecificationAttributeOption.Name)) ? Server.HtmlEncode(attribute2.SpecificationAttributeOption.Name) : "&nbsp;";
                                    }
                                }
                            }
                            productCell.Align  = "center";
                            productCell.VAlign = "top";
                            productRow.Cells.Add(productCell);
                        }
                        this.tblCompareProducts.Rows.Add(productRow);
                    }
                }
                string width = Math.Round((decimal)(90M / compareProducts.Count), 0).ToString() + "%";
                for (int i = 0; i < this.tblCompareProducts.Rows.Count; i++)
                {
                    HtmlTableRow row = this.tblCompareProducts.Rows[i];
                    for (int j = 1; j < row.Cells.Count; j++)
                    {
                        if (j == (row.Cells.Count - 1))
                        {
                            row.Cells[j].Style.Add("width", width);
                            row.Cells[j].Style.Add("text-align", "center");
                        }
                        else
                        {
                            row.Cells[j].Style.Add("width", width);
                            row.Cells[j].Style.Add("text-align", "center");
                        }
                    }
                }
            }
            else
            {
                btnClearCompareProductsList.Visible = false;
                tblCompareProducts.Visible          = false;
            }
        }
Esempio n. 53
0
        /// <summary>
        /// Render Li and a Item
        /// </summary>
        /// <param name="holder">The holder.</param>
        /// <param name="liCssClass">The li CSS Class.</param>
        /// <param name="linkCssClass">The link CSS Class.</param>
        /// <param name="linkText">The link text.</param>
        /// <param name="linkToolTip">The link tool tip.</param>
        /// <param name="linkUrl">The link URL.</param>
        /// <param name="noFollow">Add rel="nofollow" to the link</param>
        /// <param name="showUnread">The show unread.</param>
        /// <param name="unread">The unread.</param>
        /// <param name="unreadText">The unread text.</param>
        private static void RenderMenuItem(
            Control holder, string liCssClass, string linkCssClass, string linkText, string linkToolTip, string linkUrl, bool noFollow, bool showUnread, string unread, string unreadText)
        {
            var liElement = new HtmlGenericControl("li");

            if (liCssClass.IsSet())
            {
                liElement.Attributes.Add("class", liCssClass);
            }

            if (linkToolTip.IsNotSet())
            {
                linkToolTip = linkText;
            }

            var link = new HyperLink
            {
                Target      = "_top",
                ToolTip     = linkToolTip,
                NavigateUrl = linkUrl,
                Text        = linkText
            };

            if (noFollow)
            {
                link.Attributes.Add("rel", "nofollow");
            }

            if (linkCssClass.IsSet())
            {
                link.CssClass = linkCssClass;
            }

            var unreadButton = new HtmlGenericControl("span");

            if (showUnread)
            {
                liElement.Controls.Add(unreadButton);
                unreadButton.Controls.Add(link);

                var unreadLabel = new HtmlGenericControl("span");

                unreadLabel.Attributes.Add("class", "badge badge-danger");

                unreadLabel.Attributes.Add("title", unreadText);

                unreadLabel.InnerText = unread;

                var unreadLabelText = new HtmlGenericControl("span");

                unreadLabelText.Attributes.Add("class", "sr-only");

                unreadLabelText.InnerText = unreadText;

                unreadButton.Controls.Add(unreadLabel);

                unreadButton.Controls.Add(unreadLabelText);
            }
            else
            {
                liElement.Controls.Add(link);
            }

            holder.Controls.Add(liElement);
        }
Esempio n. 54
0
        /// <summary>Render Li and a Item</summary>
        /// <param name="holder">The holder.</param>
        /// <param name="cssClass">The CSS class.</param>
        /// <param name="linkText">The link text.</param>
        /// <param name="linkToolTip">The link tool tip.</param>
        /// <param name="linkUrl">The link URL.</param>
        /// <param name="noFollow">Add rel="nofollow" to the link</param>
        /// <param name="showUnread">The show unread.</param>
        /// <param name="unread">The unread.</param>
        /// <param name="unreadText">The unread text.</param>
        /// <param name="icon">The icon.</param>
        private static void RenderMenuItem(
            Control holder,
            string cssClass,
            string linkText,
            string linkToolTip,
            string linkUrl,
            bool noFollow,
            bool showUnread,
            string unread,
            string unreadText,
            string icon)
        {
            var element = new HtmlGenericControl("li");

            if (cssClass.IsSet())
            {
                element.Attributes.Add("class", "nav-item");
            }

            if (linkToolTip.IsNotSet())
            {
                linkToolTip = linkText;
            }

            var link = new HyperLink
            {
                Target      = "_top",
                ToolTip     = linkToolTip,
                NavigateUrl = linkUrl,
                Text        = icon.IsSet()
                                          ? "<i class=\"fa fa-{0} fa-fw\"></i>&nbsp;{1}".FormatWith(icon, linkText)
                                          : linkText,
                CssClass = cssClass
            };

            if (noFollow)
            {
                link.Attributes.Add("rel", "nofollow");
            }

            var unreadButton = new HtmlGenericControl("span");

            if (showUnread)
            {
                link.Controls.Add(new LiteralControl("{0}&nbsp;".FormatWith(linkText)));
                link.Controls.Add(unreadButton);

                var unreadLabel = new HtmlGenericControl("span");

                unreadLabel.Attributes.Add("class", "badge badge-danger");

                unreadLabel.Attributes.Add("title", unreadText);

                unreadLabel.InnerText = unread;

                var unreadLabelText = new HtmlGenericControl("span");

                unreadLabelText.Attributes.Add("class", "sr-only");

                unreadLabelText.InnerText = unreadText;

                unreadButton.Controls.Add(unreadLabel);

                unreadButton.Controls.Add(unreadLabelText);
            }

            if (cssClass.Equals("nav-link"))
            {
                element.Controls.Add(link);
                holder.Controls.Add(element);
            }
            else
            {
                holder.Controls.Add(link);
            }
        }
        private void Render()
        {
            Tbl.Rows.Clear();

            TableHeaderRow header = new TableHeaderRow();

            TableHeaderCell h1 = new TableHeaderCell();
            h1.Text = "Verein";
            header.Cells.Add(h1);
            TableHeaderCell h2 = new TableHeaderCell();
            h2.Text = "Adresse";
            header.Cells.Add(h2);

            TableHeaderCell h22 = new TableHeaderCell();
            h22.Text = "Mannschaften";
            header.Cells.Add(h22);

            TableHeaderCell h3 = new TableHeaderCell();
            h3.Text = "Von/Bis";
            header.Cells.Add(h3);
            TableHeaderCell h4 = new TableHeaderCell();
            h4.Text = "Spiele/Tabelle";
            header.Cells.Add(h4);

            TableHeaderCell h50 = new TableHeaderCell();
            h50.Text = "Bearbeiten";
            header.Cells.Add(h50);

            TableHeaderCell h5 = new TableHeaderCell();
            h5.Text = "Entfernen";
            header.Cells.Add(h5);


            Tbl.Rows.Add(header);

            foreach (Turnier turnier in Turnier.GetAll())
            {
                TableRow row = new TableRow();
                TableCell cell1 = new TableCell();
                cell1.Text = turnier.VereinName;
                row.Cells.Add(cell1);
                TableCell cell2 = new TableCell();
                cell2.Text = turnier.Adresse;
                row.Cells.Add(cell2);
                TableCell cell3 = new TableCell();
                cell3.Text = "";
                foreach (Mannschaft mannschaft in turnier.Mannschaften)
                {
                    cell3.Text += mannschaft.Name+ "<br />";
                }
                row.Cells.Add(cell3);

                TableCell cell222 = new TableCell();
                cell222.Text = turnier.Datum_Von.ToShortDateString()+"/"+turnier.Datum_Bis.ToShortDateString();
                row.Cells.Add(cell222);

                HyperLink link1 = new HyperLink();
                link1.NavigateUrl = "~/Spiele.aspx?item=" + turnier.Turnier_ID.ToString();
                link1.Text = "Spiele";
                HyperLink link12 = new HyperLink();
                link12.NavigateUrl = "~/TurnierTabelle.aspx?item=" + turnier.Turnier_ID.ToString();
                link12.Text = "Tabelle";
                Label l = new Label();
                l.Text = " / ";
                TableCell cell12 = new TableCell();
                cell12.Controls.Add(link1);
                cell12.Controls.Add(l);
                cell12.Controls.Add(link12);
                row.Cells.Add(cell12);

                HyperLink link3 = new HyperLink();
                link3.NavigateUrl = "~/Turnierverwaltung.aspx?do=bearbeiten&item=" + turnier.Turnier_ID.ToString();
                link3.Text = "Bearbeiten";

                TableCell cell133 = new TableCell();
                cell133.Controls.Add(link3);
                row.Cells.Add(cell133);

                HyperLink link2 = new HyperLink();
                link2.NavigateUrl = "~/Turnierverwaltung.aspx?do=entfernen&item=" + turnier.Turnier_ID.ToString();
                link2.Text = "Entfernen";

                TableCell cell13 = new TableCell();
                cell13.Controls.Add(link2);
                row.Cells.Add(cell13);

                Tbl.Rows.Add(row);
            }
        }
Esempio n. 56
0
        protected void DataBindControl(object Source, SqlConnection sqlConn)
        {
            DropDownList ddlList = (DropDownList)Source;

            SqlCommand sqlCmd   = default(SqlCommand);
            DataTable  sqlTable = new DataTable();

            switch (ddlList.ID)
            {
            case "grdName":
                if (ddlList.SelectedIndex == Common.EMPTY_INT)
                {
                    sqlTable = CreateDataTable();
                }
                else
                {
                    sqlCmd = new SqlCommand(String.Format("GetItem_Container {0},{1},{2};",
                                                          Common.TABLE_SHAPE, Convert.ToInt32(ddlList.SelectedItem.Value), Common.ABSTRACTION_BUSINESSSTEP), sqlConn);
                    sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                }
                break;

            case "ddlBusinessList":
            case "ddlRelatedBusiness":
                sqlCmd   = new SqlCommand("GetShapeList " + Common.ABSTRACTION_BUSINESS + ",NULL", sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                break;

            case "ddlTypeList":
                sqlCmd   = new SqlCommand("GetShapeTypeList " + Common.ABSTRACTION_STEP, sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                break;

            case "ddlList":
                sqlCmd = new SqlCommand(String.Format("GetItem_Contained {0},{1},{2}",
                                                      Common.TABLE_SHAPE, ddlBusinessList.SelectedItem.Value, Common.ABSTRACTION_BUSINESSSTEP), sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);

                foreach (DataRow drTemp in sqlTable.Rows)
                {
                    if (drTemp["Related_TypeID"].ToString() != ddlTypeList.SelectedItem.Value)
                    {
                        drTemp.Delete();
                    }
                }

                break;

            case "ddlStepObjectShapeType":
                sqlCmd   = new SqlCommand("GetShapeTypeList " + Common.ABSTRACTION_OBJECT, sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                break;

            case "ddlStepObjectSystem":
                sqlCmd   = new SqlCommand("GetShapeList " + Common.ABSTRACTION_SYSTEM + "," + Common.SHAPETYPE_SYSTEM, sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                break;

            case "ddlStepObjectShape":
                sqlCmd = new SqlCommand(String.Format("GetItem_Contained {0},{1},{2}",
                                                      Common.TABLE_SHAPE, ddlStepObjectSystem.SelectedItem.Value, Common.ABSTRACTION_SYSTEMOBJECT), sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);

                foreach (DataRow drTemp in sqlTable.Rows)
                {
                    if (drTemp["Related_TypeID"].ToString() != ddlStepObjectShapeType.SelectedItem.Value.ToString())
                    {
                        drTemp.Delete();
                    }
                }

                break;

            case "ddlRelated":
                sqlCmd = new SqlCommand(String.Format("GetItem_Contained {0},{1},{2}",
                                                      Common.TABLE_SHAPE, ddlRelatedBusiness.SelectedItem.Value, Common.ABSTRACTION_BUSINESSSTEP), sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                break;

            case "grdDescription":
            case "grdLifecycle":
                sqlCmd = new SqlCommand(String.Format("GetItem {0},{1}",
                                                      Common.TABLE_SHAPE, ddlList.SelectedItem.Value), sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                break;

            case "grdAttribute":
                sqlCmd = new SqlCommand(String.Format("GetItem_AttributeValue {0},{1},NULL",
                                                      Common.TABLE_SHAPE, ddlList.SelectedItem.Value), sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                break;

            case "grdStepObject":
                sqlCmd = new SqlCommand(String.Format("GetItem_Contained {0},{1},{2}",
                                                      Common.TABLE_SHAPE, ddlList.SelectedItem.Value, Common.ABSTRACTION_STEPOBJECT), sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                break;

            //case "grdArtifacts":
            //    sqlCmd = new SqlCommand(String.Format("GetItem_Contained {0},{1},{2}",
            //        Common.TABLE_SHAPE, ddlList.SelectedItem.Value, Common.ABSTRACTION_ARTIFACT), sqlConn);
            //    sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
            //    break;

            case "grdRelations":
                sqlCmd = new SqlCommand(String.Format("GetItem_Relation NULL,{0},{1},{2}",
                                                      Common.TABLE_SHAPE, ddlList.SelectedItem.Value, Common.ABSTRACTION_STEP), sqlConn);
                sqlTable = sqlCmd.ExecuteDataTable(sqlConn);
                break;
            }

            ddlList.DataSource = sqlTable;
            ddlList.DataBind();

            switch (ddlList.ID)
            {
            case "ddlList":
                ddlList.Items.Insert(0, CreateListItem("CREATE NEW PROCESS STEP"));
                break;

            case "grdAttribute":
                for (int i = 0; i <= ddlList.Items.Count - 1; i++)
                {
                    //Label lblValue = (Label)ddlList.Items[i].Cells[2].FindControl("lblAttributeValue");
                    //HyperLink urlValue = (HyperLink)ddlList.Items[i].Cells[2].FindControl("urlAttributeValue");
                    Label     lblValue = (Label)ddlList.FindControl("lblAttributeValue");
                    HyperLink urlValue = (HyperLink)ddlList.FindControl("urlAttributeValue");

                    if ((lblValue != null))
                    {
                        try
                        {
                            Uri u = new Uri(lblValue.Text);
                            urlValue.Visible = true;
                            lblValue.Visible = false;
                        }
                        catch (UriFormatException ex)
                        {
                            urlValue.Visible = false;
                            lblValue.Visible = true;
                        }
                    }
                }

                break;
            }
        }
Esempio n. 57
0
    private void DeleteUpLoadFile(string DelType, TextBox ImgText, System.Web.UI.WebControls.Image ImgView, HyperLink FileLink, string DelFieldValue, string AspxFeildId, int NoneWidth, int NoneHeight)
    {
        string csCaseID              = LBSWC000.Text + "";
        string csCaseID2             = TXTONA001.Text + "";
        string strSQLClearFieldValue = "";

        //從資料庫取得資料

        //ConnectionStringSettings connectionString = ConfigurationManager.ConnectionStrings["SWCConnStr"];
        //using (SqlConnection SwcConn = new SqlConnection(connectionString.ConnectionString))

        ConnectionStringSettings settingGeoUser = ConfigurationManager.ConnectionStrings["SWCConnStr"];
        SqlConnection            ConnERR        = new SqlConnection();

        ConnERR.ConnectionString = settingGeoUser.ConnectionString;
        ConnERR.Open();

        strSQLClearFieldValue = " update OnlineApply07 set ";
        strSQLClearFieldValue = strSQLClearFieldValue + DelFieldValue + "='' ";
        strSQLClearFieldValue = strSQLClearFieldValue + " where SWC000 = '" + csCaseID + "' ";
        strSQLClearFieldValue = strSQLClearFieldValue + "   and ONA07001 = '" + csCaseID2 + "' ";

        SqlCommand objCmdRV = new SqlCommand(strSQLClearFieldValue, ConnERR);

        objCmdRV.ExecuteNonQuery();
        objCmdRV.Dispose();

        ConnERR.Close();

        //刪實體檔
        string TempFolderPath    = ConfigurationManager.AppSettings["SwcFileTemp"];
        string SwcCaseFolderPath = ConfigurationManager.AppSettings["SwcFilePath"];

        string DelFileName      = ImgText.Text;
        string TempFileFullPath = TempFolderPath + csCaseID + "\\" + ImgText.Text;
        string FileFullPath     = SwcCaseFolderPath + csCaseID + "\\" + ImgText.Text;

        try
        {
            if (File.Exists(TempFileFullPath))
            {
                File.Delete(TempFileFullPath);
            }
        }
        catch
        {
        }
        try
        {
            if (File.Exists(FileFullPath))
            {
                File.Delete(FileFullPath);
            }
        }
        catch
        {
        }

        switch (DelType)
        {
        case "DOC":
            FileLink.Text        = "";
            FileLink.NavigateUrl = "";
            FileLink.Visible     = false;
            break;
        }
        //畫面顯示、值的處理
        ImgText.Text         = "";
        Session[AspxFeildId] = "";
    }
Esempio n. 58
0
        protected void Page_Load(object sender, EventArgs e)
        {
            constr      = "Server=.;Database=ppo;User Id=sa;Password=cs1234;";
            con         = new SqlConnection(constr);
            Label1.Text = "";

            if (Session["user"] == null)
            {
                Label1.Text              = "";
                linkUser.Text            = "";
                this.logLink.Text        = "Login";
                this.logLink.NavigateUrl = "~/loginform.aspx";
                this.logLink.Target      = "blank";
                this.regLink.Text        = "Register";
                this.regLink.NavigateUrl = "~/registerform.aspx";
                this.regLink.Target      = "blank";
            }
            else
            {
                Label1.Text = "Welcome ";
                if (Session["type"].ToString().Equals("u"))
                {
                    linkUser.Text = Session["user"].ToString();
                }
                else
                {
                    Label1.Text  += "Admin";
                    linkUser.Text = "" + Session["user"].ToString();
                }
                if (Session["type"].ToString().Equals("a"))
                {
                    linkUser.NavigateUrl = "/profile.aspx";
                }
                else
                {
                    linkUser.NavigateUrl = "/profile.aspx";
                }
                this.regLink.Text        = "";
                this.logLink.Text        = "Logout";
                this.logLink.NavigateUrl = "~/logout.aspx";
                this.logLink.Target      = "blank";
            }

            try
            {
                string sql = "SELECT * FROM lvl";
                cmd = new SqlCommand(sql, con);
                con.Open();
                sreader = cmd.ExecuteReader();
                while (sreader.Read())
                {
                    int     lid     = (int)sreader["lvl"];
                    string  lvlname = (String)sreader["lvldetail"];
                    Literal lit     = new Literal();
                    lit.Text = "<br/>";
                    //int lvl = Convert.ToInt32(lidread);
                    string qry01 = "lvlname=" + lvlname;
                    string qry02 = "lid=" + lid;

                    HyperLink hlink = new HyperLink();
                    hlink.ID          = "" + lvlname;
                    hlink.Text        = "" + lvlname;
                    hlink.NavigateUrl = "~/problem/level.aspx?" + qry02 + "&" + qry01;
                    PlaceHolder1.Controls.Add(hlink);
                    PlaceHolder1.Controls.Add(lit);
                }
            }
            finally
            {
                if (sreader != null)
                {
                    sreader.Close();
                }
                if (con != null)
                {
                    con.Close();
                }
            }
        }
Esempio n. 59
0
        private void OnDataBinding(object sender, EventArgs e)
        {
            HyperLink    lnk          = (HyperLink)sender;
            DataGridItem objContainer = (DataGridItem)lnk.NamingContainer;
            DataRowView  row          = objContainer.DataItem as DataRowView;

            if (row != null)
            {
                try
                {
                    // 04/27/2006 Paul.  We need the module in order to determine if access is allowed.
                    Guid   gASSIGNED_USER_ID = Guid.Empty;
                    string sMODULE_NAME      = sURL_MODULE;
                    if (row.DataView.Table.Columns.Contains(sURL_ASSIGNED_FIELD))
                    {
                        gASSIGNED_USER_ID = Sql.ToGuid(row[sURL_ASSIGNED_FIELD]);
                    }
                    if (row.DataView.Table.Columns.Contains(sDATA_FIELD))
                    {
                        // 01/02/2008 Paul.  It is very important that we allow the text field to be set even when the URL_FIELD is NULL. Otherwise, nothing would be displayed.
                        // When displaying Products, we allow the display of order line items, but they are not linkable.
                        if (row[sDATA_FIELD] != DBNull.Value)
                        {
                            lnk.Text = Sql.ToString(row[sDATA_FIELD]);

                            if (row[sURL_FIELD] != DBNull.Value)
                            {
                                bool bAllowed = false;
                                // 04/27/2006 Paul.  Only provide the URL if access is allowed.
                                // 08/28/2006 Paul.  The URL_FIELD might not always be a GUID.  iFrame uses a URL in this field.
                                // 08/28/2006 Paul.  MODULE_NAME is not always available.  In those cases, assume access is allowed.
                                string sURL_FIELD_VALUE = Sql.ToString(row[sURL_FIELD]);
                                int    nACLACCESS       = ACL_ACCESS.ALL;
                                if (!Sql.IsEmptyString(sMODULE_NAME))
                                {
                                    nACLACCESS = Security.GetUserAccess(sMODULE_NAME, "view");
                                }
                                // 05/02/2006 Paul.  Admin has full access.
                                if (Security.IS_ADMIN)
                                {
                                    bAllowed = true;
                                }
                                else if (nACLACCESS == ACL_ACCESS.OWNER)
                                {
                                    // 05/02/2006 Paul.  Owner can only view if USER_ID matches the assigned user id.
                                    // 05/02/2006 Paul.  This role also prevents the user from seeing unassigned items.
                                    // This may or may not be a good thing.
                                    if (gASSIGNED_USER_ID == Security.USER_ID || Security.IS_ADMIN)
                                    {
                                        bAllowed = true;
                                    }
                                }
                                // 05/02/2006 Paul.  Allow access if the item is not assigned to anyone.
                                else if (nACLACCESS >= 0 || Sql.IsEmptyGuid(gASSIGNED_USER_ID))
                                {
                                    bAllowed = true;
                                }
                                if (bAllowed)
                                {
                                    lnk.NavigateUrl = String.Format(sURL_FORMAT, sURL_FIELD_VALUE.ToString());
                                }
                            }
                        }
                    }
                    else
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), sDATA_FIELD + " column does not exist in recordset.");
                    }
                }
                catch (Exception ex)
                {
                    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                }
            }
        }
 protected override void AttachChildControls()
 {
     this.orderId             = this.Page.Request.QueryString["orderId"];
     this.litOrderId          = (Literal)this.FindControl("litOrderId");
     this.lbltotalPrice       = (FormatedMoneyLabel)this.FindControl("lbltotalPrice");
     this.litAddDate          = (FormatedTimeLabel)this.FindControl("litAddDate");
     this.lblOrderStatus      = (OrderStatusLabel)this.FindControl("lblOrderStatus");
     this.litCloseReason      = (Literal)this.FindControl("litCloseReason");
     this.litRemark           = (Literal)this.FindControl("litRemark");
     this.litShipTo           = (Literal)this.FindControl("litShipTo");
     this.litRegion           = (Literal)this.FindControl("litRegion");
     this.litAddress          = (Literal)this.FindControl("litAddress");
     this.litZipcode          = (Literal)this.FindControl("litZipcode");
     this.litEmail            = (Literal)this.FindControl("litEmail");
     this.litPhone            = (Literal)this.FindControl("litPhone");
     this.litTellPhone        = (Literal)this.FindControl("litTellPhone");
     this.litShipToDate       = (Literal)this.FindControl("litShipToDate");
     this.litUserName         = (Literal)this.FindControl("litUserName");
     this.litUserAddress      = (Literal)this.FindControl("litUserAddress");
     this.litUserEmail        = (Literal)this.FindControl("litUserEmail");
     this.litUserPhone        = (Literal)this.FindControl("litUserPhone");
     this.litUserTellPhone    = (Literal)this.FindControl("litUserTellPhone");
     this.litUserQQ           = (Literal)this.FindControl("litUserQQ");
     this.litUserMSN          = (Literal)this.FindControl("litUserMSN");
     this.litPaymentType      = (Literal)this.FindControl("litPaymentType");
     this.litModeName         = (Literal)this.FindControl("litModeName");
     this.plOrderSended       = (Panel)this.FindControl("plOrderSended");
     this.litRealModeName     = (Literal)this.FindControl("litRealModeName");
     this.litShippNumber      = (Literal)this.FindControl("litShippNumber");
     this.litDiscountName     = (HyperLink)this.FindControl("litDiscountName");
     this.lblAdjustedDiscount = (FormatedMoneyLabel)this.FindControl("lblAdjustedDiscount");
     this.litFreeName         = (HyperLink)this.FindControl("litFreeName");
     this.plExpress           = (Panel)this.FindControl("plExpress");
     this.power                      = (HtmlAnchor)this.FindControl("power");
     this.orderItems                 = (Common_OrderManage_OrderItems)this.FindControl("Common_OrderManage_OrderItems");
     this.grdOrderGift               = (GridView)this.FindControl("grdOrderGift");
     this.plOrderGift                = (Panel)this.FindControl("plOrderGift");
     this.lblCartMoney               = (FormatedMoneyLabel)this.FindControl("lblCartMoney");
     this.lblBundlingPrice           = (Literal)this.FindControl("lblBundlingPrice");
     this.litPoints                  = (Literal)this.FindControl("litPoints");
     this.litSentTimesPointPromotion = (HyperLink)this.FindControl("litSentTimesPointPromotion");
     this.litWeight                  = (Literal)this.FindControl("litWeight");
     this.litFree                    = (Literal)this.FindControl("litFree");
     this.lblFreight                 = (FormatedMoneyLabel)this.FindControl("lblFreight");
     this.lblPayCharge               = (FormatedMoneyLabel)this.FindControl("lblPayCharge");
     this.litCouponValue             = (Literal)this.FindControl("litCouponValue");
     this.lblDiscount                = (FormatedMoneyLabel)this.FindControl("lblDiscount");
     this.litTotalPrice              = (FormatedMoneyLabel)this.FindControl("litTotalPrice");
     this.lblRefundTotal             = (FormatedMoneyLabel)this.FindControl("lblRefundTotal");
     this.lbRefundMoney              = (Label)this.FindControl("lbRefundMoney");
     this.plRefund                   = (Panel)this.FindControl("plRefund");
     this.lblTotalBalance            = (FormatedMoneyLabel)this.FindControl("lblTotalBalance");
     this.litRefundOrderRemark       = (Literal)this.FindControl("litRefundOrderRemark");
     this.litTax                     = (FormatedMoneyLabel)this.FindControl("litTax");
     this.litInvoiceTitle            = (Literal)this.FindControl("litInvoiceTitle");
     PageTitle.AddTitle("订单详细页", HiContext.Current.Context);
     if (!this.Page.IsPostBack)
     {
         OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.orderId);
         if ((orderInfo == null) || (orderInfo.UserId != HiContext.Current.User.UserId))
         {
             this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该订单不存在或者不属于当前用户的订单"));
         }
         else
         {
             this.BindOrderBase(orderInfo);
             this.BindOrderAddress(orderInfo);
             this.BindOrderItems(orderInfo);
             this.BindOrderRefund(orderInfo);
             this.BindOrderReturn(orderInfo);
         }
     }
 }