Пример #1
0
        public ActionResult SetSocialSetting(string SiteID, string Column, bool IsChecked)
        {
            SocialSettingModels socialSettingModel = SocialSettingDAO.GetItem(long.Parse(SiteID));

            if (socialSettingModel == null)
            {
                socialSettingModel                     = new SocialSettingModels();
                socialSettingModel.SiteID              = WorkLib.GetItem.NewSN();
                socialSettingModel.SiteID              = long.Parse(SiteID);
                socialSettingModel.IsOpen              = true;
                socialSettingModel.SocialDefaultImage  = "";
                socialSettingModel.IsEDMOpenChannel    = false;
                socialSettingModel.IsHeaderOpenChannel = false;
                socialSettingModel.IsFooterOpenChannel = false;
                socialSettingModel.Creator             = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                socialSettingModel.CreateTime          = DateTime.Now;
                socialSettingModel.Modifier            = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                socialSettingModel.ModifyTime          = DateTime.Now;
                WorkV3.Areas.Backend.Models.DataAccess.SocialSettingDAO.SetItem(socialSettingModel);
            }
            if (Column == "IsOpen")
            {
                socialSettingModel.IsOpen = IsChecked;
            }
            if (Column == "IsHeaderOpenChannel")
            {
                socialSettingModel.IsHeaderOpenChannel = IsChecked;
            }
            if (Column == "IsFooterOpenChannel")
            {
                socialSettingModel.IsFooterOpenChannel = IsChecked;
            }
            if (Column == "IsEDMOpenChannel")
            {
                socialSettingModel.IsEDMOpenChannel = IsChecked;
            }
            bool Result = SocialSettingDAO.SetItem(socialSettingModel);

            return(Json(Result ? "success" : "fail"));
        }
Пример #2
0
        public ActionResult SetSocialSettingImage(string SiteID, HttpPostedFileBase postedFile, string FileBase64)
        {
            SocialSettingModels socialSettingModel = SocialSettingDAO.GetItem(long.Parse(SiteID));

            WorkV3.Models.ImageModel imgModel = new ImageModel();
            imgModel.ID = 0;
            // 新上傳的圖片
            string postedFileBase64 = FileBase64;

            if (postedFile == null || postedFile.ContentLength == 0)
            {
                socialSettingModel.SocialDefaultImage = "";
            }
            else
            {
                string saveName = WorkV3.Golbal.UpdFileInfo.SaveFilesBySiteID(postedFile, long.Parse(SiteID), customImageFolder, postedFileBase64);
                imgModel.Img = saveName;
                socialSettingModel.SocialDefaultImage = JsonConvert.SerializeObject(imgModel);
            }
            bool Result = SocialSettingDAO.SetItem(socialSettingModel);

            return(Json(Result ? "success" : "fail"));
        }