/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SystemInfo.MailSettings model) { StringBuilder strSql = new StringBuilder(); //strSql.Append("DECLARE @Sequence int"); //strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [cms_mailsettings]"); //strSql.Append(" if @Sequence is NULL"); //strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [cms_mailsettings]("); strSql.Append("[SmtpServerIP],[SmtpServerPort],[MailId],[MailPassword]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@smtpserverip,@smtpserverport,@mailid,@mailpassword"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@smtpserverip", SqlDbType.VarChar,50), new SqlParameter("@smtpserverport", SqlDbType.Int,4), new SqlParameter("@mailid", SqlDbType.VarChar,100), new SqlParameter("@mailpassword", SqlDbType.VarChar,50)}; parameters[0].Value = model.SmtpServerIP; parameters[1].Value = model.SmtpServerPort; parameters[2].Value = model.MailId; parameters[3].Value = model.MailPassword; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add or update one record /// </summary> public void AddOrUpdate(Johnny.CMS.OM.SystemInfo.MailSettings model) { if (!dal.IsExist(1)) dal.Add(model); else dal.Update(model); }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SeH.Channel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [seh_channel]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [seh_channel]("); strSql.Append("[ChannelName],[Sequence]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@channelname,@Sequence"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@channelname", SqlDbType.NVarChar,50)}; parameters[0].Value = model.ChannelName; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Creates the GetXxx method to use for the specified column. /// </summary> /// <param name="column">The column to retrieve data for.</param> /// <returns>The name of the method to call on a SqlDataReader for the specified column.</returns> internal static string GetXxxMethod(Johnny.CodeGenerator.Core.ColumnInfo column) { switch (column.DataType.ToLower()) { case "binary": return "GetBytes"; case "bigint": return "GetInt64"; case "bit": return "GetBoolean"; case "char": return "GetString"; case "datetime": return "GetDateTime"; case "decimal": return "GetDecimal"; case "float": return "GetFloat"; case "image": return "GetBytes"; case "int": return "GetInt32"; case "money": return "GetDecimal"; case "nchar": return "GetString"; case "ntext": return "GetString"; case "nvarchar": return "GetString"; case "numeric": return "GetDecimal"; case "real": return "GetDecimal"; case "smalldatetime": return "GetDateTime"; case "smallint": return "GetIn16"; case "smallmoney": return "GetFloat"; case "sql_variant": return "GetBytes"; case "sysname": return "GetString"; case "text": return "GetString"; case "timestamp": return "GetDateTime"; case "tinyint": return "GetByte"; case "varbinary": return "GetBytes"; case "varchar": return "GetString"; case "uniqueidentifier": return "GetGuid"; default: // Unknow data type throw (new Exception("Invalid SQL Server data type specified: " + column.DataType)); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SystemInfo.Navigator model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [cms_navigator]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [cms_navigator]("); strSql.Append("[NavigatorId],[NavigatorName],[Url],[ParentId]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@navigatorid,@navigatorname,@url,@parentid"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@navigatorid", SqlDbType.Int,4), new SqlParameter("@navigatorname", SqlDbType.NVarChar,50), new SqlParameter("@url", SqlDbType.VarChar,200), new SqlParameter("@parentid", SqlDbType.Int,4)}; parameters[-1].Value = model.NavigatorId; parameters[0].Value = model.NavigatorName; parameters[1].Value = model.Url; parameters[2].Value = model.ParentId; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.Access.Role model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [cms_role]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [cms_role]("); strSql.Append("[RoleName],[Description],[Sequence]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@rolename,@description,@Sequence"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@rolename", SqlDbType.NVarChar,50), new SqlParameter("@description", SqlDbType.NVarChar,200)}; parameters[0].Value = model.RoleName; parameters[1].Value = model.Description; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.Access.AdminRole model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [cms_adminrole]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [cms_adminrole]("); strSql.Append("[AdminId],[RoleId],[Sequence]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@adminid,@roleid,@Sequence"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@adminid", SqlDbType.Int,4), new SqlParameter("@roleid", SqlDbType.Int,4)}; parameters[0].Value = model.AdminId; parameters[1].Value = model.RoleId; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SystemInfo.PageBinding model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [cms_pagebinding]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [cms_pagebinding]("); strSql.Append("[Title],[MenuCategoryId],[ListMenuId],[AddMenuId]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@title,@menucategoryid,@listmenuid,@addmenuid"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@title", SqlDbType.NVarChar,50), new SqlParameter("@menucategoryid", SqlDbType.Int,4), new SqlParameter("@listmenuid", SqlDbType.Int,4), new SqlParameter("@addmenuid", SqlDbType.Int,4)}; parameters[0].Value = model.Title; parameters[1].Value = model.MenuCategoryId; parameters[2].Value = model.ListMenuId; parameters[3].Value = model.AddMenuId; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SystemInfo.TopMenu model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [cms_topmenu]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [cms_topmenu]("); strSql.Append("[TopMenuName],[toolTip],[PageLink],[Sequence]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@topmenuname,@toolTip,@pagelink,@Sequence"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@topmenuname", SqlDbType.NVarChar,50), new SqlParameter("@toolTip", SqlDbType.NVarChar,50), new SqlParameter("@pagelink", SqlDbType.VarChar,100)}; parameters[0].Value = model.TopMenuName; parameters[1].Value = model.ToolTip; parameters[2].Value = model.PageLink; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.Access.Administrator model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [cms_administrator]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [cms_administrator]("); strSql.Append("[AdminName],[Password],[FullName],[Gender],[Tel],[Email],[ValidFrom],[ValidTo],[IsActivated],[LoginTimes],[CreatedTime],[CreatedById],[CreatedByName],[UpdatedTime],[UpdatedById],[UpdatedByName],[Sequence]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@adminname,@password,@fullname,@gender,@tel,@email,@validfrom,@validto,@isactivated,@logintimes,@createdtime,@createdbyid,@createdbyname,@updatedtime,@updatedbyid,@updatedbyname,@sequence"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@adminname", SqlDbType.VarChar,50), new SqlParameter("@password", SqlDbType.VarChar,32), new SqlParameter("@fullname", SqlDbType.NVarChar,50), new SqlParameter("@gender", SqlDbType.Bit), new SqlParameter("@tel", SqlDbType.VarChar,50), new SqlParameter("@email", SqlDbType.VarChar,50), new SqlParameter("@validfrom", SqlDbType.DateTime), new SqlParameter("@validto", SqlDbType.DateTime), new SqlParameter("@isactivated", SqlDbType.Bit), new SqlParameter("@logintimes", SqlDbType.Int,4), new SqlParameter("@createdtime", SqlDbType.DateTime), new SqlParameter("@createdbyid", SqlDbType.Int,4), new SqlParameter("@createdbyname", SqlDbType.VarChar,50), new SqlParameter("@updatedtime", SqlDbType.DateTime), new SqlParameter("@updatedbyid", SqlDbType.Int,4), new SqlParameter("@updatedbyname", SqlDbType.VarChar,50)}; parameters[0].Value = model.AdminName; parameters[1].Value = model.Password; parameters[2].Value = model.FullName; parameters[3].Value = model.Gender; parameters[4].Value = model.Tel; parameters[5].Value = model.Email; parameters[6].Value = model.ValidFrom; parameters[7].Value = model.ValidTo; parameters[8].Value = model.IsActivated; parameters[9].Value = model.LoginTimes; parameters[10].Value = model.CreatedTime; parameters[11].Value = model.CreatedById; parameters[12].Value = model.CreatedByName; parameters[13].Value = model.UpdatedTime; parameters[14].Value = model.UpdatedById; parameters[15].Value = model.UpdatedByName; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SystemInfo.WebSettings model) { StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO [cms_websettings]("); strSql.Append("[WebsiteName],[WebsiteTitle],[ShortDescription],[Tel],[Fax],[Email],[WebsiteAddress],[WebsitePath],[FileSize],[LogoPath],[BannerPath],[Copyright],[MetaKeywords],[MetaDescription],[IsClosed],[ClosedInfo],[UserAgreement],[LoginType]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@websitename,@websitetitle,@shortdescription,@tel,@fax,@email,@websiteaddress,@websitepath,@filesize,@logopath,@bannerpath,@copyright,@metakeywords,@metadescription,@isclosed,@closedinfo,@useragreement,@logintype"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@websitename", SqlDbType.NVarChar,40), new SqlParameter("@websitetitle", SqlDbType.NVarChar,100), new SqlParameter("@shortdescription", SqlDbType.VarChar,500), new SqlParameter("@tel", SqlDbType.VarChar,50), new SqlParameter("@fax", SqlDbType.VarChar,50), new SqlParameter("@email", SqlDbType.VarChar,50), new SqlParameter("@websiteaddress", SqlDbType.VarChar,200), new SqlParameter("@websitepath", SqlDbType.VarChar,50), new SqlParameter("@filesize", SqlDbType.Int,4), new SqlParameter("@logopath", SqlDbType.VarChar,100), new SqlParameter("@bannerpath", SqlDbType.VarChar,100), new SqlParameter("@copyright", SqlDbType.NVarChar,500), new SqlParameter("@metakeywords", SqlDbType.NVarChar,100), new SqlParameter("@metadescription", SqlDbType.NVarChar,400), new SqlParameter("@isclosed", SqlDbType.Bit), new SqlParameter("@closedinfo", SqlDbType.NVarChar,1000), new SqlParameter("@useragreement", SqlDbType.Text), new SqlParameter("@logintype", SqlDbType.Int,4)}; parameters[0].Value = model.WebsiteName; parameters[1].Value = model.WebsiteTitle; parameters[2].Value = model.ShortDescription; parameters[3].Value = model.Tel; parameters[4].Value = model.Fax; parameters[5].Value = model.Email; parameters[6].Value = model.WebsiteAddress; parameters[7].Value = model.WebsitePath; parameters[8].Value = model.FileSize; parameters[9].Value = model.LogoPath; parameters[10].Value = model.BannerPath; parameters[11].Value = model.Copyright; parameters[12].Value = model.MetaKeywords; parameters[13].Value = model.MetaDescription; parameters[14].Value = model.IsClosed; parameters[15].Value = model.ClosedInfo; parameters[16].Value = model.UserAgreement; parameters[17].Value = model.LoginType; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SeH.Blog model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [seh_blog]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [seh_blog]("); strSql.Append("[Title],[BlogCategoryId],[Tag],[Content],[Hits],[IsDisplay],[CreatedTime],[CreatedById],[CreatedByName],[UpdatedTime],[UpdatedById],[UpdatedByName],[Sequence]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@title,@blogcategoryid,@tag,@content,@hits,@isdisplay,@createdtime,@createdbyid,@createdbyname,@updatedtime,@updatedbyid,@updatedbyname,@sequence"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@title", SqlDbType.NVarChar,255), new SqlParameter("@blogcategoryid", SqlDbType.Int,4), new SqlParameter("@tag", SqlDbType.VarChar,100), new SqlParameter("@content", SqlDbType.Text), new SqlParameter("@hits", SqlDbType.Int,4), new SqlParameter("@isdisplay", SqlDbType.Bit), new SqlParameter("@createdtime", SqlDbType.DateTime), new SqlParameter("@createdbyid", SqlDbType.Int,4), new SqlParameter("@createdbyname", SqlDbType.VarChar,50), new SqlParameter("@updatedtime", SqlDbType.DateTime), new SqlParameter("@updatedbyid", SqlDbType.Int,4), new SqlParameter("@updatedbyname", SqlDbType.VarChar,50)}; parameters[0].Value = model.Title; parameters[1].Value = model.BlogCategoryId; parameters[2].Value = model.Tag; parameters[3].Value = model.Content; parameters[4].Value = model.Hits; parameters[5].Value = model.IsDisplay; parameters[6].Value = model.CreatedTime; parameters[7].Value = model.CreatedById; parameters[8].Value = model.CreatedByName; parameters[9].Value = model.UpdatedTime; parameters[10].Value = model.UpdatedById; parameters[11].Value = model.UpdatedByName; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SeH.OpenSource model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [seh_OpenSource]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [seh_OpenSource]("); strSql.Append("[OpenSourceName],[ShortDescription],[Description],[URL],[Hits],[IsDisplay],[CreatedTime],[CreatedById],[CreatedByName],[UpdatedTime],[UpdatedById],[UpdatedByName],[Sequence]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@OpenSourcename,@shortdescription,@description,@url,@hits,@isdisplay,@createdtime,@createdbyid,@createdbyname,@updatedtime,@updatedbyid,@updatedbyname,@sequence"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@OpenSourcename", SqlDbType.NVarChar,50), new SqlParameter("@shortdescription", SqlDbType.NVarChar,200), new SqlParameter("@description", SqlDbType.Text), new SqlParameter("@url", SqlDbType.VarChar,200), new SqlParameter("@hits", SqlDbType.Int,4), new SqlParameter("@isdisplay", SqlDbType.Bit), new SqlParameter("@createdtime", SqlDbType.DateTime), new SqlParameter("@createdbyid", SqlDbType.Int,4), new SqlParameter("@createdbyname", SqlDbType.VarChar,50), new SqlParameter("@updatedtime", SqlDbType.DateTime), new SqlParameter("@updatedbyid", SqlDbType.Int,4), new SqlParameter("@updatedbyname", SqlDbType.VarChar,50)}; parameters[0].Value = model.OpenSourceName; parameters[1].Value = model.ShortDescription; parameters[2].Value = model.Description; parameters[3].Value = model.URL; parameters[4].Value = model.Hits; parameters[5].Value = model.IsDisplay; parameters[6].Value = model.CreatedTime; parameters[7].Value = model.CreatedById; parameters[8].Value = model.CreatedByName; parameters[9].Value = model.UpdatedTime; parameters[10].Value = model.UpdatedById; parameters[11].Value = model.UpdatedByName; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
private void accountTree_AccountNodeSelectedEvent(object sender, Johnny.Kaixin.Controls.AccountTree.AccountEventArgs e) { try { //get the top form MainForm mainform = this.TopLevelControl as MainForm; if (mainform != null) mainform.AccountNodeSelected(e.Account); } catch (Exception ex) { Program.ShowMessageBox("FrmAccountManager", ex); } }
private void taskTree_RootNodeSelectedEvent(object sender, Johnny.Kaixin.Controls.TaskTree.RootNodeEventArgs e) { try { //get the top form MainForm mainform = this.TopLevelControl as MainForm; if (mainform != null) mainform.RootNodeSelected(e.Tasks); } catch (Exception ex) { Program.ShowMessageBox("FrmTaskManager", ex); } }
private void AnalyzeNode(SyntaxNodeAnalysisContext context) { var fss = (ForStatementSyntax)context.Node; var sem = context.SemanticModel; if (fss != null && fss.Declaration != null && sem != null) { var variables = fss.Declaration.Variables; if (variables != null) { var symbols = new HashSet <ISymbol>(variables.Select(variable => sem.GetDeclaredSymbol(variable))); var johnny = new Johnny(context, sem, symbols); johnny.Visit(fss.Statement); } } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SystemInfo.BreviarySettings model) { StringBuilder strSql = new StringBuilder(); //strSql.Append("DECLARE @Sequence int"); //strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [cms_breviarysettings]"); //strSql.Append(" if @Sequence is NULL"); //strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [cms_breviarysettings]("); strSql.Append("[Width],[Height],[PlusWatermark],[WatermarkType],[WatermarkImage],[ImageTransparent],[WatermarkText],[TextTransparent],[WatermarkPosition]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@width,@height,@pluswatermark,@watermarktype,@watermarkimage,@imagetransparent,@watermarktext,@texttransparent,@watermarkposition"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@width", SqlDbType.Int,4), new SqlParameter("@height", SqlDbType.Int,4), new SqlParameter("@pluswatermark", SqlDbType.Bit), new SqlParameter("@watermarktype", SqlDbType.Bit), new SqlParameter("@watermarkimage", SqlDbType.VarChar,800), new SqlParameter("@imagetransparent", SqlDbType.Int,4), new SqlParameter("@watermarktext", SqlDbType.NVarChar,50), new SqlParameter("@texttransparent", SqlDbType.Int,4), new SqlParameter("@watermarkposition", SqlDbType.Int,4)}; parameters[0].Value = model.Width; parameters[1].Value = model.Height; parameters[2].Value = model.PlusWatermark; parameters[3].Value = model.WatermarkType; parameters[4].Value = model.WatermarkImage; parameters[5].Value = model.ImageTransparent; parameters[6].Value = model.WatermarkText; parameters[7].Value = model.TextTransparent; parameters[8].Value = model.WatermarkPosition; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.Access.AdminLoginLog model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [cms_adminloginlog]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [cms_adminloginlog]("); strSql.Append("[Name],[Password],[LoginTime],[LogoutTime],[LoginIP],[HosterName],[LoginStatus]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@name,@password,@logintime,@logouttime,@loginip,@hostername,@loginstatus"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@name", SqlDbType.VarChar,50), new SqlParameter("@password", SqlDbType.VarChar,32), new SqlParameter("@logintime", SqlDbType.DateTime), new SqlParameter("@logouttime", SqlDbType.DateTime), new SqlParameter("@loginip", SqlDbType.VarChar,50), new SqlParameter("@hostername", SqlDbType.VarChar,100), new SqlParameter("@loginstatus", SqlDbType.NVarChar,4000)}; parameters[0].Value = model.Name; parameters[1].Value = model.Password; parameters[2].Value = model.LoginTime; parameters[3].Value = model.LogoutTime; parameters[4].Value = model.LoginIP; parameters[5].Value = model.HosterName; parameters[6].Value = model.LoginStatus; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.Access.AdminRole model) { dal.Update(model); }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.Access.AdminRole model) { return dal.Add(model); }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.Access.RolePermission model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE [cms_rolepermission] SET "); strSql.Append("[PermissionId]=@permissionid"); strSql.Append(" WHERE [RoleId]=@roleid "); SqlParameter[] parameters = { new SqlParameter("@roleid", SqlDbType.Int,4), new SqlParameter("@permissionid", SqlDbType.Int,4)}; parameters[0].Value = model.RoleId; parameters[1].Value = model.PermissionId; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.Access.RolePermission model) { StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO [cms_rolepermission]("); strSql.Append("[RoleId],[PermissionId]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@roleid,"); strSql.Append("@permissionid"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@roleid", SqlDbType.Int,4), new SqlParameter("@permissionid", SqlDbType.Int,4)}; parameters[0].Value = model.RoleId; parameters[1].Value = model.PermissionId; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SeH.Channel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE [seh_channel] SET "); strSql.Append("[ChannelName]=@channelname"); strSql.Append(" WHERE [ChannelId]=@channelid "); SqlParameter[] parameters = { new SqlParameter("@channelid", SqlDbType.Int,4), new SqlParameter("@channelname", SqlDbType.NVarChar,50), }; parameters[0].Value = model.ChannelId; parameters[1].Value = model.ChannelName; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SeH.Bulletin model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE [seh_bulletin] SET "); strSql.Append("[Title]=@title,"); strSql.Append("[Content]=@content,"); strSql.Append("[URL]=@url,"); strSql.Append("[Hits]=@hits,"); strSql.Append("[IsDisplay]=@isdisplay,"); //strSql.Append("[CreatedTime]=@createdtime,"); //strSql.Append("[CreatedById]=@createdbyid,"); //strSql.Append("[CreatedByName]=@createdbyname,"); strSql.Append("[UpdatedTime]=@updatedtime,"); strSql.Append("[UpdatedById]=@updatedbyid,"); strSql.Append("[UpdatedByName]=@updatedbyname,"); strSql.Append(" WHERE [BulletinId]=@bulletinid "); SqlParameter[] parameters = { new SqlParameter("@bulletinid", SqlDbType.Int,4), new SqlParameter("@title", SqlDbType.NVarChar,200), new SqlParameter("@content", SqlDbType.Text), new SqlParameter("@url", SqlDbType.VarChar,200), new SqlParameter("@hits", SqlDbType.Int,4), new SqlParameter("@isdisplay", SqlDbType.Bit), //new SqlParameter("@createdtime", SqlDbType.DateTime), //new SqlParameter("@createdbyid", SqlDbType.Int,4), //new SqlParameter("@createdbyname", SqlDbType.VarChar,50), new SqlParameter("@updatedtime", SqlDbType.DateTime), new SqlParameter("@updatedbyid", SqlDbType.Int,4), new SqlParameter("@updatedbyname", SqlDbType.VarChar,50), }; parameters[0].Value = model.BulletinId; parameters[1].Value = model.Title; parameters[2].Value = model.Content; parameters[3].Value = model.URL; parameters[4].Value = model.Hits; parameters[5].Value = model.IsDisplay; //parameters[6].Value = model.CreatedTime; //parameters[7].Value = model.CreatedById; //parameters[8].Value = model.CreatedByName; parameters[6].Value = model.UpdatedTime; parameters[7].Value = model.UpdatedById; parameters[8].Value = model.UpdatedByName; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SystemInfo.MailSettings model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE [cms_mailsettings] SET "); strSql.Append("[SmtpServerIP]=@smtpserverip,"); strSql.Append("[SmtpServerPort]=@smtpserverport,"); strSql.Append("[MailId]=@mailid,"); strSql.Append("[MailPassword]=@mailpassword"); //strSql.Append(" WHERE [Id]=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4), new SqlParameter("@smtpserverip", SqlDbType.VarChar,50), new SqlParameter("@smtpserverport", SqlDbType.Int,4), new SqlParameter("@mailid", SqlDbType.VarChar,100), new SqlParameter("@mailpassword", SqlDbType.VarChar,50)}; parameters[0].Value = model.Id; parameters[1].Value = model.SmtpServerIP; parameters[2].Value = model.SmtpServerPort; parameters[3].Value = model.MailId; parameters[4].Value = model.MailPassword; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.Access.Permission model) { dal.Update(model); }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.Access.Permission model) { return dal.Add(model); }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SystemInfo.Navigator model) { dal.Update(model); }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SystemInfo.Navigator model) { return dal.Add(model); }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SeH.Website model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE [seh_website] SET "); strSql.Append("[WebsiteName]=@websitename,"); strSql.Append("[WebsiteCategoryId]=@websitecategoryid,"); strSql.Append("[Description]=@description,"); strSql.Append("[URL]=@url,"); strSql.Append("[Hits]=@hits,"); strSql.Append("[IsDisplay]=@isdisplay,"); //strSql.Append("[CreatedTime]=@createdtime,"); //strSql.Append("[CreatedById]=@createdbyid,"); //strSql.Append("[CreatedByName]=@createdbyname,"); strSql.Append("[UpdatedTime]=@updatedtime,"); strSql.Append("[UpdatedById]=@updatedbyid,"); strSql.Append("[UpdatedByName]=@updatedbyname,"); strSql.Append(" WHERE [WebsiteId]=@websiteid "); SqlParameter[] parameters = { new SqlParameter("@websiteid", SqlDbType.Int,4), new SqlParameter("@websitename", SqlDbType.NVarChar,50), new SqlParameter("@websitecategoryid", SqlDbType.Int,4), new SqlParameter("@description", SqlDbType.NVarChar,100), new SqlParameter("@url", SqlDbType.VarChar,200), new SqlParameter("@hits", SqlDbType.Int,4), new SqlParameter("@isdisplay", SqlDbType.Bit), //new SqlParameter("@createdtime", SqlDbType.DateTime), //new SqlParameter("@createdbyid", SqlDbType.Int,4), //new SqlParameter("@createdbyname", SqlDbType.VarChar,50), new SqlParameter("@updatedtime", SqlDbType.DateTime), new SqlParameter("@updatedbyid", SqlDbType.Int,4), new SqlParameter("@updatedbyname", SqlDbType.VarChar,50), }; parameters[0].Value = model.WebsiteId; parameters[1].Value = model.WebsiteName; parameters[2].Value = model.WebsiteCategoryId; parameters[3].Value = model.Description; parameters[4].Value = model.URL; parameters[5].Value = model.Hits; parameters[6].Value = model.IsDisplay; //parameters[7].Value = model.CreatedTime; //parameters[8].Value = model.CreatedById; //parameters[9].Value = model.CreatedByName; parameters[7].Value = model.UpdatedTime; parameters[8].Value = model.UpdatedById; parameters[9].Value = model.UpdatedByName; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SeH.Website model) { dal.Update(model); }