Exemplo n.º 1
0
    public bool UpdateVideoStatus(string serialnumber, int status)
    {
        bool   _ret = false;
        string sql  = @"update Resources set status=@status where itemserialnumber=@sn";
        int    i    = 0;

        SqlParameter[] ps = new SqlParameter[2];
        ps[i++] = new SqlParameter("@status", status);
        ps[i++] = new SqlParameter("@sn", serialnumber);

        try
        {
            SqlHelper.ExecuteNonQuery(CommonInfo.ConQJVRMS, CommandType.Text, sql, ps);
            _ret = true;
        }
        catch
        { }


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

        return(_ret);
    }
Exemplo n.º 2
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("设置分类失败");
            }
        }
Exemplo n.º 3
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>");
        }
Exemplo n.º 4
0
        protected void btnSetCata_Click(object sender, EventArgs e)
        {
            //Response.Write(this.hfItemId.Value);
            //return;

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

            if (string.IsNullOrEmpty(ids))
            {
                return;
            }

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



            string items = ids.Trim().Trim(";".ToCharArray());

            if (string.IsNullOrEmpty(items))
            {
                ShowMessage("设置分类失败");
                return;
            }

            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
            {
                string[] _itemarr = items.Split(";".ToCharArray());
                foreach (string itemId in _itemarr)
                {
                    //objResource.CreateRelationshipResourceAndCatalog(new Guid(Request["itemid"]), (Guid[])catalogIds.ToArray(typeof(Guid)));
                    objResource.CreateRelationshipResourceAndCatalog(new Guid(itemId), (Guid[])catalogIds.ToArray(typeof(Guid)));



                    //更新索引

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

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