Exemple #1
0
        private void ListImages()
        {
            ImageFilesDAL obj        = new ImageFilesDAL();
            DataSet       objDataset = new DataSet();

            try
            {
                //string where = " UserCreated =" + _user.UserID;
                string where = string.Empty;
                if (ddlStock.SelectedValue.Trim() != "0")
                {
                    where += " 1=1 And AuthorID =1 ";
                }
                else
                {
                    where += " 1=1 And (( AuthorID =0 ) OR (AuthorID is null ))";
                }
                if (!string.IsNullOrEmpty(fileName.Text))
                {
                    where += " AND ImageFileName like N'%" + fileName.Text + "%'";
                }
                //if (Drop_Chuyenmuc.SelectedValue.Trim() != "0")
                //    where += string.Format(" AND Categorys_ID IN (SELECT * FROM [fn_Return_Category_Tree] ({0}))", this.Drop_Chuyenmuc.SelectedValue);
                if (!String.IsNullOrEmpty(txt_FromDate.Text.Trim()))
                {
                    where += " AND " + string.Format(" (Datediff(DAY,'{0}',DateCreated)>=0) ", UltilFunc.ToDate(this.txt_FromDate.Value.ToString().Trim(), "MM/dd/yyyy"));
                }
                if (!String.IsNullOrEmpty(txt_ToDate.Text.Trim()))
                {
                    where += " AND " + string.Format(" (Datediff(DAY,'{0}',DateCreated)<=0)", UltilFunc.ToDate(this.txt_ToDate.Value.ToString().Trim(), "MM/dd/yyyy"));
                }
                else
                {
                    if (ddlStock.SelectedValue.Trim() == "0")
                    {
                        where += " AND " + string.Format(" DATEDIFF(DAY,DateCreated,'{0}')=0 ", DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                }
                where     += " ORDER BY DateCreated DESC";
                objDataset = obj.ListAllImages(where);
                if (objDataset != null)
                {
                    DataView _dv = obj.BindGridListImages(objDataset.Tables[0]);
                    dlImages.DataSource = _dv;
                    dlImages.DataBind();
                }
                objDataset.Clear();
            }
            catch
            {
                dlImages.DataSource = null;
                dlImages.DataBind();
            }
        }
        private void ListImages()
        {
            ImageFilesDAL obj        = new ImageFilesDAL();
            DataSet       objDataset = new DataSet();

            string where = " UserCreated =" + user.UserID;
            //if (!String.IsNullOrEmpty(txt_FromDate.Text.Trim()))
            //    where += " AND " + string.Format(" (Datediff(DAY,'{0}',DateCreated)>=0) ", UltilFunc.ToDate(this.txt_FromDate.Value.ToString().Trim(), "MM/dd/yyyy"));
            //if (!String.IsNullOrEmpty(txt_ToDate.Text.Trim()))
            //    where += " AND " + string.Format(" (Datediff(DAY,'{0}',DateCreated)<=0) ", UltilFunc.ToDate(this.txt_ToDate.Value.ToString().Trim(), "MM/dd/yyyy"));
            //else
            where     += " AND " + string.Format(" DATEDIFF(DAY,DateCreated,'{0}')=0 ", DateTime.Now.ToString("MM/dd/yyyy"));
            where     += " ORDER BY DateCreated DESC";
            objDataset = obj.ListAllImages(where);
            if (objDataset != null)
            {
                DataView _dv = obj.BindGridListImages(objDataset.Tables[0]);
                dlImages.DataSource = _dv;
                dlImages.DataBind();
            }
        }
Exemple #3
0
        private void ListImages()
        {
            ImageFilesDAL obj        = new ImageFilesDAL();
            DataSet       objDataset = new DataSet();

            //string where = " UserCreated =" + _user.UserID;
            string where = "";
            if (ddlStock.SelectedValue.Trim() != "0")
            {
                where += " 1=1 And AuthorID =1 ";
            }
            else
            {
                where += " 1=1 And (( AuthorID =0 ) OR (AuthorID is null ))";
            }
            if (!String.IsNullOrEmpty(txt_FromDate.Text.Trim()))
            {
                where += " AND " + string.Format(" (Datediff(DAY,'{0}',DateCreated)>=0) ", UltilFunc.ToDate(this.txt_FromDate.Value.ToString().Trim(), "MM/dd/yyyy"));
            }
            if (!String.IsNullOrEmpty(txt_ToDate.Text.Trim()))
            {
                where += " AND " + string.Format(" (Datediff(DAY,'{0}',DateCreated)<=0) ", UltilFunc.ToDate(this.txt_ToDate.Value.ToString().Trim(), "MM/dd/yyyy"));
            }
            else
            {
                if (ddlStock.SelectedValue.Trim() == "0")
                {
                    where += " AND " + string.Format(" DATEDIFF(DAY,DateCreated,'{0}')=0 ", DateTime.Now.ToString("MM/dd/yyyy"));
                }
            }
            where     += " ORDER BY DateCreated DESC";
            objDataset = obj.ListAllImages(where);
            if (objDataset != null)
            {
                DataView _dv = obj.BindGridListImages(objDataset.Tables[0]);
                dlImages.DataSource = _dv;
                dlImages.DataBind();
            }
        }