Beispiel #1
0
        public static void SetItem(SEOModels item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("SEO");
            tableObj.GetDataFromObject(item);

            string sql   = "Select 1 From SEO Where SourceNo = " + item.SourceNo;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj.Add("Creator", WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id);
                tableObj.Add("CreateTime", DateTime.Now);

                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("SourceNo");
                tableObj.Remove("MenuID");

                tableObj.Add("Modifier", WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id);
                tableObj.Add("ModifyTime", DateTime.Now);

                tableObj.Update(item.SourceNo);
            }
        }
Beispiel #2
0
        public static void SetMemberShipRegManagers(MemberShipRegEmailManagersModels item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("MemberShipRegEmailManagers");
            tableObj.GetDataFromObject(item);
            string sql   = $"Select 1 From MemberShipRegEmailManagers Where SiteID={item.SiteID} AND ManagerID='{item.ManagerID}'";
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                if (string.IsNullOrEmpty(item.ManagerID))
                {
                    tableObj["ManagerID"] = "";
                }
                tableObj["Creator"]    = MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = DateTime.Now;
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("SiteID");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");

                tableObj["Modifier"]   = MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = DateTime.Now;

                tableObj.Update(item.ID);
            }
        }
Beispiel #3
0
        public static void SetItem(ArticlePosterModels item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("ArticlePoster");
            tableObj.GetDataFromObject(item);

            string sql   = "Select 1 From ArticlePoster Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["Creator"]    = MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = DateTime.Now;

                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("MenuID");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");

                tableObj["Modifier"]   = MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = DateTime.Now;

                tableObj.Update(item.ID);
            }
        }
Beispiel #4
0
        public static void SetItem(FieldValue item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("FieldValue");
            tableObj.GetDataFromObject(item);

            string sql   = $"Select 1 From FieldValue Where FormItemID = { item.FormItemID } AND FieldID = { item.FieldID }";
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("FormItemID");
                tableObj.Remove("FieldID");

                SQLData.ParameterCollection paras = new SQLData.ParameterCollection();
                paras.Add("@FormItemID", item.FormItemID);
                paras.Add("@FieldID", item.FieldID);

                tableObj.Update(paras);
            }
        }
        public static void SetItem(AdsStatisticsLabelsModel item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("AdsStatisticsLabels");
            tableObj.GetDataFromObject(item);
            bool   isNew = false;
            string sql   = "Select 1 From AdsStatisticsLabels Where ID = " + item.ID;

            isNew = db.GetFirstValue(sql) == null;
            if (isNew)
            {
                tableObj["Title"]      = item.Title;
                tableObj["LabelDate"]  = item.LabelDate;
                tableObj["LabelColor"] = item.LabelColor;
                tableObj["ShowStatus"] = item.ShowStatus;
                tableObj["Creator"]    = item.Creator;
                tableObj["CreateTime"] = item.CreateTime;
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");
                tableObj["Title"]      = item.Title;
                tableObj["LabelDate"]  = item.LabelDate;
                tableObj["ShowStatus"] = item.ShowStatus;
                tableObj["LabelColor"] = item.LabelColor;
                tableObj["Modifier"]   = item.Modifier;
                tableObj["ModifyTime"] = item.ModifyTime;
                tableObj.Update(item.ID);
            }
        }
Beispiel #6
0
        public static void SetItem(SiteLangMenuModel item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("SiteLangMenu");
            tableObj.GetDataFromObject(item);
            string sql   = "Select 1 From SiteLangMenu Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["Creator"]    = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = DateTime.Now;
                tableObj["Sort"]       = 1;
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("SiteID");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");

                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = DateTime.Now;

                tableObj.Update(item.ID);
            }
        }
        public static bool SetMailTemplateItems(MailTemplateSetModels item)
        {
            SQLData.Database db = new SQLData.Database(WebInfo.Conn);
            item.AttFiles = item.AttFiles == null ? "" : item.AttFiles;
            SQLData.TableObject tableObj = db.GetTableObject("MailTemplateSet");
            tableObj.GetDataFromObject(item);
            DateTime now   = DateTime.Now;
            string   sql   = $"SELECT * FROM MailTemplateSet WHERE  TemplateName='{ item.TemplateName.Replace("'", "")}' ";
            bool     isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["Creator"]    = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = now;
                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = now;
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("TemplateName");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");
                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = now;
                tableObj.Update(item.TemplateName);
            }
            return(true);
        }
Beispiel #8
0
        public static bool SetItem(SocialSettingModels item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("SocialSetting");
            tableObj.GetDataFromObject(item);
            DateTime now = DateTime.Now;
            string   sql = $"SELECT * FROM SocialSetting WHERE  SiteID='{ item.SiteID }' ";

            bool isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["Creator"]    = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = now;
                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = now;
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("SiteID");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");
                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = now;
                tableObj.Update(item.SiteID);
            }
            return(true);
        }
Beispiel #9
0
        public static void SetItem(IntraIPlimitModel item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("IntraIPlimit");
            tableObj.GetDataFromObject(item);
            string sql   = "Select 1 From IntraIPlimit Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["OpenStatus"] = item.OpenStatus == OpenStatus.Open ? 1 : 0;
                tableObj["Creator"]    = MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = DateTime.Now;

                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");

                tableObj["Modifier"]   = MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = DateTime.Now;

                tableObj.Update(item.ID);
            }
        }
Beispiel #10
0
        public static void SetItem(ParagraphModels item)
        {
            item.Title     = item.Title ?? string.Empty;
            item.MatchType = item.MatchType ?? string.Empty;
            item.Contents  = item.Contents ?? string.Empty;

            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("Paragraph");
            tableObj.GetDataFromObject(item);

            string sql   = "Select 1 From Paragraph Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("SourceNo");

                tableObj.Update(item.ID);
            }
        }
Beispiel #11
0
        public static void SetItem(ArticleIntroModels item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("ArticleIntro");

            item.Icon       = item.Icon ?? string.Empty;
            item.RemarkText = item.RemarkText ?? string.Empty;

            tableObj.GetDataFromObject(item);
            string sql   = "Select 1 From ArticleIntro Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                long cardNo = WorkV3.Models.DataAccess.MenusDAO.GetFirstCardNo(item.MenuID, "ArticleIntro") ?? 0;
                tableObj.Add("CardNo", cardNo);

                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("MenuID");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");

                tableObj.Update(item.ID);
            }
        }
Beispiel #12
0
        public static void SetCardInfo(CardsModels card)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("Cards");
            tableObj.GetDataFromObject(card);

            string sql   = $"Select 1 From Cards Where No = { card.No } AND Lang = '{ card.Lang.Replace("'", "''") }' AND Ver = { card.Ver }";
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["Creator"]    = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = DateTime.Now;

                tableObj.Insert();
            }
            else
            {
                string[] removeFields = { "No", "Lang", "Ver", "Creator", "CreateTime" };
                foreach (string field in removeFields)
                {
                    tableObj.Remove(field);
                }

                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = DateTime.Now;

                SQLData.ParameterCollection keys = new SQLData.ParameterCollection();
                keys.Add("@No", card.No);
                keys.Add("@Lang", card.Lang);
                keys.Add("@Ver", card.Ver);

                tableObj.Update(keys);
            }
        }
Beispiel #13
0
        public static void SetItem(ResourceImagesModels item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("ResourceImages");
            tableObj.GetDataFromObject(item);

            string sql   = "Select 1 From ResourceImages Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj.Insert();
            }
            else
            {
                string[] removeFields = { "ID", "SiteID", "SourceNo", "SourceType", "Ver", "AreaID", "Creator", "CreateTime" };
                foreach (string f in removeFields)
                {
                    tableObj.Remove(f);
                }

                SQLData.ParameterCollection keys = new SQLData.ParameterCollection();
                keys.Add("@ID", item.ID);
                keys.Add("@SiteID", item.SiteID);
                keys.Add("@SourceNo", item.SourceNo);
                keys.Add("@SourceType", item.SourceType);
                keys.Add("@Ver", item.Ver);
                keys.Add("@AreaID", item.AreaID);

                tableObj.Update(keys);
            }
        }
Beispiel #14
0
        public static void SetItem(ArticleModels item, int cardStyleID = 1)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("Article");
            tableObj.GetDataFromObject(item);
            string sql   = "Select 1 From Article Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                MenusModels menu   = MenusDAO.GetInfo(item.SiteID, item.MenuID);
                long        cardNo = WorkV3.Golbal.PubFunc.AddPage(item.SiteID, item.MenuID, menu.SN, "Article", "Content", true, item.Title, CardStyleId: cardStyleID);
                tableObj["CardNo"]     = cardNo;
                tableObj["Creator"]    = MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = DateTime.Now;
                tableObj["Sort"]       = 1;

                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("SiteID");
                tableObj.Remove("MenuID");
                tableObj.Remove("CardNo");
                tableObj.Remove("Clicks");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");

                tableObj["Modifier"]   = MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = DateTime.Now;

                tableObj.Update(item.ID);
            }
        }
Beispiel #15
0
        public static bool SetRelationItem(SocialRelationModels item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("SocialRelations");
            tableObj.GetDataFromObject(item);
            DateTime now          = DateTime.Now;
            string   sql          = $"SELECT * FROM SocialRelations WHERE  ID={ item.ID } ";
            string   sql_sort     = $"SELECT Max(Sort)  FROM SocialRelations WHERE  RelationType='{(int)item.RelationType}' AND SiteID={item.SiteID} ";
            bool     isNew        = db.GetFirstValue(sql) == null;
            string   sortIndex    = db.GetFirstValue(sql_sort).ToString();
            int      newSortIndex = 1;

            if (!string.IsNullOrEmpty(sortIndex))
            {
                newSortIndex = int.Parse(sortIndex) + 1;
            }
            if (isNew)
            {
                tableObj["ID"]          = item.ID;
                tableObj["SocialTitle"] = GetSocialTypeTitle(item.SocialType);
                tableObj["Sort"]        = newSortIndex;
                tableObj["LinkTitle"]   = item.LinkTitle == null ? "" : item.LinkTitle;
                tableObj["LinkUrl"]     = item.LinkUrl == null?"":item.LinkUrl;
                tableObj["Creator"]     = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"]  = now;
                tableObj["Modifier"]    = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"]  = now;
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");
                tableObj.Remove("Sort");
                tableObj["SocialTitle"] = item.SocialTitle == null ? "" : item.SocialTitle;
                tableObj["LinkTitle"]   = item.LinkTitle == null ? "" : item.LinkTitle;
                tableObj["LinkUrl"]     = item.LinkUrl == null ? "" : item.LinkUrl;
                tableObj["Modifier"]    = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"]  = now;
                tableObj.Update(item.ID);
            }
            return(true);
        }
Beispiel #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        /// <param name="IsManually">是否手動新增</param>
        public static void SetItem(PointsModel item, bool IsManually = false)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("Points");

            tableObj.GetDataFromObject(item);

            DateTime now   = DateTime.Now;
            string   sql   = "Select 1 From Points Where ID = " + item.ID;
            bool     isNew = db.GetFirstValue(sql) == null;

            tableObj["SiteID"]       = item.SiteID;
            tableObj["MemberShipID"] = item.MemberShipID;
            tableObj["Remark"]       = string.IsNullOrEmpty(item.Remark) ? "" : item.Remark;
            tableObj["Description"]  = string.IsNullOrEmpty(item.Description) ? "" : item.Description;
            tableObj["Point"]        = item.Point;
            tableObj["IsManually"]   = IsManually;
            tableObj["PointType"]    = item.PointType;

            if (isNew)
            {
                if (item.Creator == 0)
                {
                    tableObj["Creator"] = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                }
                tableObj["CreateTime"] = now;

                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("SiteID");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");

                Common.Member curUser = Common.Member.Current;
                tableObj["Modifier"]   = curUser == null ? Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id : curUser.ID;
                tableObj["ModifyTime"] = now;

                tableObj.Update(item.ID);
            }
        }
Beispiel #17
0
        public static void SetItem(MemberShipMailModel item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("MemberShipSendMail");
            tableObj.GetDataFromObject(item);
            string sql   = "Select 1 From MemberShipSendMail Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("SendDate");

                tableObj.Update(item.ID);
            }
        }
Beispiel #18
0
        public static void SetItem(PageCommentsModels item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("PageComments");
            tableObj.GetDataFromObject(item);

            DateTime now   = DateTime.Now;
            string   sql   = "Select 1 From PageComments Where ID = " + item.ID;
            bool     isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["ModifyTime"] = now;
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("PageSN");
                tableObj.Remove("ParentID");
                tableObj.Remove("PostDate");
                tableObj.Remove("ShowStatus");
                tableObj.Remove("MemberShipID");

                Common.Member curUser = Common.Member.Current;
                tableObj["Modifier"] = curUser == null ? Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id : curUser.ID;

                tableObj["ModifyTime"] = now;

                tableObj.Update(item.ID);
            }
        }
Beispiel #19
0
        public static void SetItem(FormModel item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("Form");
            tableObj.GetDataFromObject(item);
            string sql   = "Select 1 From Form Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("SiteID");
                tableObj.Remove("SourceID");
                tableObj.Remove("IsRemove");

                tableObj.Update(item.ID);
            }
        }
Beispiel #20
0
        public static void SetItem(FormItem item, bool hasCreateDate = false)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("FormItem");
            tableObj.GetDataFromObject(item);

            DateTime now = DateTime.Now;

            tableObj.Add("ModifyDate", now);

            string sql = "Select ID, CheckStatus From FormItem Where ID = " + item.ID;

            SQLData.SelectObject selectObj = db.GetSelectObject(sql);
            bool isNew = selectObj.Count == 0;

            if (isNew)
            {
                if (!hasCreateDate)
                {
                    tableObj["CreateDate"] = now;
                }

                if (item.CheckStatus != (byte)FormCheckStatus.待審核)
                {
                    tableObj["CheckDate"] = DateTime.Now;
                }

                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("FormID");
                tableObj.Remove("CreateDate");
                tableObj.Remove("SN");
                tableObj.Remove("IsTemp");
                tableObj.Remove("IsBack");
                tableObj.Remove("CheckDate");
                tableObj.Remove("CheckInDate");

                if (item.CheckStatus != (byte)FormCheckStatus.待審核 && (byte)selectObj["CheckStatus"] != item.CheckStatus)
                {
                    tableObj.Add("CheckDate", DateTime.Now);
                }

                tableObj.Update(item.ID);
            }
        }
Beispiel #21
0
        public static void SetItem(FieldModel item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("Field");
            tableObj.GetDataFromObject(item);
            string sql   = "Select 1 From Field Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                sql            = "Select IsNull(Max(SN), 0) From Field Where ParentID = " + item.ParentID;
                tableObj["SN"] = (int)db.GetFirstValue(sql) + 1;

                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("ParentID");
                tableObj.Remove("SN");

                tableObj.Update(item.ID);
            }
        }
Beispiel #22
0
        public static void UpdatePageInfo(PagesModels page)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("Pages");
            tableObj.GetDataFromObject(page);

            tableObj.Remove("No");

            tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
            tableObj["ModifyTime"] = DateTime.Now;

            SQLData.ParameterCollection keys = new SQLData.ParameterCollection();
            keys.Add("@No", page.No);

            tableObj.Update(keys);
        }
Beispiel #23
0
        public static void SetItem(ResourceVideosModels item)
        {
            item.Spec       = item.Spec ?? string.Empty;
            item.Duration   = item.Duration ?? string.Empty;
            item.Screenshot = item.Screenshot ?? string.Empty;

            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("ResourceVideos");
            tableObj.GetDataFromObject(item);

            string sql   = "Select 1 From ResourceVideos Where ID = " + item.ID;
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["Creator"]    = MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = DateTime.Now;

                tableObj.Insert();
            }
            else
            {
                string[] removeFields = { "ID", "SiteID", "SourceNo", "SourceType", "Ver", "AreaID", "Code", "Creator", "CreateTime" };
                foreach (string f in removeFields)
                {
                    tableObj.Remove(f);
                }

                tableObj["Modifier"]   = MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = DateTime.Now;

                SQLData.ParameterCollection keys = new SQLData.ParameterCollection();
                keys.Add("@ID", item.ID);
                keys.Add("@SiteID", item.SiteID);
                keys.Add("@SourceNo", item.SourceNo);
                keys.Add("@SourceType", item.SourceType);
                keys.Add("@Ver", item.Ver);
                keys.Add("@AreaID", item.AreaID);

                tableObj.Update(keys);
            }
        }
Beispiel #24
0
        public static void SetZoneInfo(ZonesModels zone)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("Zones");
            tableObj.GetDataFromObject(zone);

            string sql   = $"Select 1 From Zones Where No = { zone.No } AND Ver = { zone.Ver } AND SiteID = { zone.SiteID } AND PageNo = { zone.PageNo }";
            bool   isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["Creator"]    = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = DateTime.Now;

                tableObj.Insert();
            }
            else
            {
                string[] removeFields = { "No", "Ver", "SiteID", "PageNo", "Creator", "CreateTime" };
                foreach (string field in removeFields)
                {
                    tableObj.Remove(field);
                }

                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = DateTime.Now;

                SQLData.ParameterCollection keys = new SQLData.ParameterCollection();
                keys.Add("@No", zone.No);
                keys.Add("@Ver", zone.Ver);
                keys.Add("@SiteID", zone.SiteID);
                keys.Add("@PageNo", zone.PageNo);

                tableObj.Update(keys);
            }
        }
Beispiel #25
0
        public static bool SetItem(SiteSeoSettingModels item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("SiteSeoSetting");
            tableObj.GetDataFromObject(item);
            DateTime now = DateTime.Now;
            string   sql = $"SELECT * FROM SiteSeoSetting WHERE  SiteID='{ item.SiteID }' ";

            bool isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["Creator"]    = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = now;
                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = now;
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("SiteID");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");
                if (string.IsNullOrEmpty(item.Title))
                {
                    tableObj["Title"] = "";
                }
                if (string.IsNullOrEmpty(item.Description))
                {
                    tableObj["Description"] = "";
                }
                if (string.IsNullOrEmpty(item.Author))
                {
                    tableObj["Author"] = "";
                }
                if (string.IsNullOrEmpty(item.Copyright))
                {
                    tableObj["Copyright"] = "";
                }
                if (string.IsNullOrEmpty(item.Keywords))
                {
                    tableObj["Keywords"] = "";
                }
                if (string.IsNullOrEmpty(item.GA))
                {
                    tableObj["GA"] = "";
                }
                if (string.IsNullOrEmpty(item.GTM))
                {
                    tableObj["GTM"] = "";
                }
                if (string.IsNullOrEmpty(item.Baidu))
                {
                    tableObj["Baidu"] = "";
                }
                if (string.IsNullOrEmpty(item.Alexa))
                {
                    tableObj["Alexa"] = "";
                }
                if (string.IsNullOrEmpty(item.GoogleSearch))
                {
                    tableObj["GoogleSearch"] = "";
                }
                if (string.IsNullOrEmpty(item.BaiduMA))
                {
                    tableObj["BaiduMA"] = "";
                }
                if (string.IsNullOrEmpty(item.Bing))
                {
                    tableObj["Bing"] = "";
                }
                if (string.IsNullOrEmpty(item.ExtraCode))
                {
                    tableObj["ExtraCode"] = "";
                }

                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = now;
                tableObj.Update(item.SiteID);
            }
            return(true);
        }