Пример #1
0
        private void bindNewUpload(int pageSize,int pageIndex)
        {
            string beginDate = this.myUpload_StartDate.Text;
            string endDate = this.myUpload_EndDate.Text;
            string userId = this.hidUserId.Value;
            int pageCount = 0;
            int rowCount = 0;

            DataSet ds = new Resource().GetResourceByUserID(beginDate, endDate, userId, pageSize,pageIndex, ref pageCount, "", (int)ResourceEntity.ResourceStatus.IsProcessing);
            DataTable dt = ds.Tables[1];
            DataTable dt1 = ds.Tables[0];

            if (dt1.Rows.Count > 0)
            {
                rowCount = Convert.ToInt32(dt1.Rows[0][0].ToString());
            }

            if (dt.Rows.Count > 0)
            {
                this.drMyUpload.DataSource = dt;
                this.drMyUpload.DataBind();
            }

            this.PageBar1.PageSize = pageSize;
            this.PageBar1.RecordCount = rowCount;
        }
Пример #2
0
 private void bindGrid()
 {
     Resource r = new Resource();
     DataSet ds = r.GetMyLightBox(CurrentUser.UserId);
     this.grvMyLightBox.DataSource = ds.Tables[0].DefaultView;
     this.grvMyLightBox.DataBind();
 }
Пример #3
0
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest Request = context.Request;
            HttpResponse Response = context.Response;

            Response.ContentType = "text/plain";

            string filename = Request["fileName"];
            string retSn = string.Empty;
            string dot = "";
            if (!string.IsNullOrEmpty(filename))
            {
                string fileType = Path.GetExtension(filename).ToLower();



                if (!string.IsNullOrEmpty(fileType))
                {
                    if (fileType.IndexOf(".") > -1)
                    {
                        fileType = fileType.Substring(1);
                        dot = ".";
                    }
                }
                
                retSn = new Resource().GetSN(ResourceTypeFactory.getResourceType(fileType).ResourceSNPrefix);                
                retSn = retSn +dot+fileType+":"+filename;
            }
            context.Session["sn"] = retSn;
            Response.Write(retSn); //返回带有扩展名的新文件
        }
Пример #4
0
        protected void BindLog(int pageSize,int pageIndex)
        {   
            string username = txtLoginName.Text.Trim();
            string userId = "";

            if (!string.IsNullOrEmpty(username))
            {
               
                MemberShipManager msm = new MemberShipManager();

                if (msm.IsUserExist(username))
                {
                    User _user = msm.GetUser(username);

                    if (_user != null)
                    {
                        userId = _user.UserId.ToString();
                    }
                }
                else
                {
                    GridView1.EmptyDataText = "没有该用户";
                    this.AspNetPager1.RecordCount = 0;
                    GridView1.DataSource = null;//ds;
                    GridView1.DataBind();
                    return;
                }
            }

            if (t_Date.Text != string.Empty
                && e_Date.Text != string.Empty)
            {
                DateTime begin = Convert.ToDateTime(t_Date.Text);
                DateTime end = Convert.ToDateTime(e_Date.Text).AddDays(1);

                DataSet ds;
                
                Resource obj = new Resource();
                ds = obj.GetResourcesUploadLog(begin, end, pageSize, pageIndex, userId);

                if (ds != null && ds.Tables[1].Rows.Count > 0)
                {
                    this.AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
                    GridView1.DataSource = ds.Tables[1];
                    GridView1.DataBind();
                }
                else
                {
                    this.AspNetPager1.RecordCount = 0;
                    GridView1.DataSource = null;//ds;
                    GridView1.DataBind();
                }
            }
        }
Пример #5
0
        protected void GetVideoInfo(string itemId)
        {
             
            Resource r=new Resource();
            ResourceEntity vs = r.GetResourceInfoByItemId(itemId);

            VideoType obj = new VideoType();
            //yangguang
            //string previewPath = obj.PreviewPathRead;
            //if(string.IsNullOrEmpty(previewPath))
            //{
            //    return;
            //}

            if (vs != null)
            {
                folder = vs.FolderName;
                //yangguang
                //flvFilePath = previewPath + "/flv/" + vs.FolderName + "/" + vs.ItemSerialNum + ".flv";
                //imageFilePath = previewPath + "/image/" + vs.FolderName + "/" + vs.ItemSerialNum + ".jpg";
                //flvFilePath = obj.GetPreviewPath(vs.FolderName, vs.ItemSerialNum + ".flv", "flv");
                flvFilePath = obj.GetPreviewPathRead(vs.FolderName, vs.ItemSerialNum + ".flv", "flv");
                imageFilePath = obj.GetPreviewPathRead(vs.FolderName, vs.ItemSerialNum + ".jpg", "image");// + "/image/" + vs.FolderName + "/" + vs.ItemSerialNum + ".jpg";
                this.lb_Caption.Text = vs.Caption;
                this.lb_Description.Text = vs.Description;
                this.lb_enableDate.Text = string.Format("{0} -- {1}", vs.StartDate.ToShortDateString(), vs.EndDate.ToShortDateString());
                this.lb_FileName.Text = vs.FileName;
                this.lb_ItemSerialNum.Text = vs.ItemSerialNum;
                this.lb_Keyword.Text = vs.Keyword;
                this.lb_shotDate.Text = vs.shotDate.ToShortDateString();
                this.lb_uploadDate.Text = vs.uploadDate.ToShortDateString();
                this.lb_FileType.Text = Path.GetExtension(vs.FileName);
                this.lb_FileLength.Text = Tool.toFileSize( vs.FileSize);
                this.pageTitle.Text = vs.Caption;

                if (vs.ResourceType.Equals("video"))
                { 
                    VideoStorage v=r.GetVideoInfoBySN(vs.ItemSerialNum);
                    if (v != null)
                    {
                        if (v.ClipLength.Length > 8)
                        {
                            this.lb_duration.Text = v.ClipLength.Substring(0, 8);
                        }
                        this.lb_wh.Text = v.ClipSize;
                        this.lb_bitrate.Text = v.Bitrate;
                    }                    

                }
            
            }

            
        }
Пример #6
0
        private void bind()
        {
            string userName = this.txtLoginName.Text.Replace("'", "''").Trim();
            DateTime startDate = Convert.ToDateTime(this.t_Date.Text);
            DateTime endDate = Convert.ToDateTime(this.e_Date.Text).AddDays(1);

            Resource obj = new Resource();
            DataSet ds=obj.GetNotPassResources(userName,startDate,endDate,this.AspNetPager1.PageSize,pageIndex);
            this.GridView1.DataSource = ds.Tables[1];
            this.GridView1.DataBind();

            this.AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
        }
Пример #7
0
        protected void GetImageInfo(Guid itemId)
        {
            Resource rs = new Resource();
            ResourceEntity r = rs.GetResourceInfoByItemId(itemId.ToString());

            //更新浏览次数
            rs.UpdateResourceViewCount(itemId.ToString());


            folder = r.FolderName;

            //this.imgsrc.Src = yRootPath;
            this.lb_Description.Text = r.Description;
            this.lb_FileName.Text = r.FileName;
            this.lb_Caption.Text = r.Caption;
            this.lb_Author.Text = r.Author;
            this.lb_fileLength.Text = QJVRMS.Common.Tool.toFileSize(r.FileSize);
            this.lb_ImageType.Text = Path.GetExtension(r.FileName);
            this.lb_ItemSerialNum.Text = r.ItemSerialNum;
            this.lb_Keyword.Text = r.Keyword;
           
            this.lb_uploadDate.Text = r.uploadDate.ToString("yyyy-MM-dd");
          
            this.lb_viewCount.Text = r.ViewCount.ToString();
            string enableDate = "";
            if (r.StartDate.ToString("yyyy-MM-dd") != "1900-01-01")
            {
                enableDate += r.StartDate.ToString("yyyy-MM-dd");
            }
            enableDate += " -- ";
            if (r.EndDate.ToString("yyyy-MM-dd") != "1900-01-01")
            {
                enableDate += r.EndDate.ToString("yyyy-MM-dd");
            }
            if (enableDate != " -- ")
            {
                this.lb_enableDate.Text = enableDate;
            }

            if (r.HasCopyright == 1)
            {
                this.pSource.Visible = false;
            }
            else
            {
                this.pSource.Visible = true;
            }

            

        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["itemid"]))
                {
                    string itemId = Request["itemid"].ToString();
                    DataTable dt = new Resource().GetResourceCatalogByItemId(itemId).Tables[0];
                    foreach (DataRow dr in dt.Rows)
                    {
                        this.cataTree.ArrSelectedCheckBoxValue.Add(dr["CatalogId"].ToString().ToLower());
                    }
                }           
            
            }
        }
Пример #9
0
        protected void btnSetCata_Click(object sender, EventArgs e)
        {
            ArrayList selNodes = new ArrayList();


            TreeNode parentNode = cataTree.RootNode;
            //获取checked的节点List
            selNodes = this.cataTree.ArrCheckbox(selNodes, parentNode);


            //QJVRMS.Business.ImageStorageClass imageClass = new QJVRMS.Business.ImageStorageClass();
            Resource objResource = new Resource();

            ArrayList catalogIds = new ArrayList(selNodes.Count);
            foreach (TreeNode node in selNodes)
            {
                // chNode = (TreeNode)(nodeList[i]);
                catalogIds.Add(new Guid(node.Value));

                //imageClass.CreateRelationshipImageAndCatalog(img.ItemId, new Guid(chNode.Value));
            }


            try
            {
                objResource.CreateRelationshipResourceAndCatalog(new Guid(Request["itemid"]), (Guid[])catalogIds.ToArray(typeof(Guid)));

                //imageClass.CreateRelationshipImageAndCatalog(new Guid(Request["itemid"]), (Guid[])catalogIds.ToArray(typeof(Guid)));
                ShowMessage("设置分类成功");

                //更新索引

                //根据itemId获得SN
                ResourceEntity model = objResource.GetResourceInfoByItemId(Request["itemid"].ToString());
                if (model != null)
                {
                    string[] SNs = new string[] { model.ItemSerialNum };
                    ResourceIndex.updateIndex(SNs);
                }

            }
            catch
            {
                ShowMessage("设置分类失败");
            }
        }
Пример #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string txtName = this.txtName.Text.Trim().Replace("'", "''");

            Resource r = new Resource();
            if (r.AddLightBox(txtName, CurrentUser.UserId, "", DateTime.Now))
            {
                ShowMessage("添加成功");
            }
            else
            {
                ShowMessage("添加失败,请稍后再试");
            }

            bindGrid();

        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {

            string id=Request.QueryString["id"];
            if (!string.IsNullOrEmpty(id))
            {
                Resource r = new Resource();
                byte[] buffer = r.GetDeletedImage(new Guid(id));

                if (buffer.Length > 100)
                {
                    Response.ClearContent();
                    Response.ContentType = "image/Jpeg";
                    Response.BinaryWrite(buffer);
                }
            }

            Response.End();

        }
Пример #12
0
        protected void rptKey_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                if (e.CommandName.ToLower().Equals("del"))
                {
                    string id=e.CommandArgument.ToString();


                    Resource r = new Resource();
                    r.DelLightBox(new Guid(id));



                    bind();

                }

            }

        }
Пример #13
0
        private void InitData()
        {
            GiftBiz biz = new GiftBiz();
            
            DataTable dt = biz.GetGiftTypeList();

            ddlGiftType.DataSource = dt;
            ddlGiftType.DataTextField = "TypeName";
            ddlGiftType.DataValueField = "TypeID";
            ddlGiftType.DataBind();

            if (ViewState["Id"] != null)
            {
                GiftInfo model = biz.GetModel(ViewState["Id"].ToString());
                if (model != null)
                {
                    txtTitle.Text = model.Title;
                    txtRemark.Text = model.Remark;
                    txtQuantity.Text = model.Quantity.ToString();
                    ddlGiftType.SelectedValue = model.TypeId;


                    Resource objResource = new Resource();
                    ResourceEntity model1 = null;
                    ImageType objImg = new ImageType();

                    model1 = objResource.GetResourceInfoByItemId(model.ImageId.ToString());

                    imgGift.ImageUrl = objImg.GetPreviewPathRead(model1.FolderName, model1.ServerFileName, "170");
                    //objImg.ge
                    /*
                    ImageStorage imageModel = ImageStorage.GetImageStorageModel(new Guid(model.ImageId));
                    imgGift.ImageUrl = UIBiz.CommonInfo.GetImageUrl(170, imageModel.FolderName, imageModel.ItemSerialNum, imageModel.ImageType);
                    */
                    
                    this.catalogTree.ImagesItemId = model.ImageId;
                }
            }
        }
Пример #14
0
        private void bindLightBox()
        {
            Resource r = new Resource();
            DataSet ds = r.GetMyLightBox(CurrentUser.UserId);
           // this.ddlMyLightBox.DataSource = ds.Tables[0].DefaultView;

            //this.ddlMyLightBox.DataBind();
            this.ddlMyLightBox.DataSource = ds.Tables[0].DefaultView;
            this.ddlMyLightBox.DataTextField = "Title";
            this.ddlMyLightBox.DataValueField = "id";
            this.ddlMyLightBox.DataBind();



        }
Пример #15
0
 private void bindNewResourceStat()
 {
     DataSet ds = new Resource().GetNewResourceStatByUser(Guid.Empty);
     this.grvNewResource.DataSource = ds.Tables[0].DefaultView;
     this.grvNewResource.DataBind();
 }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e) {
            string result = string.Empty;
            string type = get_LinkParam("type");
            string id = string.Empty;
            string body = string.Empty;
            Resource rs = new Resource();
            switch (type) {
                case "orderNew"://OrderNew.aspx
                    string mailFrom = ConfigurationManager.AppSettings["mailFrom"];
                    string mailSubject1 = ConfigurationManager.AppSettings["mailSubject"];
                    if (string.IsNullOrEmpty(mailSubject1)) {
                        mailSubject1 = "有新的订单";
                    }

                    Tool t1 = new Tool();
                    mailFrom = t1.GetValue(Tool.GetDocument("/xml/System.xml"), "from");
                    if (Session["OrderNew"] != null && Session["OrderNew"].ToString() != string.Empty)
                        body = Session["OrderNew"].ToString();
                    Orders obj1 = new Orders();
                    obj1.sendNewOrder(mailFrom, mailSubject1, body);
                    break;
                case "validate"://Validating.aspx
                    string mail = get_LinkParam("mail");
                    string subject = get_LinkParam("subject");
                    
                    if (Session["Validate"] != null && Session["Validate"].ToString() != string.Empty)
                        body = Session["Validate"].ToString();
                    Tool t = new Tool();
                    XmlDocument doc = Tool.GetDocument("/xml/System.xml");
                    string smtpHost = t.GetValue(doc, "host");
                    string smtpUserName = t.GetValue(doc, "userName");
                    string smtpPassword = t.GetValue(doc, "password");

                    string fromEmail = t.GetValue(doc, "from");

                    Tool.sendMail(smtpHost, smtpUserName, smtpPassword, fromEmail, mail, subject, body);
                    break;
                case "send"://OrdersManage.aspx OrderNotPass.aspx OrderDetail.aspx
                    string _userEmail = get_LinkParam("mail");
                    string mailSubject = get_LinkParam("subject");
                    string mailBody = string.Empty;
                    if (Session["MailBody"] != null && Session["MailBody"].ToString() != string.Empty)
                        mailBody = Session["MailBody"].ToString();
                    if (!string.IsNullOrEmpty(_userEmail) && !string.IsNullOrEmpty(mailBody)) {
                        Orders obj = new Orders();
                        obj.sendNewOrderToUser(_userEmail, mailSubject, mailBody);
                    }
                    break;
                case "error": //error.aspx
                    string html = string.Empty;
                    if(Session["ErrorHtml"] != null && Session["ErrorHtml"].ToString() != string.Empty)
                        html = Session["ErrorHtml"].ToString();
                    if (!string.IsNullOrEmpty(html)) {
                        XmlDocument doc1 = Tool.GetDocument("/xml/System.xml");
                        Tool tool = new Tool();
                        string host = tool.GetValue(doc1, "host");
                        string username = tool.GetValue(doc1, "userName");
                        string pass = tool.GetValue(doc1, "password");
                        string from = tool.GetValue(doc1, "from");
                        string adminUid = ConfigurationManager.AppSettings["superAdminId"];
                        string adminEmail = new MemberShipManager().GetUserEmailByUserID(adminUid);
                        string to = adminEmail;
                        string subject1 = "错误信息";
                        Tool.sendMail(host, username, pass, from, to, subject1, html);
                    }
                    break;
                case "exif":
                    #region EXIF信息
                    string folderName = get_LinkParam("folder");
                    string fileName = get_LinkParam("file");
                    string yRootPath = string.Empty;
                    try {
                        ImageType obj = new ImageType();
                        yRootPath = obj.GetSourcePath(folderName, fileName);

                        EXIFMetaData em = new EXIFMetaData();
                        EXIFMetaData.Metadata m = em.GetEXIFMetaData(yRootPath);

                        StringBuilder sb = new StringBuilder();
                        sb.Append("<table>");
                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>设备制造商:</span>");
                        sb.Append("</td><td style=\"word-wrap:break-word;word-break:break-all;\">");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.EquipmentMake.DisplayValue) ? string.Empty : m.EquipmentMake.DisplayValue.Replace("\0", string.Empty));
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>摄影机型号:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.CameraModel.DisplayValue) ? string.Empty : m.CameraModel.DisplayValue.Replace("\0", string.Empty));
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>颜色表示:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ColorSpace.DisplayValue) ? string.Empty : m.ColorSpace.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>闪关灯模式:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.Flash.DisplayValue) ? string.Empty : m.Flash.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>焦距:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.FocalLength.DisplayValue) ? string.Empty : m.FocalLength.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>曝光时间:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ExposureTime.DisplayValue) ? string.Empty : m.ExposureTime.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>ISO:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ISOSpeed.DisplayValue) ? string.Empty : m.ISOSpeed.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>光源:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.LightSource.DisplayValue) ? string.Empty : m.LightSource.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>曝光程序:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ExposureProg.DisplayValue) ? string.Empty : m.ExposureProg.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>曝光补偿:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ExposureBias.DisplayValue) ? string.Empty : m.ExposureBias.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>相机拍照时间:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.DatePictureTaken.DisplayValue) ? string.Empty : m.DatePictureTaken.DisplayValue.Replace("\0", string.Empty));
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>宽度:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ImageWidth.DisplayValue) ? string.Empty : m.ImageWidth.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>高度:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ImageHeight.DisplayValue) ? string.Empty : m.ImageHeight.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>水平分辨率:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.XResolution.DisplayValue) ? string.Empty : m.XResolution.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>垂直分辨率:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.YResolution.DisplayValue) ? string.Empty : m.YResolution.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("</table>");
                        result = sb.ToString();
                    }
                    catch {
                        if (string.IsNullOrEmpty(result)) {
                            result = "<span style=\"color:red; padding:5px 5px 5px 5px;\">获取信息失败!!</span>";
                        }
                    }
                    #endregion
                    break;
            }

            Response.Write(result);
            Response.End();
        }
Пример #17
0
        /// <summary>
        /// 绑定收藏夹
        /// </summary>
        protected void bindMyLightBox(int pageSize,int pageIndex)
        {
            string lightboxId = this.ddlMyLightBox.SelectedValue;
            if (!string.IsNullOrEmpty(lightboxId))
            {

                
                Resource r = new Resource();
                DataSet ds=r.GetResourcesByLightBoxID(new Guid(lightboxId),pageSize,pageIndex);
                this.drMyFavorite.DataSource = ds.Tables[0];
                this.drMyFavorite.DataBind();

                int count = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString());
                this.lightboxRowCount.Text = count.ToString();

                this.MyLightBoxDownload.Visible = (count>0);
                this.MyLightBoxDownload1.Visible = this.MyLightBoxDownload.Visible;
                this.MyLightBoxDownload.NavigateUrl = "MyLightBoxDownload.aspx?id="+lightboxId;
                this.MyLightBoxDownload1.NavigateUrl = this.MyLightBoxDownload.NavigateUrl;


                this.AspNetPagerLightBox.RecordCount = count;
            
            }
        }
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {


                string ids = Request.QueryString["ids"];
                if (string.IsNullOrEmpty(ids))
                {
                    return;
                }

                ids = ids.TrimEnd(";".ToCharArray());
                string[] arrIds = ids.Split(";".ToCharArray());



                ImageType objImageType = new ImageType();
                IResourceType rt = null; 

                string physicalPath = string.Empty;
                List<string> zipFileList = new List<string>();
                foreach (string id in arrIds)
                {

                    ResourceEntity re = null;
                    Resource r = new Resource();
                    re = r.GetResourceInfoByItemId(id);

                    //physicalPath = objImageType.GetSourcePath(re.FolderName, re.ServerFileName);

                    rt = ResourceTypeFactory.getResourceTypeByString(re.ResourceType);
                    physicalPath = rt.GetSourcePath(re.FolderName, re.ServerFileName);

                    if (!string.IsNullOrEmpty(physicalPath))
                    {
                        zipFileList.Add(physicalPath);
                    }

                    //记录下载日志
                    Resource.Production_Hires_Down_Log(re.ItemSerialNum,Path.GetExtension(re.ServerFileName), CurrentUser.UserName, "", "", re.FolderName, false, re.ResourceType);


                }





                Response.ContentType = "application/octet-stream";
                Response.AppendHeader("content-disposition", "attachment; filename=\"Download.zip\"");
                Response.CacheControl = "Private";
                Response.Cache.SetExpires(DateTime.Now.AddMinutes(3));

                byte[] buffer = new byte[4096];

                ZipOutputStream zipOutputStream = new ZipOutputStream(Response.OutputStream);
                zipOutputStream.SetLevel(3);

                foreach (string fileName in zipFileList)
                {
                    

                    Stream fs = File.OpenRead(fileName);	// or any suitable inputstream

                    ZipEntry entry = new ZipEntry(ZipEntry.CleanName(Path.GetFileName(fileName)));
                    entry.Size = fs.Length;
                    zipOutputStream.PutNextEntry(entry);

                    int count = fs.Read(buffer, 0, buffer.Length);
                    while (count > 0)
                    {
                        zipOutputStream.Write(buffer, 0, count);
                        count = fs.Read(buffer, 0, buffer.Length);
                        if (!Response.IsClientConnected)
                        {
                            break;
                        }
                        Response.Flush();
                    }
                    fs.Close();
                }
                zipOutputStream.Close();

                Response.Flush();
                Response.End();
         

                

            }

        }
Пример #19
0
        protected void lbMyuploadStatTiJiao_Click(object sender,CommandEventArgs e)
        {
            string date = e.CommandArgument.ToString();
            DateTime dtStart = Convert.ToDateTime(date);
            DateTime dtEnd = dtStart.AddDays(1);

            Resource obj = new Resource();
            obj.ValidateResourceByUserDate1(CurrentUser.UserId, dtStart, dtEnd, (int)ResourceEntity.ResourceStatus.NewUpload ,(int)ResourceEntity.ResourceStatus.IsProcessing);
           


            bindMyUploadStat();
            this.profileContainer.ActiveTab = this.tabMyUpload;

        
        }
Пример #20
0
        protected void GetImageInfo(Guid itemId) {
            Resource rs = new Resource();
            ResourceEntity r = rs.GetResourceInfoByItemId(itemId.ToString());

            //更新浏览次数
            rs.UpdateResourceViewCount(itemId.ToString());


            ImageType obj = new ImageType();
            //yangguang
            //string yRootPath = obj.PreviewPath_400_Read; // 400预览图路径
            folderName = r.FolderName;
            serviceFileName = r.ServerFileName;
            //yRootPath = yRootPath + r.FolderName + @"/" + r.ServerFileName;
            string yRootPath = obj.GetPreviewPathRead(r.FolderName, r.ServerFileName, "400");
            folder = r.FolderName;

            //this.imgsrc.Src = yRootPath;
            this.lb_Description.Text = GetString(r.Description, 25);
            this.lb_FileName.Text = r.FileName;
            this.lb_Caption.Text = GetString(r.Caption, 25);
            this.lb_Author.Text = r.Author;
            this.lb_fileLength.Text = QJVRMS.Common.Tool.toFileSize(r.FileSize);
            this.lb_ImageType.Text = Path.GetExtension(r.FileName);
            this.lb_ItemSerialNum.Text = r.ItemSerialNum;
            this.lb_Keyword.Text = r.Keyword;
            this.lb_shotDate.Text = r.shotDate.ToString("yyyy-MM-dd");
            this.lb_uploadDate.Text = r.uploadDate.ToString("yyyy-MM-dd");
            this.pageTitle.Text = r.Caption;
            this.lb_viewCount.Text = r.ViewCount.ToString();
            string enableDate = "";
            if (r.StartDate.ToString("yyyy-MM-dd") != "1900-01-01") {
                enableDate += r.StartDate.ToString("yyyy-MM-dd");
            }
            enableDate += " -- ";
            if (r.EndDate.ToString("yyyy-MM-dd") != "1900-01-01") {
                enableDate += r.EndDate.ToString("yyyy-MM-dd");
            }

            this.lb_SN.Text = r.ItemSerialNum;
            //if (enableDate != " -- ") {
            //    this.lb_enableDate.Text = enableDate;
            //}

            //if (r.HasCopyright == 1) {
            //    this.pSource.Visible = false;
            //}
            //else {
            //    this.pSource.Visible = true;
            //}

            if (r.ResourceType.Equals("image")) {
                ImageInfo o = rs.GetImageInfoBySN(r.ItemSerialNum);
                if (o != null) {
                    switch (o.Hvsp.ToUpper()) {
                        case "H": this.lb_Hvsp.Text = "横图"; break;
                        case "V": this.lb_Hvsp.Text = "竖图"; break;
                        case "S": this.lb_Hvsp.Text = "方图"; break;
                        case "P": this.lb_Hvsp.Text = "全景图"; break;
                        default: this.lb_Hvsp.Text = "横图"; break;
                    }
                    this.lb_Size.Text = o.Width.ToString() + "x" + o.Height.ToString();
                }
            }

            StringBuilder OutString = new StringBuilder("");
            using (DataSet ds = GetResourceCatalog(itemId.ToString()))
            {
                if (ds != null && ds.Tables[0].Rows.Count != 0)
                {
                    DataTable cataTable = ds.Tables[0];

                    for (int i = 0; i < cataTable.Rows.Count; i++)
                    {
                        OutString.Append(cataTable.Rows[i]["CatalogName"].ToString() + "   ");
                    }

                    this.lb_Category.Text = OutString.ToString();

                }
            }



            //判断是否具有下载权限
            this.pDownload.Visible = IsSuperAdmin || rs.IsUserResource(CurrentUser.UserId, r.ItemId, (int)OperatorMethod.Download);
            this.pEdit.Visible = IsSuperAdmin || rs.IsUserResource(CurrentUser.UserId, r.ItemId, (int)OperatorMethod.Modify);
        }
Пример #21
0
        protected void Page_Load(object sender, EventArgs e) {
            try {
                id = new Guid(Request["ItemId"]).ToString();
                string type = get_LinkParam("type");
                guid = get_LinkParam("guid");
                if (string.IsNullOrEmpty(id)) {
                    Response.Write("<script language='javascript'>alert('不存在此图片或您没有权限浏览!');window.close();</script>");
                    Response.End();
                }
                GetImageInfo(new Guid(id));



                

                //缓存所有的记录试一下

                if (string.IsNullOrEmpty(type)) {







                    


                    if (Session["DataResource"] != null) {
                        guid = Guid.NewGuid().ToString().Replace("-", string.Empty);
                        Session[guid] = (DataTable)Session["DataResource"];

                        //Session[guid+"sc"]





                        if (Session["searchCondition"] != null)
                        {
                            ResourceEntity.SearchCondition sc = (ResourceEntity.SearchCondition)Session["searchCondition"];
                            if (sc.Type == ResourceEntity.SearchContidionType.BySearch)
                            {

                                DateTime beg, end;
                                Guid cataId;
                                try
                                {
                                    beg = DateTime.Parse(sc.GetValue("beg"));
                                    end = DateTime.Parse(sc.GetValue("end"));
                                }
                                catch
                                {
                                    beg = new DateTime(2000, 1, 1, 1, 1, 1);
                                    end = DateTime.MaxValue;
                                }

                                try
                                {
                                    cataId = new Guid(sc.GetValue("cataId"));
                                }
                                catch
                                {
                                    cataId = Guid.Empty;
                                }

                                int pageSize = 1;
                                int pageIndex = 1;
                                int pageCount = 1;
                                string resourceType;
                                string groupId;
                                string fileExt, fileWH;
                                string keyword;

                                int.TryParse(sc.GetValue("pageSize"), out pageSize);
                                int.TryParse(sc.GetValue("pageIndex"), out pageIndex);
                                resourceType = sc.GetValue("resourceType");
                                groupId = sc.GetValue("groupId");
                                fileExt = sc.GetValue("fileExt");
                                fileWH = sc.GetValue("fileWH");
                                keyword = sc.GetValue("keyword");


                                //先得到总的记录数
                                DataSet ds;
                                int rowCount = 0;

                                ds = QJVRMS.Business.Resource.Search(keyword, beg.ToString(), end.ToString(), cataId.ToString(), CurrentUser.UserId.ToString(), 1, 1, ref pageCount, resourceType, groupId, fileExt, fileWH);
                                int.TryParse(ds.Tables[0].Rows[0][0].ToString(), out rowCount);


                                //再把所有的取出来放到session当中
                                ds = QJVRMS.Business.Resource.Search(keyword, beg.ToString(), end.ToString(), cataId.ToString(), CurrentUser.UserId.ToString(), rowCount, 0, ref pageCount, resourceType, groupId, fileExt, fileWH);
                                //ds = QJVRMS.Business.Resource.Search(keyword, beg.ToString(), end.ToString(), cataId.ToString(), CurrentUser.UserId.ToString(), pageSize, pageIndex, ref pageCount, resourceType, groupId, fileExt, fileWH);

                                //Session["DataResource"] = ds.Tables[1];
                                Session[guid] = ds.Tables[1];
                            }
                            else if (sc.Type == ResourceEntity.SearchContidionType.ByOrder)
                            {
                              //这个就是全部
                            }
                            else if (sc.Type == ResourceEntity.SearchContidionType.ByIsHot)
                            {
                                DateTime beg, end;
                                try
                                {
                                    beg = DateTime.Parse(sc.GetValue("beg"));
                                    end = DateTime.Parse(sc.GetValue("end"));
                                }
                                catch
                                {
                                    beg = new DateTime(2000, 1, 1, 1, 1, 1);
                                    end = DateTime.MaxValue;
                                }

                                DataSet ds;
                                int rowCount = 0;
                                int pageSize = 1;
                                int pageIndex = 1;
                                string resourceType;

                                resourceType = sc.GetValue("resourceType");



                                ds = new Resource().GetResourcesByViewCount(beg, end, 1, 1, resourceType);
                                int.TryParse(ds.Tables[0].Rows[0][0].ToString(), out rowCount);


                                ds = new Resource().GetResourcesByViewCount(beg, end,rowCount, 0, resourceType);

                                Session[guid] = ds.Tables[1];
                            
                            }
                            else if (sc.Type == ResourceEntity.SearchContidionType.ByIsDownloadHot)
                            {
                                DateTime beg, end;
                                try
                                {
                                    beg = DateTime.Parse(sc.GetValue("beg"));
                                    end = DateTime.Parse(sc.GetValue("end"));
                                }
                                catch
                                {
                                    beg = new DateTime(2000, 1, 1, 1, 1, 1);
                                    end = DateTime.MaxValue;
                                }

                                DataSet ds;
                                int rowCount = 0;
                                int pageSize = 1;
                                int pageIndex = 1;
                                string resourceType;

                                resourceType = sc.GetValue("resourceType");



                                ds = new Resource().GetResourcesByDownloadCount(beg, end, 1, 1, resourceType);
                                int.TryParse(ds.Tables[0].Rows[0][0].ToString(), out rowCount);


                                ds = new Resource().GetResourcesByDownloadCount(beg, end, rowCount, 0, resourceType);

                                Session[guid] = ds.Tables[1];

                                
                            }

                            Session[guid + "sc"] = Session["searchCondition"];
                        }



                    }

                    
                    
                }

                if (Session[guid] != null) {
                    DataTable dt = (DataTable)Session[guid];
                    if (dt == null || dt.Rows.Count == 0) {
                        Response.Write("<script language='javascript'>alert('不存在此图片或您没有权限浏览!');window.close();</script>");
                        Response.End();
                    }

                    StringBuilder sb = new StringBuilder("<ul>");
                    int total = dt.Rows.Count;
                    int rowid = 1;
                    List<DetailInfo> list = new List<DetailInfo>();
                    for (int i = 0; i < total; i++) {
                        string itemid = dt.Rows[i]["ID"].ToString();
                        if (id == itemid) {
                            rowid = i + 1;
                            DetailInfo entity = new DetailInfo();
                            entity.ID = i + 1;
                            entity.ItemId = itemid;
                            entity.FolderName = dt.Rows[i]["ServerFolderName"].ToString();
                            entity.ServerFileName = dt.Rows[i]["serverfilename"].ToString();
                            list.Add(entity);
                        }
                        else {
                            DetailInfo entity = new DetailInfo();
                            entity.ID = i + 1;
                            entity.ItemId = itemid;
                            entity.FolderName = dt.Rows[i]["ServerFolderName"].ToString();
                            entity.ServerFileName = dt.Rows[i]["serverfilename"].ToString();
                            list.Add(entity);
                        }
                        
                    }
                    if (total > 1) {
                        if (rowid == 1) {
                            preId = list[total - 1].ItemId;
                            nextId = list[rowid].ItemId;
                        }
                        else if (rowid == total) {



                            preId = list[total - 2].ItemId;
                            nextId = list[0].ItemId;
                        }
                        else {
                            preId = list[rowid - 2].ItemId;
                            nextId = list[rowid].ItemId;
                        }
                    }
                    if (total <= 10) {
                        sb.Append(BuildString(list, id, 1, total, guid));
                    }
                    else {
                        int startcount = (rowid + 5) > total ? total - 9 : rowid - 4;
                        int endcount = rowid < 5 ? 10 : rowid + 5;

                        if (startcount < 1)
                            startcount = 1;

                        if (total < endcount)
                            endcount = total;

                        sb.Append(BuildString(list, id, startcount, endcount, guid));
                    }
                    sb.Append("</ul>");
                    this.Content.InnerHtml = sb.ToString();
                 }   
            }
            catch (Exception ex) {
                LogWriter.WriteExceptionLog(ex);
                Response.Write("<script language='javascript'>alert('不存在此图片或您没有权限浏览!');window.close();</script>");
                Response.End();
            }
        }
Пример #22
0
        public void ProcessRequest(HttpContext context)
        {
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");

            HttpRequest Request = context.Request;
            HttpResponse Response = context.Response;

            Response.ContentType = "text/plain";

            string action = Request.QueryString["action"];
            string _ret = "";

            if (string.IsNullOrEmpty(action))
            {


            }
            else if (action.Trim().ToLower().Equals("alert"))
            {
                //是否有需要审核的图片资源,提醒
                Resource obj = new Resource();
                string userId = Request.QueryString["userId"];
                string isSuperAdmin = Request.QueryString["isSuperAdmin"];

                if (!string.IsNullOrEmpty(userId))
                {
                    if (string.IsNullOrEmpty(isSuperAdmin))
                    {
                        isSuperAdmin = "0";
                    }

                    bool IsSuperAdmin = (isSuperAdmin == "1");

                    if (obj.IsAlertAdmin(new Guid(userId), isSuperAdmin))
                    {
                        //Response.Write("1"); //有新的图片等待审核
                        //Response.End();

                        _ret = "isResourceAlert:1";
                    }
                    else
                    {
                        //Response.Write("0"); //没有需要审核的图片
                        //Response.End();
                        _ret = "isResourceAlert:0";
                    }


                    ////看是否需要订单提醒
                   
                    //Orders objOrder = new Orders();
                    //if (objOrder.IsOrderAlertAdmin(new Guid(userId)))
                    //{
                    //    //Response.Write("0"); //有权限的人
                    //    //Response.End();

                    //    _ret = _ret + ",isOrderAlert:1";
                    //}
                    //else if (objOrder.IsOrderAlert(new Guid(userId)))
                    //{
                    //    //Response.Write("1"); //普通用户
                    //    //Response.End();
                    //    _ret = _ret + ",isOrderAlert:2";
                    //}
                    //else
                    //{
                    //    _ret = _ret + ",isOrderAlert:0";
                    
                    //}


                    ////查看是否有订单沟通提醒

                    //if (objOrder.IsOrderAlertAdmin(new Guid(userId)) || IsSuperAdmin)
                    //{
                    //    DataTable dt = objOrder.IsOrderMessageAlertAdmin();
                    //    if (dt.Rows.Count > 0)
                    //    {
                    //        _ret = _ret + ",isOrderMessageAlert:1";
                    //    }
                    //    else
                    //    {
                    //        _ret = _ret + ",isOrderMessageAlert:0";
                    //    }
                    //}
                    //else
                    //{
                    //    DataTable dt1 = objOrder.IsOrderMessageAlertUser(new Guid(userId));
                    //    if (dt1!=null && dt1.Rows.Count > 0)
                    //    {
                    //        _ret = _ret + ",isOrderMessageAlert:1";
                    //    }
                    //    else
                    //    {
                    //        _ret = _ret + ",isOrderMessageAlert:0";
                    //    }
                    //}




                }
                //Response.Write("0"); //不用提醒
                Response.Write("{"+_ret+"}");
                Response.End();
            }
        }
Пример #23
0
        private void bindMyUpload(int pageSize, int pageIndex, int validateStatus)
        {
            string beginDate=this.myUpload_StartDate.Text;
            string endDate=this.myUpload_EndDate.Text;
            string userId=CurrentUser.UserId.ToString();
            
            int pageCount = 0;
            int rowCount = 0;


            endDate = Convert.ToDateTime(endDate).AddDays(1).ToString();
            DataSet ds = new Resource().GetResourceByUserID(beginDate, endDate, userId, pageSize, pageIndex, ref pageCount, "", validateStatus);
            DataTable dt1 = ds.Tables[0];
            DataTable dt = ds.Tables[1];

            if (dt1.Rows.Count > 0)
            {
                rowCount = Convert.ToInt32(dt1.Rows[0][0].ToString());
            }
            if (dt.Rows.Count > 0)
            {
                this.drMyUpload.DataSource = dt;
                this.drMyUpload.DataBind();
            }
            else
            {
                this.drMyUpload.DataSource = null;
                this.drMyUpload.DataBind();
            }

            this.pbMyUpload.PageSize = pageSize;
            this.pbMyUpload.RecordCount = rowCount;

            this.AspNetPagerUpload.PageSize = pageSize;
            this.AspNetPagerUpload.RecordCount = rowCount;
        }
Пример #24
0
        private void bindMyUpload(int pageSize, int pageIndex, int validateStatus,DateTime beginDate,DateTime endDate,Guid userId)
        {
    
            int pageCount = 0;
            int rowCount = 0;

            DataSet ds = new Resource().GetResourceByUserID(beginDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"), userId.ToString(), pageSize, pageIndex, ref pageCount, "", validateStatus);
            DataTable dt1 = ds.Tables[0];
            DataTable dt = ds.Tables[1];

            if (dt1.Rows.Count > 0)
            {
                rowCount = Convert.ToInt32(dt1.Rows[0][0].ToString());
            }
            if (dt.Rows.Count > 0)
            {
                this.drMyUpload.DataSource = dt;
                this.drMyUpload.DataBind();
            }

            this.pbMyUpload.PageSize = pageSize;
            this.pbMyUpload.RecordCount = rowCount;

            this.AspNetPagerUpload.PageSize = pageSize;
            this.AspNetPagerUpload.RecordCount = rowCount;
        }
Пример #25
0
 protected void lbClearMyLightbox_Click(object sender, EventArgs e)
 {
     
     string lightboxId = this.ddlMyLightBox.SelectedValue;
     if (!string.IsNullOrEmpty(lightboxId))
     {
         Resource r = new Resource();
         if (r.ClearLightBox(new Guid(lightboxId)))
         {
             ShowMessage("清除收藏夹成功过");
             bindMyLightBox(this.AspNetPagerLightBox.PageSize,1);
         }
         else
         { 
             
         }
     }
 }
Пример #26
0
        protected void btnUpload_ServerClick(object sender, EventArgs e)
        {
            //是否有版权的资源
            int hasCopyRight = 0;
            try
            {
                hasCopyRight = Convert.ToInt32(this.rblCopyright.SelectedValue);
            }
            catch (Exception ex)
            { }


            #region 验证日期部分
            //if (this.shotDate1.Text.Trim() == string.Empty)
            //{
            //    this.ShowMessage(this, "请选择时间");
            //    return;
            //}
            //else
            //{
            //    if (Convert.ToDateTime(this.shotDate1.Text) > DateTime.Now)
            //    {
            //        this.ShowMessage(this, "拍摄时间应比现在早");
            //        return;
            //    }
            //}
            //验证日期
            DateTime sDate = new DateTime();
            DateTime eDate = new DateTime();
            if (this.startDate.Text != "")
            {
                //有效开始日期就不做验证了,只要结束日期比现在晚就可以了。

                sDate = Convert.ToDateTime(this.startDate.Text);
                //if (sDate <= DateTime.Now)
                //{
                //    this.ShowMessage(this, "有效开始日期应比现在日期晚");
                //    return;
                //}
            }
            else
            {
                sDate = Convert.ToDateTime("1900-01-01");
            }
            if (this.endDate.Text != "")
            {
                eDate = Convert.ToDateTime(this.endDate.Text);

                if (sDate == Convert.ToDateTime("1900-01-01") && eDate < DateTime.Now)
                {
                    this.ShowMessage(this, "有效结束日期应至少比现在日期晚");
                    return;
                }
                else if (eDate < sDate)
                {
                    this.ShowMessage(this, "有效结束日期应比有效开始日期晚");
                    return;
                }
            }
            else
            {
                eDate = Convert.ToDateTime("1900-01-01");
            }

            #endregion 


            #region 验证是否选择目录节点
            ////根节点
            //TreeNode parentNode = catalogTree.RootNode;
            ////获取checked的节点List
            //ArrayList nodeList = new ArrayList();
            //this.catalogTree.ArrCheckbox(nodeList, parentNode);

            //ArrayList catalogIds = new ArrayList(nodeList.Count);
            //foreach (TreeNode node in nodeList)
            //{

            //    catalogIds.Add(new Guid(node.Value));
            //}

            //if (catalogIds.Count == 0)
            //{
            //    this.ShowMessage(this, "没有选择分类,上传失败!");
            //    return;
            //}


            string catIds = this.hidCatIds.Value.Trim().Trim(new char[] { ',' });
            string[] arrCatIds = catIds.Split(",".ToCharArray());
            if (arrCatIds.Length == 0)
            {
                this.ShowMessage(this, "没有选择分类,上传失败!");
                return;
            }
            ArrayList catalogIds = new ArrayList(arrCatIds.Length);
            foreach(string _s in arrCatIds)
            {
                catalogIds.Add(new Guid(_s));
            }
            #endregion 


            string fileName = "";   //原始文件名
            if (!string.IsNullOrEmpty(Request["selectedFile"]))
            {
                fileName = Request["selectedFile"].ToString().ToLower();
            }
            else
            {
                return;
            }

            string uploadFileName = ""; //上传以后重新分配的文件名 prefix+yymmdd+00001.extention
            if (!string.IsNullOrEmpty(Request["uploadFileName"]))
            {
                uploadFileName = Request["uploadFileName"].ToString();
            }
            else
            {
                return;
            }

            string[] arrFiles = uploadFileName.Split(',');


            foreach (string singleFiles in arrFiles) {
                if (!singleFiles.Contains(":")) {
                    continue;
                }

                string[] _arr = singleFiles.Split(':');
                string strClientFileName = _arr[1];
                string strServerFileName = _arr[0];



                fileName = strClientFileName;
                uploadFileName = strServerFileName;

                /** start **/
                Resource objResource = new Resource();
                ResourceEntity model = new ResourceEntity();

                //管理员上传直接审核通过
                if (IsSuperAdmin) {
                    model.Status = (int)ResourceEntity.ResourceStatus.IsPass;
                }
                else {
                    model.Status = (int)ResourceEntity.ResourceStatus.NewUpload;
                }

                //改成所有人上传的都可以直接通过 , 到时直接注释下面一句话就可以
                model.Status = (int)ResourceEntity.ResourceStatus.IsPass;
                model.Status = 0;

                if (this.txt_Caption.Value.Trim().Length > 0) {
                    model.Caption = this.txt_Caption.Value;
                }
                else {
                    model.Caption = Path.GetFileNameWithoutExtension(strClientFileName);
                }

                model.Description = this.description.Value;
                model.EndDate = eDate;
                model.FileName = fileName;
                model.FolderName = CurrentUser.UserLoginName;
                if (uploadFileName.ToLower().IndexOf(".cr2") != -1 || uploadFileName.ToLower().IndexOf(".nef") != -1 || uploadFileName.ToLower().IndexOf(".psd") != -1) {
                    model.ServerFileName = uploadFileName.Replace("cr2", "jpg").Replace("nef", "jpg").Replace("psd", "jpg");
                }
                else {
                    model.ServerFileName = uploadFileName;
                }
                model.GroupId = CurrentUser.UserGroupId;
                model.ItemId = Guid.NewGuid();
                model.ItemSerialNum = Path.GetFileNameWithoutExtension(uploadFileName);
                //model.Keyword = this.keyWord.Value;
                model.Keyword = this.txtKeyWords.Text.Trim().Trim(",".ToCharArray());
                //model.shotDate = Convert.ToDateTime(this.shotDate1.Text);
                model.StartDate = sDate;
                model.uploadDate = DateTime.Now;
                model.userId = CurrentUser.UserId;
                model.updateDate = DateTime.Now;
                model.Author = this.txt_Author.Value.Trim();

                //取得文件的扩展名,不包括.号
                string fileExtName = string.Empty;
                fileExtName = Path.GetExtension(fileName);
                if (fileExtName.IndexOf(".") > -1)
                {
                    fileExtName = fileExtName.Substring(1);
                }

                model.ResourceType = ResourceTypeFactory.getResourceType(fileExtName).ResourceType;
                model.FileSize = Resource.GetResourceFileSize(uploadFileName, model.FolderName, fileExtName, "");
                model.HasCopyright = hasCopyRight;

                model.shotDate = DateTime.Now;
                DateTime shotDateTime = Resource.GetResourceShotDateTime(uploadFileName, model.FolderName, model.ResourceType, "");
                if (shotDateTime != DateTime.MinValue) {
                    model.shotDate = shotDateTime;
                }

                objResource.Add(model);
                objResource.CreateRelationshipResourceAndCatalog(model.ItemId, (Guid[])catalogIds.ToArray(typeof(Guid)));

                //同时更新索引
                string[] SNs = new string[] { model.ItemSerialNum };
                ResourceIndex.updateIndex(SNs);


            }
            /** end  **/



            #region 注释部分

            //VideoStorageClass vsc = new VideoStorageClass();
            //VideoStorage v = new VideoStorage();
            //v.Caption = this.txt_Caption.Value;
            //v.Description = this.description.Value;
            //v.EndDate = eDate;
            //v.FileName = fileName;
            //v.FolderName = CurrentUser.UserLoginName;
            //v.ServerFileName = uploadFileName;
            //v.GroupId = CurrentUser.UserGroupId;
            //v.ItemId = Guid.NewGuid();
            //v.ItemSerialNum = Path.GetFileNameWithoutExtension(uploadFileName);
            //v.Keyword = this.keyWord.Value;
            //v.shotDate = Convert.ToDateTime(this.shotDate.Value);
            //v.StartDate = sDate;
            //v.uploadDate = DateTime.Now;
            //v.userId = CurrentUser.UserId;
            //v.updateDate = DateTime.Now;

            ////存储数据库记录
            //// img.ItemSerialNum = ImageStorageClass.AddImageStorage(img);

            //if (!vsc.Add(v))
            //{
            //    this.ShowMessage(this, "上传失败");
            //    return;
            //}

            //vsc.CreateRelationshipVideoAndCatalog(v.ItemId, (Guid[])catalogIds.ToArray(typeof(Guid)));
            #endregion


            //this.shotDate1.Text = "";
            this.keyWord.Value = "";
            this.description.Value = "";
            this.txt_Caption.Value = "";
            this.startDate.Text = "";
            this.endDate.Text = "";
            initCalendar();
            
            //this.ShowMessage(this, "上传成功");
            //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>myUploadSuccess2()</script>");
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>myUploadSuccess2()</script>");
        }
Пример #27
0
        public void ProcessRequest(HttpContext context)
        {
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            HttpRequest Request = context.Request;
            HttpResponse Response = context.Response;

            Response.ContentType = "text/plain";

            string action = Request.QueryString["action"];

            if (string.IsNullOrEmpty(action))
            { 
                
            
            }
            else if (action.Trim().ToLower().Equals("validatealert"))
            {
                //是否提醒
                Resource obj = new Resource();
                string userId = Request.QueryString["userId"];
                string isSuperAdmin=Request.QueryString["isSuperAdmin"];

                if (!string.IsNullOrEmpty(userId))
                {
                    if(string.IsNullOrEmpty(isSuperAdmin))
                    {
                        isSuperAdmin="0";
                    }

                    if (obj.IsAlertAdmin(new Guid(userId),isSuperAdmin))
                    {
                        Response.Write("1"); //有新的图片等待审核
                        Response.End();
                    }
                    else
                    {
                        Response.Write("0"); //没有需要审核的图片
                        Response.End();
                    }



                }
                Response.Write("0"); //不用提醒
                Response.End();
            }
            else if (action.Trim().ToLower().Equals("delbatch"))
            { 
                //批量删除

                string itemIds = Request.Form["itemIds"];
                if (string.IsNullOrEmpty(itemIds))
                {
                    Response.Write("0"); //参数错误
                    Response.End();
                    
                }
                itemIds = itemIds.TrimEnd(";".ToCharArray());

                string userId = Request.QueryString["userId"];

                string[] arrId = itemIds.Split(";".ToCharArray());
                foreach (string id in arrId)
                {
                    //删除的图片要记录一下

                    byte[] buffer;

                    ResourceEntity re = null;
                    Resource r = new Resource();
                    re = r.GetResourceInfoByItemId(id);
                    
                    string ItemSerialNum = "";
                    string ImageType = "";
                    string str = "";//判断170图片或者400图片有没有被删除

                    ItemSerialNum = re.ItemSerialNum;
                    //ItemSerialNum = lb_ItemSerialNum.Text;
                    //ImageType = lb_ImageType.Text;
                    //bool isValidate = QJVRMS.Business.ImageStorageClass.DeleteImageStorage(new Guid(this.Hidden_ItemId.Value));

                    bool isValidate = Resource.DeleteResource(re.ItemId);
                    string attachmentFolder = string.Empty;

                    string sourceFolder = string.Empty;
                    string attachmentsFolder = string.Empty;
                    if (re.ResourceType.ToLower().Equals("image"))
                    {
                        string _170Folder;
                        string _400Folder;

                        ImageType obj = new ImageType();
                        
                        try
                        {
                            
                            //记录图片
                            
                            string img = obj.GetPreviewPath(re.FolderName, re.ServerFileName, "170");
                            ImageHelper objImgHelper = new ImageHelper(img);
                            objImgHelper.Resize(80);
                            using (MemoryStream ms = new MemoryStream())
                            {
                                objImgHelper.GetImage().Save(ms, ImageFormat.Jpeg);
                                buffer = ms.ToArray();
                            }
                            objImgHelper.Dispose();



                            //记录日志
                            if (!string.IsNullOrEmpty(userId))
                            {
                                User objUser = new MemberShipManager().GetUser(new Guid(userId));
                                if (objUser != null)
                                {

                                    //日志,所有的删除,只记录一次
                                    LogEntity model = new LogEntity();
                                    model.id = Guid.NewGuid();
                                    model.userId = objUser.UserId;
                                    model.userName = objUser.UserLoginName;
                                    model.EventType = ((int)LogType.DeleteResource).ToString();
                                    model.EventResult = "成功";
                                    model.EventContent = "图片序号:"+re.ItemSerialNum;
                                    model.IP = HttpContext.Current.Request.UserHostAddress;
                                    model.AddDate = DateTime.Now;
                                    new Logs().Add(model);

                                    r.SaveDeletedImage(model.id, buffer);
                                }

                            }


                            File.Delete(obj.GetSourcePath(re.FolderName, re.ServerFileName));
                            attachmentsFolder = obj.SourcePaths[obj.PathNumber].Trim();
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "170"));
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "400"));



                        }
                        catch { }
                    }
                    else if (re.ResourceType.ToLower().Equals("video"))
                    {
                        string _previewPolder = CommonInfo.VideoPreviewPath;

                        VideoType obj = new VideoType();
                        
                        try
                        {
                            File.Delete(obj.GetSourcePath(string.Empty, re.ServerFileName));
                            attachmentsFolder = obj.SourcePaths[obj.PathNumber].Trim();
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "flv"));
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "image"));
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "smallflv"));
                        }
                        catch
                        {

                        }
                    }

                    //sourceFolder = Path.Combine(sourceFolder, CurrentUser.UserLoginName);
                    //sourceFolder = Path.Combine(sourceFolder, WebUI.UIBiz.CommonInfo.AttachFolder);

                    #region 删除物理文件 by ciqq 2010-4-2
                   
                    //删除所有的附件
                    //string sourceFolder = Path.Combine(WebUI.UIBiz.CommonInfo.ImageRootPath, this.hiFolder.Value);

                    //根据资源ID获得所有的附件

                    DataTable dt = Resource.GetAttachList(new Guid(id));

                    //dt.Columns.Add("fileNamefileLength");

                    //foreach (DataRow dr in dt.Rows)
                    //{
                    //    dr["fileNamefileLength"] = dr["filename"].ToString() + " ( " + Tool.toFileSize(Convert.ToInt64(dr["fileLength"].ToString())) + " ) ";

                    //}

                    //this.attList.DataSource = dt;
                    //this.attList.DataBind();


                    string fileName = "";
                    attachmentsFolder = Path.Combine(attachmentsFolder, re.FolderName);
                    attachmentsFolder = Path.Combine(attachmentsFolder, UIBiz.CommonInfo.AttachFolder);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        //fileName = this.attList.DataKeys[i].Values[1].ToString();
                        fileName = dt.Rows[i]["filename"].ToString();
                        fileName = Path.Combine(attachmentsFolder, fileName);
                        try
                        {
                            File.Delete(fileName);
                        }
                        catch (Exception ex)
                        {
                            LogWriter.WriteExceptionLog(ex);
                        }
                    }                   
                    #endregion
                }


                

                Response.Write("0"); //不用提醒
                Response.End();


                
              
                
            }


        }
Пример #28
0
        protected void GetImageInfo(Guid itemId)
        {
            Resource rs = new Resource();
            ResourceEntity r = rs.GetResourceInfoByItemId(itemId.ToString());

            if (!r.ResourceType.ToLower().Equals("image"))
            {
                return;
            
            }



            //水印图片
            FileStream s1 = new FileStream(Server.MapPath(IMAGEPATH), FileMode.Open, FileAccess.Read);
            byte[] b1 = new byte[int.Parse(s1.Length.ToString())];
            s1.Read(b1, 0, int.Parse(s1.Length.ToString()));
            s1.Close();

            

            ImageType obj = new ImageType();
            //yangguang
            //string strPhysicalPath = Path.Combine(Path.Combine(obj.SourcePath,r.FolderName),r.ServerFileName);
            string strPhysicalPath = obj.GetSourcePath(r.FolderName, r.ServerFileName);
            if (File.Exists(strPhysicalPath))
            {
                

                Stream iStream = null;
                String tmpFilePath=string.Empty;
                try
                {
                    byte[] buffer = new Byte[10000];
                    int length;
                    long dataToRead;
                    string filepath = strPhysicalPath;
                    string filename = Path.GetFileName(filepath);


                    //压缩
                    String tmpFileName=DateTime.Now.ToString("yyyyMMddhhmmss")+".bin";
                    //yangguang
                    //tmpFilePath=Path.Combine(obj.SourcePath,tmpFileName);
                    tmpFilePath = Path.Combine(obj.SourcePaths[obj.PathNumber].Trim(), tmpFileName);//obj.GetSourcePath(string.Empty, tmpFileName);

                    System.Drawing.Image srcImage = System.Drawing.Image.FromFile(filepath);
                    int imgWidth = srcImage.Width;
                    int imgHeight = srcImage.Height;


                    if (imgWidth > 1000 || imgHeight > 1000)
                    {
                        ArrayList sarray = new ArrayList();
                        sarray.Add(strPhysicalPath);
                        ArrayList aarray = new ArrayList();
                        aarray.Add(tmpFilePath);
                        ImageController.ToZipImage(sarray, aarray, 1000);

                        iStream = new FileStream(tmpFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                    }
                    else
                    {
                        iStream = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read);
                    }

                    //用户选择的原图
                    
                    byte[] b = new byte[int.Parse(iStream.Length.ToString())];
                    iStream.Read(b, 0, int.Parse(iStream.Length.ToString()));
                    iStream.Close();


                    QJImagePro.Handles.PictureHandle pic = QJImagePro.PictureFactory.CreateHandle(QJImagePro.PictureType.Jpeg);
                    string showType = GetShowType();
                    int type = string.IsNullOrEmpty(showType) ? 0 : int.Parse(showType);
                    byte[] by = pic.Watermarking(b, b1, 72, type);
                    Response.ContentType = "image/Jpeg";
                    Response.BinaryWrite(by);
                }
                catch (Exception ex)
                {
                    LogWriter.WriteExceptionLog(ex);
                }
                finally
                {
                    if (iStream != null)
                    {
                        iStream.Close();
                    }
                    if (File.Exists(tmpFilePath))
                    {
                        File.Delete(tmpFilePath);
                    }
                }
            
            }

        }
Пример #29
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {   
            string[] ids = chbIds.Value.Split(",".ToCharArray());

            ResourceEntity re = null;
            Resource r = new Resource();

            foreach (string id in ids)
            {
                //单个删除
               
                re = r.GetResourceInfoByItemId(id);
               
                string ItemSerialNum = "";
                string ImageType = "";
                string str = "";//判断170图片或者400图片有没有被删除
           
                bool isValidate = Resource.DeleteResource(re.ItemId);
                string attachmentFolder = string.Empty;

                string sourceFolder = string.Empty;
                string attachmentsFolder = string.Empty;
                if (re.ResourceType.ToLower().Equals("image"))
                {
                    string _170Folder;
                    string _400Folder;

                    ImageType obj = new ImageType();
                    //yangguang
                    //sourceFolder = obj.SourcePath;
                    //attachmentsFolder = obj.SourcePath;
                    //_170Folder = obj.PreviewPath_170;
                    //_400Folder = obj.PreviewPath_400;

                    //sourceFolder = Path.Combine(sourceFolder, re.FolderName);
                    //_170Folder = Path.Combine(_170Folder, re.FolderName);
                    //_400Folder = Path.Combine(_400Folder, re.FolderName);

                    //try
                    //{
                    //    File.Delete(Path.Combine(sourceFolder, re.ServerFileName));
                    //    File.Delete(Path.Combine(_170Folder, re.ServerFileName));
                    //    File.Delete(Path.Combine(_400Folder, re.ServerFileName));
                    //}
                    //catch { }

                    try {
                        File.Delete(obj.GetSourcePath(re.FolderName, re.ServerFileName));
                        attachmentsFolder = obj.SourcePaths[obj.PathNumber].Trim();
                        File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "170"));
                        File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "400"));
                    }
                    catch { }


                    //这里还要加上附件的删除
                    DataTable dt = Resource.GetAttachList(new Guid(id));

                    string fileName = "";
                    attachmentsFolder = Path.Combine(attachmentsFolder, re.FolderName);
                    attachmentsFolder = Path.Combine(attachmentsFolder, UIBiz.CommonInfo.AttachFolder);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        fileName = dt.Rows[i]["fileName"].ToString();
                        fileName = Path.Combine(attachmentsFolder, fileName);
                        try
                        {
                            File.Delete(fileName);
                        }
                        catch (Exception ex)
                        {
                            LogWriter.WriteExceptionLog(ex);
                        }
                    }
                }
                
                
            }


            bind();
        }
Пример #30
0
        private void bindMyUploadStat()
        {
            DateTime dtStart = Convert.ToDateTime(this.myUploadStat_StartDate.Text);
            DateTime dtEnd = Convert.ToDateTime(this.myUploadStat_EndDate.Text).AddDays(1);

            DataSet ds = new Resource().GetMyUploadStatus(dtStart, dtEnd, CurrentUser.UserId);
            this.grvMyUploadStat.DataSource = ds.Tables[0].DefaultView;
            this.grvMyUploadStat.DataBind();
        }