Example #1
0
 public void DeleteServerFile()
 {
     foreach (var item in uploadFileList)
     {
         ServerFileMgr.DeleteServerFile(item.Value, item.Key);
     }
 }
Example #2
0
        public void TestVideoCut()
        {
            string id = QiniuUtil.GenerateGuid();
            var    bl = ServerFileMgr.UploadFileToServer(id + "test58.mp4", @"D:\VID_20160429_130223.mp4",
                                                         FileTypeDirEnum.CrowdFundVideoDir, false, null);

            Assert.AreEqual(bl.IsSuccess, true);
            //ServerFileMgr.VideoCutPiece(FileTypeDirEnum.VideoDir, "915d46db795459d6.mp4");
        }
Example #3
0
 private ResultData Upload(string filekey, string fpath, FileTypeDirEnum dir, bool isOverride, Action <int> proAction)
 {
     try
     {
         var res = ServerFileMgr.UploadFileToServer(filekey, fpath, UploadType, isOverride, proAction);
         return(res);
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex);
     }
     return(null);
 }
Example #4
0
        public ResultData DoUploadData(UploadData data)
        {
            try
            {
                ResultData result = ServerFileMgr.UploadFileToServer(data.FileKey, data.Fpath, data.Dir, data.IsOverride,
                                                                     data.ProAction);

                return(result);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }

            return(null);
        }
Example #5
0
        private string UploadFile(string pathName)
        {
            var    file    = pathName;
            string key     = QiniuUtil.GenerateGuid();
            string filekey = string.Format("{0}{1}", key, System.IO.Path.GetExtension(file));

            try
            {
                ResultData result = ServerFileMgr.UploadFileToServer(filekey, file, _fileTypeDir, false,
                                                                     null);

                if (result != null && result.IsSuccess)
                {
                    uploadFileList.Add(result.Key, _fileTypeDir);
                    return(result.FullUrl);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }

            return(String.Empty);
        }
Example #6
0
 public void DeleteFile()
 {
     ServerFileMgr.DeleteServerFile(UploadType, ServerKey);
 }
Example #7
0
 public void DeleteServerFile(string key, FileTypeDirEnum dir)
 {
     ServerFileMgr.DeleteServerFile(dir, key);
 }
        private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
        {
            if (IsCheckInput() == false)
            {
                return;
            }
            crowd_funding crowdFunding = new crowd_funding();

            if (TextBeginDate.Value.HasValue)
            {
                crowdFunding.cf_begin_time = HelpFunction.ConvertToTimestamp(TextBeginDate.Value.Value);
            }
            category category = TextArtType.GetCategory();

            if (category != null)
            {
                crowdFunding.cf_category = category.fc_id;
            }

            crowdFunding.cf_city_id      = this.CityControl.GetCity().city_id;
            crowdFunding.cf_created_time = HelpFunction.ConvertToTimestamp(DateTime.Now);
            crowdFunding.cf_desc         = this.TextServiceIntro.HtmlContent;
            if (TextEndDate.Value.HasValue)
            {
                crowdFunding.cf_end_time = HelpFunction.ConvertToTimestamp(this.TextEndDate.Value.Value);
            }

            crowdFunding.cf_front_icon = this.TextFrontImg.GetUrl();

            if (this.TextServiceCost.Value.HasValue)
            {
                crowdFunding.cf_fund_end = (decimal)this.TextServiceCost.Value.Value;
            }
            crowdFunding.cf_name            = this.TextCrowName.Text.Trim();
            crowdFunding.cf_note            = this.TextNote.HtmlContent;
            crowdFunding.cf_owner_id        = this.TextActor.SelectActor.UserId;
            crowdFunding.cf_province_id     = this.CityControl.GetProvince().province_id;
            crowdFunding.cf_service_address = this.TextAddress.Text.Trim();

            crowdFunding.cf_service_duration = this.TextServiceDuration.Value;
            if (TextServiceTime.Value.HasValue)
            {
                crowdFunding.cf_service_time = HelpFunction.ConvertToTimestamp(this.TextServiceTime.Value.Value);
            }


            var sc = TextArtType.GetSecondCategory();

            if (sc != null)
            {
                crowdFunding.cf_second_category = sc.cs_id;
            }
            var tc = TextArtType.GetThirdCategory();

            if (tc != null)
            {
                crowdFunding.cf_third_category = tc.ct_id;
            }

            crowdFunding.cf_state = 0;

            List <cf_type> listTypes = new List <cf_type>();

            listTypes.Add(TextCrowDetail.DefaultCfType());
            foreach (var item in TextCrowDetail.CtTypes)
            {
                listTypes.Add(item);
            }

            List <cf_label> listTag = new List <cf_label>();

            if (!string.IsNullOrEmpty(this.ArtTags.Label1.Trim()))
            {
                listTag.Add(new cf_label()
                {
                    label_text = ArtTags.Label1.Trim()
                });
            }
            if (!string.IsNullOrEmpty(this.ArtTags.Label2.Trim()))
            {
                listTag.Add(new cf_label()
                {
                    label_text = ArtTags.Label2.Trim()
                });
            }
            if (!string.IsNullOrEmpty(this.ArtTags.Label3.Trim()))
            {
                listTag.Add(new cf_label()
                {
                    label_text = ArtTags.Label3.Trim()
                });
            }
            if (RadioButtonImg.IsChecked.HasValue && RadioButtonImg.IsChecked.Value)
            {
                crowdFunding.cf_front_icon_type = 0;
            }
            else
            {
                crowdFunding.cf_front_icon_type = 1;
            }

            if (TextFrontImg.UploadType == FileTypeDirEnum.CrowdFundVideoDir)
            {
                string img = "";
                bool   bll = ServerFileMgr.GetVideoThumbnailImg(FileTypeDirEnum.CrowdFundVideoDir, TextFrontImg.ServerKey, out img);
                if (bll)
                {
                    crowdFunding.cf_video_thumbnail = img;
                }
            }

            bool bl = CrowFoundMgr.Instance.SaveCrowFound(crowdFunding, listTypes, listTag);

            if (bl)
            {
                MessageBox.Show("保存成功");
                this.DialogResult = true;
            }
            else
            {
                DisposeData();
                MessageBox.Show("保存失败");
                this.DialogResult = false;
            }
        }