Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="productId"></param>
        /// <param name="type">==NULL mặc định hình</param>
        /// <param name="type">==1:map</param>
        private void BindData(int type)
        {
            GetId();

            UploadImageBLL bll = new UploadImageBLL();

            lst = bll.GetList(string.Empty, productId.ToString(), "1", type, 1, 100, out total);
            if (total > 0)
            {
                grdMultiMaps.DataSource = lst;
                grdMultiMaps.DataBind();

                grdMultiMaps.Columns[4].Visible = true;
            }
            else
            {
                PNK_UploadImage pnk = new PNK_UploadImage();
                DataTable       dt  = Common.UtilityLocal.ObjectToData(pnk);
                grdMultiMaps.DataSource = dt;
                grdMultiMaps.DataBind();

                grdMultiMaps.Columns[4].Visible = false;
                foreach (GridViewRow row in grdMultiMaps.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        LinkButton lb = ((LinkButton)row.FindControl("lnkRemove"));
                        if (lb != null)
                        {
                            lb.Visible = false;
                        }
                    }
                }
            }
        }
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_UploadImage data = e.Item.DataItem as PNK_UploadImage;

                HtmlImage img = e.Item.FindControl("img") as HtmlImage;

                img.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Name);
                img.Alt = img.Attributes["title"] = data.Name;
            }
        }
Exemplo n.º 3
0
        protected void rptImg_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_UploadImage data = e.Item.DataItem as PNK_UploadImage;

                HtmlImage  img         = e.Item.FindControl("img") as HtmlImage;
                HtmlImage  imgThumb    = e.Item.FindControl("imgThumb") as HtmlImage;
                HtmlAnchor hypImgThumb = e.Item.FindControl("hypImgThumb") as HtmlAnchor;

                string src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Name);
                hypImgThumb.HRef = img.Src = imgThumb.Src = src;

                Literal ltrTitle = e.Item.FindControl("ltrTitle") as Literal;
                img.Alt = img.Attributes["title"] = imgThumb.Alt = imgThumb.Attributes["title"] = hypImgThumb.Title = ltrTitle.Text = WebUtils.GetFileName(data.Name);
            }
        }
Exemplo n.º 4
0
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_UploadImage data = e.Item.DataItem as PNK_UploadImage;
                StringBuilder   sb   = new StringBuilder();

                string src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Name);

                sb.AppendFormat("<a  href=\"#\" data-image=\"{0}\" data-zoom-image=\"{0}\">", src);
                sb.AppendFormat("<img id=\"zoom_03\" src=\"{0}\"/>", src);
                sb.Append(" </a>");

                Literal ltrResutl = e.Item.FindControl("ltrResutl") as Literal;
                ltrResutl.Text = sb.ToString();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// get data for insert update
        /// </summary>
        /// <param name="userObj"></param>
        /// <returns></returns>
        private PNK_UploadImage GetDataObjectParent(PNK_UploadImage productcatObj)
        {
            HttpFileCollection attachments = Request.Files;

            for (int i = 0; i < attachments.Count; i++)
            {
                HttpPostedFile attachment = attachments[i];
                if (attachment.ContentLength > 0 && !String.IsNullOrEmpty(attachment.FileName))
                {
                    productcatObj.Published  = "1";
                    productcatObj.Updatedate = DateTime.Now;
                    productcatObj.Name       = attachment.FileName;
                    productcatObj.ImagePath  = ImagePath;
                }
            }
            return(productcatObj);
        }
Exemplo n.º 6
0
        protected void btnSaveVideo_Click(object sender, EventArgs e)
        {
            GetId();

            PNK_UploadImage           productcatObj = new PNK_UploadImage();
            Generic <PNK_UploadImage> genericBLL    = new Generic <PNK_UploadImage>();

            //Get max id medical_product
            DBLibrary db = new DBLibrary();

            productId      = db.Timso_int("SELECT TOP 1 id FROM PNK_Product mp  order by id desc") + 1;
            productimageID = db.Timso_int("SELECT TOP 1 ProductID FROM [PNK_UploadImage] mp where ProductID=" + imageID + " And Name='Youtube' ");

            //Update
            if (productimageID != 0)
            {
                DBHelper.ExcuteNonQuery("Update PNK_UploadImage set Name=" + "'Youtube',ImagePath=" + "'" + txtID.Value + "' Where ProductID=" + imageID + "     ", null);
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), string.Format("jAlert('{0}','Message');", Constant.UI.admin_msg_save_success), true);
            }
            else//Insert
            {
                productcatObj.Published  = "1";
                productcatObj.Updatedate = DateTime.Now;
                productcatObj.Name       = "Youtube";
                productcatObj.ImagePath  = txtID.Value;
                productcatObj.ProductId  = imageID == int.MinValue ? productId : imageID;
                productcatObj.PostDate   = DateTime.Now;
                productcatObj.Ordering   = genericBLL.getOrdering();

                //excute
                if (genericBLL.Insert(productcatObj) != int.MinValue)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), string.Format("jAlert('{0}','Message');", Constant.UI.admin_msg_save_success), true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), string.Format("jAlert('{0}','Message');", Constant.UI.admin_msg_save_fail), true);
                }

                Session["ID"] = productId;
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Save location
        /// </summary>
        private int SaveNewsCategory(string name, string imagePath, int idImage, string longiTude, string latitude)
        {
            GetId();

            PNK_UploadImage           productcatObj = new PNK_UploadImage();
            Generic <PNK_UploadImage> genericBLL    = new Generic <PNK_UploadImage>();

            if (idImage == int.MinValue)
            {
                productcatObj.Published  = "1";
                productcatObj.Name       = name;
                productcatObj.ProductId  = DBConvert.ParseInt(productId);
                productcatObj.LongiTude  = longiTude;
                productcatObj.Latitude   = latitude;
                productcatObj.Ordering   = genericBLL.getOrdering();
                productcatObj.Type       = type;
                productcatObj.Updatedate = DateTime.Now;
                productcatObj.PostDate   = DateTime.Now;
                //excute
                genericBLL.Insert(productcatObj);
            }
            else
            {
                productcatObj.Published  = "1";
                productcatObj.Name       = name;
                productcatObj.Id         = idImage;
                productcatObj.ProductId  = DBConvert.ParseInt(productId);
                productcatObj.LongiTude  = longiTude;
                productcatObj.Latitude   = latitude;
                productcatObj.Ordering   = genericBLL.getOrdering();
                productcatObj.Type       = type;
                productcatObj.Updatedate = DateTime.Now;
                productcatObj.PostDate   = DateTime.Now;
                //excute
                genericBLL.Update(productcatObj, productcatObj, new string[] { "Id" });
                grdMultiMaps.EditIndex = -1;
            }

            BindData(type);

            return(productId);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Save location
        /// </summary>
        private int SaveNewsCategory()
        {
            GetId();

            PNK_UploadImage           productcatObj = new PNK_UploadImage();
            Generic <PNK_UploadImage> genericBLL    = new Generic <PNK_UploadImage>();

            if (idImage == int.MinValue)
            {
                //Get max id medical_product
                DBLibrary db = new DBLibrary();
                productId = db.Timso_int("SELECT TOP 1 id FROM PNK_Product mp ORDER BY id desc") + 1;

                //get data insert
                productcatObj           = this.GetDataObjectParent(productcatObj);
                productcatObj.ProductId = productId;
                productcatObj.PostDate  = DateTime.Now;
                productcatObj.Ordering  = genericBLL.getOrdering();

                //excute
                genericBLL.Insert(productcatObj);
            }
            else
            {
                productcatObj.Published  = "1";
                productcatObj.Updatedate = DateTime.Now;
                productcatObj.Name       = fileNameUpload;
                productcatObj.ImagePath  = ImagePath;
                productcatObj.ProductId  = idImage;
                productcatObj.PostDate   = DateTime.Now;
                productcatObj.Ordering   = genericBLL.getOrdering();

                //excute
                genericBLL.Insert(productcatObj);
                BindAlbum(idImage);
                //    }
                //}
            }
            return(productId);
        }