コード例 #1
0
ファイル: Video.cs プロジェクト: huaminglee/myyyyshop
 public Maticsoft.Model.CMS.Video GetModelEx(int VideoID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append(" SELECT Top 1 * FROM View_Video ");
     builder.Append(" where VideoID=@VideoID");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@VideoID", SqlDbType.Int, 4) };
     cmdParms[0].Value = VideoID;
     Maticsoft.Model.CMS.Video video = new Maticsoft.Model.CMS.Video();
     DataSet ds = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (DataSetTools.DataSetIsNull(ds))
     {
         return null;
     }
     if (ds.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if ((ds.Tables[0].Rows[0]["VideoID"] != null) && (ds.Tables[0].Rows[0]["VideoID"].ToString() != ""))
     {
         video.VideoID = int.Parse(ds.Tables[0].Rows[0]["VideoID"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["Title"] != null) && (ds.Tables[0].Rows[0]["Title"].ToString() != ""))
     {
         video.Title = ds.Tables[0].Rows[0]["Title"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["Description"] != null) && (ds.Tables[0].Rows[0]["Description"].ToString() != ""))
     {
         video.Description = ds.Tables[0].Rows[0]["Description"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["AlbumID"] != null) && (ds.Tables[0].Rows[0]["AlbumID"].ToString() != ""))
     {
         video.AlbumID = new int?(int.Parse(ds.Tables[0].Rows[0]["AlbumID"].ToString()));
     }
     if ((ds.Tables[0].Rows[0]["CreatedUserID"] != null) && (ds.Tables[0].Rows[0]["CreatedUserID"].ToString() != ""))
     {
         video.CreatedUserID = int.Parse(ds.Tables[0].Rows[0]["CreatedUserID"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["CreatedUserName"] != null) && (ds.Tables[0].Rows[0]["CreatedUserName"].ToString() != ""))
     {
         video.CreatedUserName = ds.Tables[0].Rows[0]["CreatedUserName"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["CreatedDate"] != null) && (ds.Tables[0].Rows[0]["CreatedDate"].ToString() != ""))
     {
         video.CreatedDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreatedDate"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["LastUpdateUserID"] != null) && (ds.Tables[0].Rows[0]["LastUpdateUserID"].ToString() != ""))
     {
         video.LastUpdateUserID = new int?(int.Parse(ds.Tables[0].Rows[0]["LastUpdateUserID"].ToString()));
     }
     if ((ds.Tables[0].Rows[0]["LastUpdateUserName"] != null) && (ds.Tables[0].Rows[0]["LastUpdateUserName"].ToString() != ""))
     {
         video.LastUpdateUserName = ds.Tables[0].Rows[0]["LastUpdateUserName"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["LastUpdateDate"] != null) && (ds.Tables[0].Rows[0]["LastUpdateDate"].ToString() != ""))
     {
         video.LastUpdateDate = new DateTime?(DateTime.Parse(ds.Tables[0].Rows[0]["LastUpdateDate"].ToString()));
     }
     if ((ds.Tables[0].Rows[0]["Sequence"] != null) && (ds.Tables[0].Rows[0]["Sequence"].ToString() != ""))
     {
         video.Sequence = int.Parse(ds.Tables[0].Rows[0]["Sequence"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["VideoClassID"] != null) && (ds.Tables[0].Rows[0]["VideoClassID"].ToString() != ""))
     {
         video.VideoClassID = new int?(int.Parse(ds.Tables[0].Rows[0]["VideoClassID"].ToString()));
     }
     if ((ds.Tables[0].Rows[0]["IsRecomend"] != null) && (ds.Tables[0].Rows[0]["IsRecomend"].ToString() != ""))
     {
         if ((ds.Tables[0].Rows[0]["IsRecomend"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsRecomend"].ToString().ToLower() == "true"))
         {
             video.IsRecomend = true;
         }
         else
         {
             video.IsRecomend = false;
         }
     }
     if ((ds.Tables[0].Rows[0]["ImageUrl"] != null) && (ds.Tables[0].Rows[0]["ImageUrl"].ToString() != ""))
     {
         video.ImageUrl = ds.Tables[0].Rows[0]["ImageUrl"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["ThumbImageUrl"] != null) && (ds.Tables[0].Rows[0]["ThumbImageUrl"].ToString() != ""))
     {
         video.ThumbImageUrl = ds.Tables[0].Rows[0]["ThumbImageUrl"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["NormalImageUrl"] != null) && (ds.Tables[0].Rows[0]["NormalImageUrl"].ToString() != ""))
     {
         video.NormalImageUrl = ds.Tables[0].Rows[0]["NormalImageUrl"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["TotalTime"] != null) && (ds.Tables[0].Rows[0]["TotalTime"].ToString() != ""))
     {
         video.TotalTime = new int?(int.Parse(ds.Tables[0].Rows[0]["TotalTime"].ToString()));
     }
     if ((ds.Tables[0].Rows[0]["TotalComment"] != null) && (ds.Tables[0].Rows[0]["TotalComment"].ToString() != ""))
     {
         video.TotalComment = int.Parse(ds.Tables[0].Rows[0]["TotalComment"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["TotalFav"] != null) && (ds.Tables[0].Rows[0]["TotalFav"].ToString() != ""))
     {
         video.TotalFav = int.Parse(ds.Tables[0].Rows[0]["TotalFav"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["TotalUp"] != null) && (ds.Tables[0].Rows[0]["TotalUp"].ToString() != ""))
     {
         video.TotalUp = int.Parse(ds.Tables[0].Rows[0]["TotalUp"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["Reference"] != null) && (ds.Tables[0].Rows[0]["Reference"].ToString() != ""))
     {
         video.Reference = int.Parse(ds.Tables[0].Rows[0]["Reference"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["Tags"] != null) && (ds.Tables[0].Rows[0]["Tags"].ToString() != ""))
     {
         video.Tags = ds.Tables[0].Rows[0]["Tags"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["VideoUrl"] != null) && (ds.Tables[0].Rows[0]["VideoUrl"].ToString() != ""))
     {
         video.VideoUrl = ds.Tables[0].Rows[0]["VideoUrl"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["UrlType"] != null) && (ds.Tables[0].Rows[0]["UrlType"].ToString() != ""))
     {
         video.UrlType = int.Parse(ds.Tables[0].Rows[0]["UrlType"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["VideoFormat"] != null) && (ds.Tables[0].Rows[0]["VideoFormat"].ToString() != ""))
     {
         video.VideoFormat = ds.Tables[0].Rows[0]["VideoFormat"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["Domain"] != null) && (ds.Tables[0].Rows[0]["Domain"].ToString() != ""))
     {
         video.Domain = ds.Tables[0].Rows[0]["Domain"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["Grade"] != null) && (ds.Tables[0].Rows[0]["Grade"].ToString() != ""))
     {
         video.Grade = int.Parse(ds.Tables[0].Rows[0]["Grade"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["Attachment"] != null) && (ds.Tables[0].Rows[0]["Attachment"].ToString() != ""))
     {
         video.Attachment = ds.Tables[0].Rows[0]["Attachment"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["Privacy"] != null) && (ds.Tables[0].Rows[0]["Privacy"].ToString() != ""))
     {
         video.Privacy = int.Parse(ds.Tables[0].Rows[0]["Privacy"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["State"] != null) && (ds.Tables[0].Rows[0]["State"].ToString() != ""))
     {
         video.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["Remark"] != null) && (ds.Tables[0].Rows[0]["Remark"].ToString() != ""))
     {
         video.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["PvCount"] != null) && (ds.Tables[0].Rows[0]["PvCount"].ToString() != ""))
     {
         video.PvCount = int.Parse(ds.Tables[0].Rows[0]["PvCount"].ToString());
     }
     return video;
 }
コード例 #2
0
ファイル: Add.cs プロジェクト: huaminglee/myyyyshop
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string str13;
     this.btnCancle.Enabled = false;
     this.btnSave.Enabled = false;
     int userID = base.CurrentUser.UserID;
     DateTime now = DateTime.Now;
     string str = this.txtTitle.Text.Trim();
     string text = this.txtDescription.Text;
     string selectedValue = this.radlPrivacy.SelectedValue;
     string inputData = this.txtSequence.Text;
     string path = this.hfLocalVideo.Value;
     string url = this.txtOnlineVideo.Text;
     int type = this.GetType(url);
     if (!this.radOnlineVideo.Checked && !this.radLocalVideo.Checked)
     {
         MessageBox.ShowFailTip(this, CMSVideo.TooltipSwitchType);
         return;
     }
     if (str.Length == 0)
     {
         MessageBox.ShowFailTip(this, CMSVideo.ErrorTitleNull);
         return;
     }
     if (this.radLocalVideo.Checked && (path.Length == 0))
     {
         MessageBox.ShowFailTip(this, CMSVideo.ErrorNoVideo);
         return;
     }
     if (this.radOnlineVideo.Checked && (!this.IsUrl(url) || (type == 0)))
     {
         return;
     }
     if ((inputData.Length > 0) && !PageValidate.IsNumber(inputData))
     {
         MessageBox.ShowFailTip(this, CMSVideo.ErrorOrderFormat);
         return;
     }
     if (!PageValidate.IsNumber(selectedValue))
     {
         MessageBox.ShowFailTip(this, CMSVideo.ErrorPrivacyFormed);
         return;
     }
     string newValue = string.Format("/Upload/CMS/Videos/{0}/", DateTime.Now.ToString("yyyyMMdd"));
     string oldValue = string.Format("/Upload/Temp/{0}/", DateTime.Now.ToString("yyyyMMdd"));
     Maticsoft.Model.CMS.Video model = new Maticsoft.Model.CMS.Video {
         Title = str,
         Description = text,
         AlbumID = new int?(Globals.SafeInt(this.dropAlbumID.SelectedValue, 0)),
         CreatedUserID = userID,
         CreatedDate = now,
         LastUpdateUserID = new int?(userID),
         LastUpdateDate = new DateTime?(now),
         Sequence = Globals.SafeInt(inputData, 1),
         VideoClassID = new int?(Globals.SafeInt(this.radlVideoClassID.SelectedValue, 0)),
         IsRecomend = false,
         TotalTime = null,
         TotalComment = 0,
         TotalFav = 0,
         TotalUp = 0,
         Reference = 0,
         Tags = this.txtTags.Text
     };
     string address = "";
     if (this.radLocalVideo.Checked)
     {
         model.UrlType = 0;
         model.VideoUrl = path.Replace(oldValue, newValue);
         model.VideoFormat = Path.GetExtension(path);
         string str10 = path + ".jpg";
         if (System.IO.File.Exists(HttpContext.Current.Server.MapPath(str10)))
         {
             address = HttpContext.Current.Server.MapPath(str10);
             model.ImageUrl = str10.Replace(oldValue, newValue);
         }
         if (System.IO.File.Exists(HttpContext.Current.Server.MapPath(path)))
         {
             model.TotalTime = new int?(this.GetVideoTotalTime(HttpContext.Current.Server.MapPath(Maticsoft.Components.MvcApplication.UploadFolder + path)));
         }
     }
     if (this.radOnlineVideo.Checked)
     {
         string domain = "";
         string subDomain = "";
         UrlOper.GetDomain(url, out domain, out subDomain);
         if (!string.IsNullOrWhiteSpace(domain))
         {
             model.Domain = domain;
         }
         switch (type)
         {
             case 1:
             {
                 YouKuInfo youKuInfo = VideoHelper.GetYouKuInfo(url);
                 if (youKuInfo != null)
                 {
                     model.VideoUrl = url;
                     address = youKuInfo.Logo;
                     if (!string.IsNullOrWhiteSpace(model.Title) && string.IsNullOrWhiteSpace(youKuInfo.Title))
                     {
                         model.Title = youKuInfo.Title;
                     }
                     model.UrlType = 1;
                 }
                 break;
             }
             case 2:
             {
                 Ku6Info info2 = VideoHelper.GetKu6Info(url);
                 if (info2 != null)
                 {
                     model.VideoUrl = url;
                     address = info2.coverurl;
                     if (string.IsNullOrWhiteSpace(model.Title) && !string.IsNullOrWhiteSpace(info2.title))
                     {
                         model.Title = info2.title;
                     }
                     model.UrlType = 1;
                 }
                 goto Label_03FA;
             }
         }
     }
 Label_03FA:
     str13 = "";
     string thumbImage = "";
     string normalImage = "";
     this.Thumbnail(model.UrlType, address, true, true, out str13, out thumbImage, out normalImage);
     if (((model.UrlType == 1) && !string.IsNullOrWhiteSpace(str13)) && System.IO.File.Exists(HttpContext.Current.Server.MapPath(Maticsoft.Components.MvcApplication.UploadFolder + str13)))
     {
         model.ImageUrl = str13;
     }
     if (!string.IsNullOrWhiteSpace(thumbImage) && System.IO.File.Exists(HttpContext.Current.Server.MapPath(Maticsoft.Components.MvcApplication.UploadFolder + thumbImage)))
     {
         model.ThumbImageUrl = thumbImage;
     }
     if (!string.IsNullOrWhiteSpace(normalImage) && System.IO.File.Exists(HttpContext.Current.Server.MapPath(Maticsoft.Components.MvcApplication.UploadFolder + normalImage)))
     {
         model.NormalImageUrl = normalImage;
     }
     model.Grade = 0;
     model.Attachment = null;
     model.IsRecomend = this.chkIsRecomend.Checked;
     model.Privacy = Globals.SafeInt(selectedValue, 0);
     model.State = 5;
     model.Remark = "";
     model.PvCount = 0;
     if (this.bll.Add(model) > 0)
     {
         if (this.chkAddContinue.Checked)
         {
             this.radLocalVideo.Checked = false;
             this.radOnlineVideo.Checked = false;
             this.txtTitle.Text = "";
             this.txtTags.Text = "";
             this.radlPrivacy.SelectedValue = "0";
             this.LoadVideoAlbumData();
             this.LoadVideoClassData();
             MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK);
         }
         else
         {
             MessageBox.ShowLoadingTip(this, "新增成功,正在跳转...", "list.aspx");
         }
     }
     else
     {
         MessageBox.ShowFailTip(this, Site.TooltipSaveError);
         this.btnSave.Enabled = true;
         this.btnCancle.Enabled = true;
     }
 }
コード例 #3
0
ファイル: Video.cs プロジェクト: huaminglee/myyyyshop
 public List<Maticsoft.Model.CMS.Video> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.CMS.Video> list = new List<Maticsoft.Model.CMS.Video>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.CMS.Video item = new Maticsoft.Model.CMS.Video();
             if ((dt.Rows[i]["VideoID"] != null) && (dt.Rows[i]["VideoID"].ToString() != ""))
             {
                 item.VideoID = int.Parse(dt.Rows[i]["VideoID"].ToString());
             }
             if ((dt.Rows[i]["Title"] != null) && (dt.Rows[i]["Title"].ToString() != ""))
             {
                 item.Title = dt.Rows[i]["Title"].ToString();
             }
             if ((dt.Rows[i]["Description"] != null) && (dt.Rows[i]["Description"].ToString() != ""))
             {
                 item.Description = dt.Rows[i]["Description"].ToString();
             }
             if ((dt.Rows[i]["AlbumID"] != null) && (dt.Rows[i]["AlbumID"].ToString() != ""))
             {
                 item.AlbumID = new int?(int.Parse(dt.Rows[i]["AlbumID"].ToString()));
             }
             if ((dt.Rows[i]["CreatedUserID"] != null) && (dt.Rows[i]["CreatedUserID"].ToString() != ""))
             {
                 item.CreatedUserID = int.Parse(dt.Rows[i]["CreatedUserID"].ToString());
             }
             if ((dt.Rows[i]["CreatedDate"] != null) && (dt.Rows[i]["CreatedDate"].ToString() != ""))
             {
                 item.CreatedDate = DateTime.Parse(dt.Rows[i]["CreatedDate"].ToString());
             }
             if ((dt.Rows[i]["LastUpdateUserID"] != null) && (dt.Rows[i]["LastUpdateUserID"].ToString() != ""))
             {
                 item.LastUpdateUserID = new int?(int.Parse(dt.Rows[i]["LastUpdateUserID"].ToString()));
             }
             if ((dt.Rows[i]["LastUpdateDate"] != null) && (dt.Rows[i]["LastUpdateDate"].ToString() != ""))
             {
                 item.LastUpdateDate = new DateTime?(DateTime.Parse(dt.Rows[i]["LastUpdateDate"].ToString()));
             }
             if ((dt.Rows[i]["Sequence"] != null) && (dt.Rows[i]["Sequence"].ToString() != ""))
             {
                 item.Sequence = int.Parse(dt.Rows[i]["Sequence"].ToString());
             }
             if ((dt.Rows[i]["VideoClassID"] != null) && (dt.Rows[i]["VideoClassID"].ToString() != ""))
             {
                 item.VideoClassID = new int?(int.Parse(dt.Rows[i]["VideoClassID"].ToString()));
             }
             if ((dt.Rows[i]["IsRecomend"] != null) && (dt.Rows[i]["IsRecomend"].ToString() != ""))
             {
                 if ((dt.Rows[i]["IsRecomend"].ToString() == "1") || (dt.Rows[i]["IsRecomend"].ToString().ToLower() == "true"))
                 {
                     item.IsRecomend = true;
                 }
                 else
                 {
                     item.IsRecomend = false;
                 }
             }
             if ((dt.Rows[i]["ImageUrl"] != null) && (dt.Rows[i]["ImageUrl"].ToString() != ""))
             {
                 item.ImageUrl = dt.Rows[i]["ImageUrl"].ToString();
             }
             if ((dt.Rows[i]["ThumbImageUrl"] != null) && (dt.Rows[i]["ThumbImageUrl"].ToString() != ""))
             {
                 item.ThumbImageUrl = dt.Rows[i]["ThumbImageUrl"].ToString();
             }
             if ((dt.Rows[i]["NormalImageUrl"] != null) && (dt.Rows[i]["NormalImageUrl"].ToString() != ""))
             {
                 item.NormalImageUrl = dt.Rows[i]["NormalImageUrl"].ToString();
             }
             if ((dt.Rows[i]["TotalTime"] != null) && (dt.Rows[i]["TotalTime"].ToString() != ""))
             {
                 item.TotalTime = new int?(int.Parse(dt.Rows[i]["TotalTime"].ToString()));
             }
             if ((dt.Rows[i]["TotalComment"] != null) && (dt.Rows[i]["TotalComment"].ToString() != ""))
             {
                 item.TotalComment = int.Parse(dt.Rows[i]["TotalComment"].ToString());
             }
             if ((dt.Rows[i]["TotalFav"] != null) && (dt.Rows[i]["TotalFav"].ToString() != ""))
             {
                 item.TotalFav = int.Parse(dt.Rows[i]["TotalFav"].ToString());
             }
             if ((dt.Rows[i]["TotalUp"] != null) && (dt.Rows[i]["TotalUp"].ToString() != ""))
             {
                 item.TotalUp = int.Parse(dt.Rows[i]["TotalUp"].ToString());
             }
             if ((dt.Rows[i]["Reference"] != null) && (dt.Rows[i]["Reference"].ToString() != ""))
             {
                 item.Reference = int.Parse(dt.Rows[i]["Reference"].ToString());
             }
             if ((dt.Rows[i]["Tags"] != null) && (dt.Rows[i]["Tags"].ToString() != ""))
             {
                 item.Tags = dt.Rows[i]["Tags"].ToString();
             }
             if ((dt.Rows[i]["VideoUrl"] != null) && (dt.Rows[i]["VideoUrl"].ToString() != ""))
             {
                 item.VideoUrl = dt.Rows[i]["VideoUrl"].ToString();
             }
             if ((dt.Rows[i]["UrlType"] != null) && (dt.Rows[i]["UrlType"].ToString() != ""))
             {
                 item.UrlType = int.Parse(dt.Rows[i]["UrlType"].ToString());
             }
             if ((dt.Rows[i]["VideoFormat"] != null) && (dt.Rows[i]["VideoFormat"].ToString() != ""))
             {
                 item.VideoFormat = dt.Rows[i]["VideoFormat"].ToString();
             }
             if ((dt.Rows[i]["Domain"] != null) && (dt.Rows[i]["Domain"].ToString() != ""))
             {
                 item.Domain = dt.Rows[i]["Domain"].ToString();
             }
             if ((dt.Rows[i]["Grade"] != null) && (dt.Rows[i]["Grade"].ToString() != ""))
             {
                 item.Grade = int.Parse(dt.Rows[i]["Grade"].ToString());
             }
             if ((dt.Rows[i]["Attachment"] != null) && (dt.Rows[i]["Attachment"].ToString() != ""))
             {
                 item.Attachment = dt.Rows[i]["Attachment"].ToString();
             }
             if ((dt.Rows[i]["Privacy"] != null) && (dt.Rows[i]["Privacy"].ToString() != ""))
             {
                 item.Privacy = int.Parse(dt.Rows[i]["Privacy"].ToString());
             }
             if ((dt.Rows[i]["State"] != null) && (dt.Rows[i]["State"].ToString() != ""))
             {
                 item.State = int.Parse(dt.Rows[i]["State"].ToString());
             }
             if ((dt.Rows[i]["Remark"] != null) && (dt.Rows[i]["Remark"].ToString() != ""))
             {
                 item.Remark = dt.Rows[i]["Remark"].ToString();
             }
             if ((dt.Rows[i]["PvCount"] != null) && (dt.Rows[i]["PvCount"].ToString() != ""))
             {
                 item.PvCount = int.Parse(dt.Rows[i]["PvCount"].ToString());
             }
             list.Add(item);
         }
     }
     return list;
 }