Esempio n. 1
0
        private void AddVideoWindow_Loaded(object sender, RoutedEventArgs e)
        {
            string key = QiniuUtil.GenerateGuid();

            TextFrontImg.SetKey(String.Format("{0}_videofrontimg", key));
            TextVideo.SetKey(String.Format("{0}_video", key));
            TextArtType.LoadData();
        }
        private void AddCrowFoundWindow_Loaded(object sender, RoutedEventArgs e)
        {
            string key = QiniuUtil.GenerateGuid();

            TextFrontImg.SetKey(String.Format("{0}_crowdfundfrontimg", key));
            CityControl.LoadData();
            TextArtType.LoadData();
        }
Esempio n. 3
0
        private void ButtonOK_OnClick(object sender, RoutedEventArgs e)
        {
            if (!IsCheckInput())
            {
                return;
            }
            video_info videoInfo = new video_info();

            videoInfo.v_brief = this.TextBrief.Text;
            if (TextArtType.GetCategory() != null)
            {
                videoInfo.v_category = this.TextArtType.GetCategory().fc_id;
            }

            if (TextArtType.GetSecondCategory() != null)
            {
                videoInfo.v_second_category = this.TextArtType.GetSecondCategory().cs_id;
            }
            if (TextArtType.GetThirdCategory() != null)
            {
                videoInfo.v_third_category = this.TextArtType.GetThirdCategory().ct_id;
            }

            videoInfo.v_create_time  = HelpFunction.ConvertToTimestamp(DateTime.Now);
            videoInfo.v_detail_intro = this.TextIntro.Text;
            videoInfo.v_duration     = this.TextVideoDuration.Value;
            videoInfo.v_front_icon   = this.TextFrontImg.GetUrl();
            videoInfo.v_title        = this.TextBoxTitle.Text;
            videoInfo.v_video_url    = this.TextVideo.GetUrl();

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

            if (!string.IsNullOrEmpty(this.ArtTags.Label1.Trim()))
            {
                listTag.Add(new video_label()
                {
                    label_text = ArtTags.Label1.Trim()
                });
            }
            if (!string.IsNullOrEmpty(this.ArtTags.Label2.Trim()))
            {
                listTag.Add(new video_label()
                {
                    label_text = ArtTags.Label2.Trim()
                });
            }
            if (!string.IsNullOrEmpty(this.ArtTags.Label3.Trim()))
            {
                listTag.Add(new video_label()
                {
                    label_text = ArtTags.Label3.Trim()
                });
            }

            bool bl = VideoDataMgr.Instance.SaveVideoInfo(videoInfo, listTag);

            if (bl)
            {
                MessageBox.Show("保存成功");
                this.DialogResult = true;
            }
            else
            {
                MessageBox.Show("保存失败");
                this.DialogResult = false;
            }
        }
        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;
            }
        }