public AddEditMainVideoForm(LessonModel lessonModel, MainVideoModel CmainVideoModel)
        {
            InitializeComponent();

            currentLessonModel = lessonModel;
            mainVideoModel     = CmainVideoModel;

            initData();
            initView();
        }
Пример #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            var model = new MainVideoModel();

            model.VideoLink = TextBox_VideoLink.Text;
            model.VideoSub1 = TextBox_VideoSub1.Text;
            model.VideoSub2 = TextBox_VideoSub2.Text;
            model.MainVideoBackground_PicId = Convert.ToInt32(HiddenField_VideoBack.Value);

            Logic.UpdateMainVideo(model);
        }
Пример #3
0
        public MainVideoModel GetMainVideo()
        {
            MainVideoModel model = new MainVideoModel();

            base.Connect();
            ////////MainVideoLink
            DataTable dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoLink'");

            if (dt.Rows.Count != 0)
            {
                model.VideoLink = dt.Rows[0]["ItemValue"].ToString();
            }
            else
            {
                model.VideoLink = "";
            }
            ////////MainVideoSub1
            dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoSub1'");
            if (dt.Rows.Count != 0)
            {
                model.VideoSub1 = dt.Rows[0]["ItemValue"].ToString();
            }
            else
            {
                model.VideoSub1 = "";
            }
            /////////MainVideoSub2
            dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoSub2'");
            if (dt.Rows.Count != 0)
            {
                model.VideoSub2 = dt.Rows[0]["ItemValue"].ToString();
            }
            else
            {
                model.VideoSub2 = "";
            }
            /////////MainVideoBackground
            dt = base.Select("SELECT A.[PicId] , B.[PicAddress] From [tbl_PicUse] AS A INNER JOIN [tbl_PicUploader]AS B ON A.PicId=B.PicId WHERE A.PicUseAs LIKE N'MainVideoBackground'");
            if (dt.Rows.Count != 0)
            {
                model.MainVideoBackground_PicId = Convert.ToInt32(dt.Rows[0]["PicId"]);
                model.MainVideoBackground_Pic   = dt.Rows[0]["PicAddress"].ToString();
            }
            else
            {
                model.MainVideoBackground_PicId = 0;
                model.MainVideoBackground_Pic   = "";
            }
            /////////
            base.DC();

            return(model);
        }
Пример #4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            var model = new MainVideoModel();

            model.VideoLink = TextBox_VideoLink.Text;
            model.VideoSub1 = TextBox_VideoSub1.Text;
            model.VideoSub2 = TextBox_VideoSub2.Text;
            model.MainVideoBackground_PicId = Convert.ToInt32(JsonConvert.DeserializeObject <List <UploaderModel> >(HiddenField_VideoBack.Value)[0].idOfImg);
            model.MainVideoBackground_Pic   = JsonConvert.DeserializeObject <List <UploaderModel> >(HiddenField_VideoBack.Value)[0].imgsrc;
            Logic.UpdateMainVideo(model);
            Response.Redirect("/Admin_MainVideo.aspx");
        }
Пример #5
0
        private void refreshVideoDetail()
        {
            String filePath   = currentLessonModel.videoMainJsonFilePath;
            String jsonString = FileHandle.readJsonFile(filePath);

            currentMainVideoModel = (MainVideoModel)JSONHandle.getObjFromJson <MainVideoModel>(jsonString);
            if (currentMainVideoModel == null)
            {
                currentMainVideoModel = new MainVideoModel();
            }
            else
            {
                mainVideoTItletextBox1.Text = currentMainVideoModel.videoTitle;
                lessonIntroTextBox.Text     = currentMainVideoModel.videoLessonIntro;
                videoDetialLabel.Text       = "第" + (currentLessonModel.orderNum + 1) + "课";
            }


            String zqfilePath   = currentLessonModel.videoZhengJueJsonFilePath;
            String zqjsonString = FileHandle.readJsonFile(zqfilePath);

            List <ItemVideoModel> zqList = (List <ItemVideoModel>)JSONHandle.getObjFromJson <List <ItemVideoModel> >(zqjsonString);

            if (zqList == null)
            {
                return;
            }
            foreach (ItemVideoModel m in zqList)
            {
                zhengQueVideoList.Add(m);
            }

            refreshZhengQueVideoListView();



            String cwfilePath   = currentLessonModel.videoCuoWuJsonFilePath;
            String cwjsonString = FileHandle.readJsonFile(cwfilePath);

            List <ItemVideoModel> cwList = (List <ItemVideoModel>)JSONHandle.getObjFromJson <List <ItemVideoModel> >(cwjsonString);

            if (cwList == null)
            {
                return;
            }
            foreach (ItemVideoModel m in cwList)
            {
                zhengQueVideoList.Add(m);
            }
            refreshCuoWuVideoListView();
        }
Пример #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Logic = new MainVideo_Logic();
     model = Logic.GetMainVideo();
     if (!IsPostBack)
     {
         TextBox_VideoLink.Text      = model.VideoLink;
         TextBox_VideoSub1.Text      = model.VideoSub1;
         TextBox_VideoSub2.Text      = model.VideoSub2;
         HiddenField_VideoBack.Value = JsonConvert.SerializeObject(new List <UploaderModel>()
         {
             new UploaderModel()
             {
                 idOfImg = model.MainVideoBackground_PicId.ToString()
             }
         });
     }
     else
     {
     }
 }
Пример #7
0
        public IndexModel GetData()
        {
            DataTable dt;

            base.Connect();
            ////Sliders
            List <PicModel> Sliders = new List <PicModel>();

            dt = base.Select("SELECT A.[PicId],[PicAddress],[PicThumbnailAddress] FROM [tbl_PicUploader] as A inner join [tbl_PicUse] as B on A.PicId=B.PicId where B.PicUseAs LIKE N'Slider'");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var Slider = new PicModel()
                {
                    PicId        = Convert.ToInt32(dt.Rows[i]["PicId"]),
                    Path         = dt.Rows[i]["PicAddress"].ToString(),
                    ThumpnailPic = dt.Rows[i]["PicThumbnailAddress"].ToString()
                };
                Sliders.Add(Slider);
            }
            ////////Portfolios
            List <PortfolioModel> Portfolios = new List <PortfolioModel>();

            dt = base.Select("SELECT top 4 [P_Id],[Subject],[BackGroundPicId],(SELECT [PicThumbnailAddress] FROM [tbl_PicUploader] where PicId=[BackGroundPicId]) as BackGroundPic,[LogoPicId],(SELECT [PicThumbnailAddress] FROM [tbl_PicUploader] where PicId=[LogoPicId]) as LogoPic ,[Discription],[SEO_KeyWord],[SEO_Discription],[Show_MainPage] FROM [tbl_Portfolio] where [Show_MainPage]=1 AND [Deleted]=0");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var Portfolio = new PortfolioModel()
                {
                    Background_Id   = Convert.ToInt32(dt.Rows[i]["BackGroundPicId"]),
                    Background_Path = dt.Rows[i]["BackGroundPic"].ToString(),
                    Discription     = dt.Rows[i]["Discription"].ToString(),
                    Logo_Path       = dt.Rows[i]["LogoPic"].ToString(),
                    Log_Id          = Convert.ToInt32(dt.Rows[i]["LogoPicId"]),
                    PortfolioId     = Convert.ToInt32(dt.Rows[i]["P_Id"]),
                    SEO_discription = dt.Rows[i]["SEO_Discription"].ToString(),
                    SEO_Keyword     = dt.Rows[i]["SEO_KeyWord"].ToString(),
                    Subject         = dt.Rows[i]["Subject"].ToString(),
                    Show            = Convert.ToInt32(dt.Rows[i]["Show_MainPage"])
                };
                Portfolios.Add(Portfolio);
            }

            ////////Clients
            List <PicModel> Clients = new List <PicModel>();

            dt = base.Select("SELECT top 7 A.[PicId],[PicAddress],[PicThumbnailAddress] FROM [tbl_PicUploader] as A inner join [tbl_PicUse] as B on A.PicId=B.PicId where B.PicUseAs LIKE N'OurClients'");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var C = new PicModel()
                {
                    PicId        = Convert.ToInt32(dt.Rows[i]["PicId"]),
                    Path         = dt.Rows[i]["PicAddress"].ToString(),
                    ThumpnailPic = dt.Rows[i]["PicThumbnailAddress"].ToString()
                };
                Clients.Add(C);
            }

            ////////MainVideo
            MainVideoModel mainVideo = new MainVideoModel();

            ////////MainVideoLink
            dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoLink'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.VideoLink = dt.Rows[0]["ItemValue"].ToString();
            }
            else
            {
                mainVideo.VideoLink = "";
            }
            ////////MainVideoSub1
            dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoSub1'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.VideoSub1 = dt.Rows[0]["ItemValue"].ToString();
            }
            else
            {
                mainVideo.VideoSub1 = "";
            }
            /////////MainVideoSub2
            dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoSub2'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.VideoSub2 = dt.Rows[0]["ItemValue"].ToString();
            }
            else
            {
                mainVideo.VideoSub2 = "";
            }
            /////////MainVideoBackground
            dt = base.Select("SELECT A.[PicId] , B.[PicAddress] From [tbl_PicUse] AS A INNER JOIN [tbl_PicUploader]AS B ON A.PicId=B.PicId WHERE A.PicUseAs LIKE N'MainVideoBackground'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.MainVideoBackground_PicId = Convert.ToInt32(dt.Rows[0]["PicId"]);
                mainVideo.MainVideoBackground_Pic   = dt.Rows[0]["PicAddress"].ToString();
            }
            else
            {
                mainVideo.MainVideoBackground_PicId = 0;
                mainVideo.MainVideoBackground_Pic   = "";
            }
            /////////
            ////////VideoLogo
            dt = base.Select("SELECT A.[PicId],[PicAddress],[PicThumbnailAddress] FROM [tbl_PicUploader] as A inner join [tbl_PicUse] as B on A.PicId=B.PicId where B.PicUseAs LIke N'VideoLogo'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.MainVideoLogo_Pic         = dt.Rows[0]["PicAddress"].ToString();
                mainVideo.MainVideoBackground_PicId = Convert.ToInt32(dt.Rows[0]["PicId"]);
            }
            else
            {
                mainVideo.MainVideoLogo_Pic         = "";
                mainVideo.MainVideoBackground_PicId = 0;
            }

            base.DC();

            var model = new IndexModel()
            {
                mainVideo  = mainVideo,
                Clients    = Clients,
                portfolios = Portfolios,
                Sliders    = Sliders
            };

            return(model);
        }
Пример #8
0
        public string UpdateMainVideo(MainVideoModel model)
        {
            string s = "";
            List <ExcParameters> parss;
            ExcParameters        par;

            base.Connect();

            ////////MainVideoLink
            DataTable dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoLink'");

            parss = new List <ExcParameters>();
            par   = new ExcParameters
            {
                _KEY   = "@ItemKey",
                _VALUE = "MainVideoLink"
            };
            parss.Add(par);
            par = new ExcParameters
            {
                _KEY   = "@ItemValue",
                _VALUE = model.VideoLink
            };
            parss.Add(par);

            if (dt.Rows.Count == 0)
            {
                s += base.Script("INSERT INTO [tbl_SiteProperties]([ItemKey],[ItemValue]) VALUES( @ItemKey , @ItemValue )", parss);
            }
            else
            {
                s += base.Script("UPDATE [tbl_SiteProperties] SET [ItemValue] = @ItemValue WHERE [ItemKey] LIKE @ItemKey", parss);
            }
            ////////MainVideoSub1
            dt  = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoSub1'");
            par = new ExcParameters
            {
                _KEY   = "@ItemKey",
                _VALUE = "MainVideoSub1"
            };
            parss.Add(par);
            par = new ExcParameters
            {
                _KEY   = "@ItemValue",
                _VALUE = model.VideoSub1
            };
            parss.Add(par);
            if (dt.Rows.Count == 0)
            {
                s += base.Script("INSERT INTO [tbl_SiteProperties]([ItemKey],[ItemValue]) VALUES( @ItemKey , @ItemValue )", parss);
            }
            else
            {
                s += base.Script("UPDATE [tbl_SiteProperties] SET [ItemValue] = @ItemValue WHERE [ItemKey] LIKE @ItemKey", parss);
            }
            /////////MainVideoSub2
            dt  = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoSub2'");
            par = new ExcParameters
            {
                _KEY   = "@ItemKey",
                _VALUE = "MainVideoSub2"
            };
            parss.Add(par);
            par = new ExcParameters
            {
                _KEY   = "@ItemValue",
                _VALUE = model.VideoSub2
            };
            parss.Add(par);
            if (dt.Rows.Count == 0)
            {
                s += base.Script("INSERT INTO [tbl_SiteProperties]([ItemKey],[ItemValue]) VALUES( @ItemKey , @ItemValue )", parss);
            }
            else
            {
                s += base.Script("UPDATE [tbl_SiteProperties] SET [ItemValue] = @ItemValue WHERE [ItemKey] LIKE @ItemKey", parss);
            }
            /////////MainVideoBackground
            dt  = base.Select("SELECT A.[PicId] , B.[PicAddress] From [tbl_PicUse] AS A INNER JOIN [tbl_PicUploader]AS B ON A.PicId=B.PicId WHERE A.PicUseAs LIKE N'MainVideoBackground'");
            par = new ExcParameters
            {
                _KEY   = "@UseAs",
                _VALUE = "MainVideoBackground"
            };
            parss.Add(par);
            par = new ExcParameters
            {
                _KEY   = "@PicId",
                _VALUE = model.MainVideoBackground_PicId
            };
            parss.Add(par);
            if (dt.Rows.Count == 0)
            {
                s += base.Script("INSERT INTO [tbl_PicUse]([PicId],[PicUseAs]) VALUES(@PicId ,@UseAs)", parss);
            }
            else
            {
                s += base.Script("UPDATE [tbl_PicUse] SET [PicId] = @PicId WHERE [PicUseAs] = @UseAs ", parss);
            }
            /////////
            base.DC();

            if (s == "1111")
            {
                return("Success");
            }
            else
            {
                return("Fail");
            }
        }