/// <summary> /// 存储/更新实体对象是否成功 /// </summary> public bool StoredSuccess(object Instance) { PageTemplet pageTpt = Instance as PageTemplet; if (pageTpt == null) { return(false); } string strOp = (pageTpt.TempletID == 0) ? "I" : "U@[TempletID=" + pageTpt.TempletID.ToString() + "]"; string sql = OleDbHelper.BuildSqlIU(OleDbHelper.DbDialect.MsAccess, "Tbl_Templets", strOp, new string[] { "TempletName", "SiteBaseDir", "FileSaveUrl", "Content", "TimeFlag", "MixedSyntax", "Category" }, new object[] { OleDbHelper.EscapeSQL(pageTpt.TempletName), OleDbHelper.EscapeSQL(pageTpt.SiteBaseDir), OleDbHelper.EscapeSQL(pageTpt.FileSaveUrl), pageTpt.TempletRawContent, "N'Now()", Util.IsMatch(TagBase.TagDefinitionPattern, pageTpt.TempletRawContent), pageTpt.TptCategory.GetHashCode() }); strOp = FanmaquerOleDbModule.GetOleDbInstance(FanmaquarConfig.ConnectionKey).ExecuteNonQuery(sql).ToString(); return(strOp != "0"); }
/// <summary> /// 存储/更新实体对象是否成功 /// </summary> public bool StoredSuccess(object Instance) { AccessWebNews aWebNews = Instance as AccessWebNews; if (aWebNews == null) { return(false); } string strOp = (aWebNews.NewsID == 0) ? "I" : "U@[NewsID=" + aWebNews.NewsID.ToString() + "]"; string sql = OleDbHelper.BuildSqlIU(OleDbHelper.DbDialect.MsAccess, "Tbl_Articles", strOp, new string[] { "TypeID", "VirtualPath", "Sort", "IsPrimary", "Title", "Author", "InnerUserName", "Summary", "Content", "Pubed", "PublishDate", "Hits" }, new object[] { aWebNews.Channel.ChannelID, OleDbHelper.EscapeSQL(aWebNews.VirtualPath), aWebNews.Sort, aWebNews.IsPrimary, OleDbHelper.EscapeSQL(aWebNews.Title), OleDbHelper.EscapeSQL(aWebNews.Author), OleDbHelper.EscapeSQL(aWebNews.InnerUserName), OleDbHelper.EscapeSQL(aWebNews.Summary), OleDbHelper.EscapeSQL(aWebNews.Content), aWebNews.IsPubed, "N'Now()", aWebNews.Hits }); strOp = FanmaquerOleDbModule.GetOleDbInstance(FanmaquarConfig.ConnectionKey).ExecuteNonQuery(sql).ToString(); return(strOp != "0"); }
/// <summary> /// 存储/更新实体对象是否成功 /// </summary> public bool StoredSuccess(object Instance) { AccessWebChannel aWebChannel = Instance as AccessWebChannel; if (aWebChannel == null) { return(false); } string strOp = (aWebChannel.ChannelID == 0) ? "I" : "U@[TypeID=" + aWebChannel.ChannelID.ToString() + "]"; string sql = OleDbHelper.BuildSqlIU(OleDbHelper.DbDialect.MsAccess, "Tbl_Type", strOp, new string[] { "TypeName", "ParentTypeID", "Sort", "GroupID", "StaticFileDir", "ArchiveDays", "DisplayByPath", "OuterLinkUrl", "GenTempletRule" }, new object[] { OleDbHelper.EscapeSQL(aWebChannel.ChannelName), aWebChannel.ParentChannel.ChannelID, aWebChannel.Sort, Convert.ToInt32(aWebChannel.GetDefinition("GroupID")), OleDbHelper.EscapeSQL((aWebChannel.StaticFileGenDir + "/").Replace("//", "/")), aWebChannel.ArchiveDays, aWebChannel.IsOuterLink, OleDbHelper.EscapeSQL(aWebChannel.OuterLinkUrl), OleDbHelper.EscapeSQL(aWebChannel.GetTempletConfigStoreText(65535)) }); strOp = FanmaquerOleDbModule.GetOleDbInstance(FanmaquarConfig.ConnectionKey).ExecuteNonQuery(sql).ToString(); return(strOp != "0"); }
/// <summary> /// 登录控制 /// </summary> public static string TryLogin(string username, string password, string verifyCode, string domain) { if (verifyCode != GetVeifyCode()) { return("验证码不正确"); } OleDbHelper hp = FanmaquerOleDbModule.GetOleDbInstance(FanmaquarConfig.ConnectionKey); string sql = "select top 1 UserName,IsManager,LoginTimes,LastLogon,LastLoginIP from Tbl_Users where Disabled=false and UserName='******' and Pwd='" + Util.Md5(password) + "'"; //Util.Debug(sql); DataRow mRow = hp.GetDataRow(sql); if (mRow == null) { return("登录名或密码不正确,或者该帐号被系统禁止登录。"); } else { sql = string.Format("update Tbl_Users set LoginTimes=LoginTimes+1,LastLogon=Now(),LastLoginIP='{1}' where Username='******'", OleDbHelper.EscapeSQL(username), Util.GetIP()); hp.ExecuteNonQuery(sql); LoginUserData uDat = new LoginUserData { UserName = username, IsLogon = true, IsManager = Convert.ToBoolean(mRow["IsManager"]) }; FormsAuthenticationTicket tkt = new FormsAuthenticationTicket(1, username, DateTime.Now, DateTime.Now.AddDays(1.00), false, ToJSON(uDat)); HttpCookie mCookie = new HttpCookie(FormsAuthentication.FormsCookieName); mCookie.Value = FormsAuthentication.Encrypt(tkt); mCookie.Expires = System.DateTime.Now.AddDays(1.00); if (domain != null) { mCookie.Domain = domain; } HttpContext.Current.Response.Cookies.Add(mCookie); return("0"); } }
/// <summary> /// 设置相关属性 /// </summary> /// <param name="syntaxTag">标签定义语法</param> public void LoadFromStorag(string syntaxTag) { //OleDbHelper.AppendToFile("~/debug.log", "Load ..." + syntaxTag + Environment.NewLine + Environment.NewLine); string sql = string.Format("select top 1 * from Tbl_HtmlBlock where SyntaxTag='{0}'", OleDbHelper.EscapeSQL(syntaxTag)); DataRow dRow = tagStoreHelper.GetDataRow(sql); if (dRow != null) { this.IsExist = true; this.IDentity = dRow["BlockID"].ToString(); this.Topic = dRow["Topic"].ToString(); this.SiteBaseDir = dRow["SiteBaseDir"].ToString(); this.IsSysBuild = Convert.ToBoolean(dRow["IsSysBuild"]); this.HtmlContainer = dRow["HtmlContainer"].ToString(); this.Width = Convert.ToInt32(dRow["Width"]); this.Height = Convert.ToInt32(dRow["Height"]); this.Property = dRow["Property"].ToString(); this.PublishDate = Convert.ToDateTime(dRow["PublishDate"]); this.ResDependency = dRow["ResDependency"].ToString().Split('\n', ','); this.Content = dRow["Content"].ToString(); } }