Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string query = Request.Params["q"].ToString();

        DataSource2.SelectCommand = "select Id,Gen_stire from Categorie where Id=" + query;
        DataSource2.DataBind();

        if (!Page.IsPostBack && Request.Params["q"] != null && Request.Params["p"] == null)
        {
            DataSource1.SelectCommand = "select Id,Gen_stire,Titlu,Descriere,Autor,Data,Imagine,Catchphrase from Stiri where Gen_stire=" + query;
            DataSource1.DataBind();
        }

        if (!Page.IsPostBack && Request.Params["q"] != null && Request.Params["p"] != null)
        {
            string query1 = Request.Params["p"].ToString();


            if (query1 != "Data1")
            {
                DataSource1.SelectCommand = "select Id, Titlu, Descriere, Autor, Data, Imagine, Catchphrase from Stiri where Gen_stire=" + query + " order by " + query1;
                DataSource1.DataBind();
            }
            else
            {
                DataSource1.SelectCommand = "select Id, Titlu, Descriere, Autor, Data, Imagine, Catchphrase from Stiri where Gen_stire=" + query + " order by Data desc";
                DataSource1.DataBind();
            }
        }
    }
Exemplo n.º 2
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (this.DoValidate() == false)
     {
         return;
     }
     _dataSource       = dataSourceSelector.GetSelectedValue() as DataSource2;
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
     this.Close();
 }
Exemplo n.º 3
0
        private void dataSourceSelector_ItemTextGetting(object sender, Controls.SEComboSelector2.ItemTextGettingEventArgs e)
        {
            DataSource2 dataSource = (DataSource2)e.Item;

            if (dataSource.SourceItem is UIElement)
            {
                UIElement element = (UIElement)dataSource.SourceItem;
                string    text    = String.Format("{0} ({1})", element.Name, FormElementEntityDevTypes.Instance.GetName(element));
                e.Text = text;
            }
        }
Exemplo n.º 4
0
 private void linkLabelDataSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     using (DataSourceEditView view = new DataSourceEditView())
     {
         view.WindowEntity = _windowEntity;
         if (view.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             if (_dataSource == null || _dataSource.String != view.DataSource.String)
             {
                 _dataSource = view.DataSource;
                 DataSourceProvideArgs args = new DataSourceProvideArgs()
                 {
                     WindowEntity = _windowEntity
                 };
                 _dataSourceName          = DataSourceProvideFactory.Instance.GetDisplayString(_dataSource.ToString(), args);
                 linkLabelDataSource.Text = _dataSourceName;
                 OnDataSourceChanged();
             }
         }
     }
 }
    public void BindData()
    {
        var username = HttpContext.Current.User.Identity.Name;

        var user = _db.t_Users.SingleOrDefault(s => s.Username == username);

        if (user != null)
        {
            if (user.Role.ToLower() == "staff")
            {
                ListView1.DataSource = DataSource1;
                DataSource1.DataBind();
            }
            if (user.Role.ToLower() == "consumer")
            {
                ListView1.DataSource = DataSource2;
                DataSource2.DataBind();
            }
        }

        ListView1.DataBind();
    }
Exemplo n.º 6
0
        public ElmSharp.EvasObject GetContent(object data, string part)
        {
            var minimumHeight = PageHeight > 800 ? 96 : 76;

            if (part == "elm.swallow.content")
            {
                DataSource2  itemSource = (DataSource2)data;
                ElmSharp.Box mainBox    = new ElmSharp.Box(Forms.NativeParent);
                mainBox.BackgroundColor = Xamarin.Forms.Color.LightYellow.ToNative();
                mainBox.MinimumHeight   = minimumHeight;
                mainBox.IsHorizontal    = false;
                mainBox.SetAlignment(-1, -1);
                mainBox.Show();

                ElmSharp.Box contentBox = new ElmSharp.Box(Forms.NativeParent);
                contentBox.MinimumHeight = minimumHeight;
                contentBox.IsHorizontal  = true;
                contentBox.SetAlignment(-1, -1);
                contentBox.Show();

                ElmSharp.Box left = new ElmSharp.Box(Forms.NativeParent);
                left.IsHorizontal = false;
                left.Show();
                left.SetWeight(4.0, 1);
                left.SetAlignment(-1, -1);
                contentBox.PackEnd(left);

                ElmSharp.Label titleName = new ElmSharp.Label(Forms.NativeParent);
                left.PackEnd(titleName);
                titleName.Show();
                titleName.Text         = $"<span font_size=34 font_style=italic color=#7F3300>   {itemSource.Name}</span>";
                titleName.MinimumWidth = 250;
                titleName.SetAlignment(-1, -1);

                ElmSharp.Label titleCategory = new ElmSharp.Label(Forms.NativeParent);
                left.PackEnd(titleCategory);
                titleCategory.Show();
                titleCategory.Text = $"<span align=center font_size=24 color=#008000>{itemSource.Category}</span>";
                titleCategory.SetAlignment(-1, -1);

                ElmSharp.Box right = new ElmSharp.Box(Forms.NativeParent);
                right.Show();
                right.MinimumWidth  = 96;
                right.MinimumHeight = minimumHeight;
                right.SetWeight(1, 1);
                right.SetAlignment(-1, 0);

                ElmSharp.Image image;

                if (itemSource.ImageFilename != "")
                {
                    image = new ElmSharp.Image(right);
                    image.Load(global::Tizen.Applications.Application.Current.DirectoryInfo.Resource + itemSource.ImageFilename + ".jpg");
                    image.SetAlignment(0.5, 0.5);
                    image.MinimumHeight = minimumHeight;
                    image.MinimumWidth  = minimumHeight;
                    image.Show();
                    right.PackEnd(image);
                }

                ElmSharp.Rectangle rec = new ElmSharp.Rectangle(left);
                rec.MinimumHeight = 1;
                rec.MinimumWidth  = 400;
                rec.AlignmentX    = -1;
                rec.Color         = ElmSharp.Color.Gray;
                rec.Show();

                contentBox.PackEnd(right);

                mainBox.PackEnd(contentBox);
                mainBox.PackEnd(rec);

                return(mainBox);
            }
            return(null);
        }
Exemplo n.º 7
0
 /// <summary>
 ///     Gets the data access adapter from a DataSource2.
 /// </summary>
 /// <typeparam name = "T"></typeparam>
 /// <param name = "query">The query.</param>
 /// <returns></returns>
 public static IDataAccessAdapter GetDataAccessAdapter <T>(DataSource2 <T> query) where T : EntityBase2
 {
     return(query == null ? null : GetDataAccessAdapter(query.Provider));
 }