Esempio n. 1
0
        public static void Update(GroupData data)
        {
            // Create and execute the command
            GroupData oldData = Load(data.GroupId);
            string    sql     = "Update " + TABLE + " set ";

            if (!oldData.GroupName.Equals(data.GroupName))
            {
                sql = sql + "GroupName=@GroupName,";
            }
            WhereClause w = new WhereClause();

            w.And("GroupId", data.GroupId.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.ORDERDB, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.GroupId.Equals(data.GroupId))
            {
                cmd.Parameters.Add(new SqlParameter("@GroupId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "GroupId", DataRowVersion.Proposed, data.GroupId.DBValue));
            }
            if (!oldData.GroupName.Equals(data.GroupName))
            {
                cmd.Parameters.Add(new SqlParameter("@GroupName", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "GroupName", DataRowVersion.Proposed, data.GroupName.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        public static void Update(KnowledgebasesArticlesCountViewData data)
        {
            // Create and execute the command
            KnowledgebasesArticlesCountViewData oldData = Load();
            string sql = "Update " + TABLE + " set ";

            if (!oldData.KnowledgebasesID.Equals(data.KnowledgebasesID))
            {
                sql = sql + "KnowledgebasesID=@KnowledgebasesID,";
            }
            if (!oldData.Description.Equals(data.Description))
            {
                sql = sql + "Description=@Description,";
            }
            if (!oldData.ArticlesCount.Equals(data.ArticlesCount))
            {
                sql = sql + "ArticlesCount=@ArticlesCount,";
            }
            if (!oldData.OrgGroupsID.Equals(data.OrgGroupsID))
            {
                sql = sql + "OrgGroupsID=@OrgGroupsID,";
            }
            if (!oldData.IsPublic.Equals(data.IsPublic))
            {
                sql = sql + "IsPublic=@IsPublic,";
            }
            WhereClause w = new WhereClause();

            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.KnowledgebasesID.Equals(data.KnowledgebasesID))
            {
                cmd.Parameters.Add(new SqlParameter("@KnowledgebasesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "KnowledgebasesID", DataRowVersion.Proposed, data.KnowledgebasesID.DBValue));
            }
            if (!oldData.Description.Equals(data.Description))
            {
                cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 150, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Proposed, data.Description.DBValue));
            }
            if (!oldData.ArticlesCount.Equals(data.ArticlesCount))
            {
                cmd.Parameters.Add(new SqlParameter("@ArticlesCount", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ArticlesCount", DataRowVersion.Proposed, data.ArticlesCount.DBValue));
            }
            if (!oldData.OrgGroupsID.Equals(data.OrgGroupsID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgGroupsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgGroupsID", DataRowVersion.Proposed, data.OrgGroupsID.DBValue));
            }
            if (!oldData.IsPublic.Equals(data.IsPublic))
            {
                cmd.Parameters.Add(new SqlParameter("@IsPublic", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsPublic", DataRowVersion.Proposed, !data.IsPublic.IsValid ? data.IsPublic.DBValue : data.IsPublic.DBValue.Equals("Y") ? 1 : 0));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        public static void Update(OrgDepartmentsData data)
        {
            // Create and execute the command
            OrgDepartmentsData oldData = Load(data.OrgDepartmentsID);
            string             sql     = "Update " + TABLE + " set ";

            if (!oldData.Description.Equals(data.Description))
            {
                sql = sql + "Description=@Description,";
            }
            if (!oldData.Active.Equals(data.Active))
            {
                sql = sql + "Active=@Active,";
            }
            if (!oldData.OrgDivisionsID.Equals(data.OrgDivisionsID))
            {
                sql = sql + "OrgDivisionsID=@OrgDivisionsID,";
            }
            if (!oldData.GLAccount.Equals(data.GLAccount))
            {
                sql = sql + "GLAccount=@GLAccount,";
            }
            WhereClause w = new WhereClause();

            w.And("OrgDepartmentsID", data.OrgDepartmentsID.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.OrgDepartmentsID.Equals(data.OrgDepartmentsID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgDepartmentsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgDepartmentsID", DataRowVersion.Proposed, data.OrgDepartmentsID.DBValue));
            }
            if (!oldData.Description.Equals(data.Description))
            {
                cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Proposed, data.Description.DBValue));
            }
            if (!oldData.Active.Equals(data.Active))
            {
                cmd.Parameters.Add(new SqlParameter("@Active", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "Active", DataRowVersion.Proposed, !data.Active.IsValid ? data.Active.DBValue : data.Active.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.OrgDivisionsID.Equals(data.OrgDivisionsID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgDivisionsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgDivisionsID", DataRowVersion.Proposed, data.OrgDivisionsID.DBValue));
            }
            if (!oldData.GLAccount.Equals(data.GLAccount))
            {
                cmd.Parameters.Add(new SqlParameter("@GLAccount", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "GLAccount", DataRowVersion.Proposed, data.GLAccount.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        public static void Update(DirectoriesData data)
        {
            // Create and execute the command
            DirectoriesData oldData = Load(data.Id);
            string          sql     = "Update " + TABLE + " set ";

            if (!oldData.Name.Equals(data.Name))
            {
                sql = sql + "Name=@Name,";
            }
            if (!oldData.Path.Equals(data.Path))
            {
                sql = sql + "Path=@Path,";
            }
            if (!oldData.IsPublic.Equals(data.IsPublic))
            {
                sql = sql + "IsPublic=@IsPublic,";
            }
            if (!oldData.OrgGroupID.Equals(data.OrgGroupID))
            {
                sql = sql + "OrgGroupID=@OrgGroupID,";
            }
            WhereClause w = new WhereClause();

            w.And("Id", data.Id.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.Id.Equals(data.Id))
            {
                cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Id", DataRowVersion.Proposed, data.Id.DBValue));
            }
            if (!oldData.Name.Equals(data.Name))
            {
                cmd.Parameters.Add(new SqlParameter("@Name", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Name", DataRowVersion.Proposed, data.Name.DBValue));
            }
            if (!oldData.Path.Equals(data.Path))
            {
                cmd.Parameters.Add(new SqlParameter("@Path", SqlDbType.VarChar, 150, ParameterDirection.Input, false, 0, 0, "Path", DataRowVersion.Proposed, data.Path.DBValue));
            }
            if (!oldData.IsPublic.Equals(data.IsPublic))
            {
                cmd.Parameters.Add(new SqlParameter("@IsPublic", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsPublic", DataRowVersion.Proposed, !data.IsPublic.IsValid ? data.IsPublic.DBValue : data.IsPublic.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.OrgGroupID.Equals(data.OrgGroupID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgGroupID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgGroupID", DataRowVersion.Proposed, data.OrgGroupID.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 5
0
        public static void Update(ControlsGroupsData data)
        {
            // Create and execute the command
            ControlsGroupsData oldData = Load(data.ControlsGroupsID);
            string             sql     = "Update " + TABLE + " set ";

            if (!oldData.ControlsID.Equals(data.ControlsID))
            {
                sql = sql + "ControlsID=@ControlsID,";
            }
            if (!oldData.OrgGroupsID.Equals(data.OrgGroupsID))
            {
                sql = sql + "OrgGroupsID=@OrgGroupsID,";
            }
            if (!oldData.SortOrder.Equals(data.SortOrder))
            {
                sql = sql + "SortOrder=@SortOrder,";
            }
            if (!oldData.DisplayOnHomePage.Equals(data.DisplayOnHomePage))
            {
                sql = sql + "DisplayOnHomePage=@DisplayOnHomePage,";
            }
            WhereClause w = new WhereClause();

            w.And("ControlsGroupsID", data.ControlsGroupsID.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.ControlsGroupsID.Equals(data.ControlsGroupsID))
            {
                cmd.Parameters.Add(new SqlParameter("@ControlsGroupsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ControlsGroupsID", DataRowVersion.Proposed, data.ControlsGroupsID.DBValue));
            }
            if (!oldData.ControlsID.Equals(data.ControlsID))
            {
                cmd.Parameters.Add(new SqlParameter("@ControlsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ControlsID", DataRowVersion.Proposed, data.ControlsID.DBValue));
            }
            if (!oldData.OrgGroupsID.Equals(data.OrgGroupsID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgGroupsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgGroupsID", DataRowVersion.Proposed, data.OrgGroupsID.DBValue));
            }
            if (!oldData.SortOrder.Equals(data.SortOrder))
            {
                cmd.Parameters.Add(new SqlParameter("@SortOrder", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "SortOrder", DataRowVersion.Proposed, data.SortOrder.DBValue));
            }
            if (!oldData.DisplayOnHomePage.Equals(data.DisplayOnHomePage))
            {
                cmd.Parameters.Add(new SqlParameter("@DisplayOnHomePage", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "DisplayOnHomePage", DataRowVersion.Proposed, !data.DisplayOnHomePage.IsValid ? data.DisplayOnHomePage.DBValue : data.DisplayOnHomePage.DBValue.Equals("Y") ? 1 : 0));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 6
0
        public static void Delete()
        {
            // Create and execute the command
            string      sql = "Delete From " + TABLE;
            WhereClause w   = new WhereClause();

            sql += w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            // Execute the query and return the result
            cmd.ExecuteNonQuery();
        }
        public static void Update(SessionInformationData data)
        {
            // Create and execute the command
            SessionInformationData oldData = Load(data.SessionId);
            string sql = "Update " + TABLE + " set ";

            if (!oldData.SessionId.Equals(data.SessionId))
            {
                sql = sql + "SessionId=@SessionId,";
            }
            if (!oldData.DemoId.Equals(data.DemoId))
            {
                sql = sql + "DemoId=@DemoId,";
            }
            if (!oldData.UserId.Equals(data.UserId))
            {
                sql = sql + "UserId=@UserId,";
            }
            if (!oldData.DateCreated.Equals(data.DateCreated))
            {
                sql = sql + "DateCreated=@DateCreated,";
            }
            WhereClause w = new WhereClause();

            w.And("SessionId", data.SessionId.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.ORDERDB, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.SessionId.Equals(data.SessionId))
            {
                cmd.Parameters.Add(new SqlParameter("@SessionId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "SessionId", DataRowVersion.Proposed, data.SessionId.DBValue));
            }
            if (!oldData.DemoId.Equals(data.DemoId))
            {
                cmd.Parameters.Add(new SqlParameter("@DemoId", SqlDbType.Char, 7, ParameterDirection.Input, false, 0, 0, "DemoId", DataRowVersion.Proposed, data.DemoId.DBValue));
            }
            if (!oldData.UserId.Equals(data.UserId))
            {
                cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Char, 15, ParameterDirection.Input, false, 0, 0, "UserId", DataRowVersion.Proposed, data.UserId.DBValue));
            }
            if (!oldData.DateCreated.Equals(data.DateCreated))
            {
                cmd.Parameters.Add(new SqlParameter("@DateCreated", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "DateCreated", DataRowVersion.Proposed, data.DateCreated.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 8
0
        public static void Delete(IdType knowledgebasesSectionsArticlesID)
        {
            // Create and execute the command
            string      sql = "Delete From " + TABLE;
            WhereClause w   = new WhereClause();

            w.And("KnowledgebasesSectionsArticlesID", knowledgebasesSectionsArticlesID.DBValue);
            sql += w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            // Execute the query and return the result
            cmd.ExecuteNonQuery();
        }
Esempio n. 9
0
        public static void Delete(IdType eventId)
        {
            // Create and execute the command
            string      sql = "Delete From " + TABLE;
            WhereClause w   = new WhereClause();

            w.And("Event_Id", eventId.DBValue);
            sql += w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.ORDERDB, sql, CommandType.Text, COMMAND_TIMEOUT);

            // Execute the query and return the result
            cmd.ExecuteNonQuery();
        }
        public static void Update(SeeAlsoKnowledgebasesSectionsArtclesData data)
        {
            // Create and execute the command
            SeeAlsoKnowledgebasesSectionsArtclesData oldData = Load();
            string sql = "Update " + TABLE + " set ";

            if (!oldData.KnowledgebasesSectionsArticlesID.Equals(data.KnowledgebasesSectionsArticlesID))
            {
                sql = sql + "KnowledgebasesSectionsArticlesID=@KnowledgebasesSectionsArticlesID,";
            }
            if (!oldData.Title.Equals(data.Title))
            {
                sql = sql + "Title=@Title,";
            }
            if (!oldData.Id.Equals(data.Id))
            {
                sql = sql + "Id=@Id,";
            }
            if (!oldData.SeeAlsoID.Equals(data.SeeAlsoID))
            {
                sql = sql + "SeeAlsoID=@SeeAlsoID,";
            }
            WhereClause w = new WhereClause();

            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.KnowledgebasesSectionsArticlesID.Equals(data.KnowledgebasesSectionsArticlesID))
            {
                cmd.Parameters.Add(new SqlParameter("@KnowledgebasesSectionsArticlesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "KnowledgebasesSectionsArticlesID", DataRowVersion.Proposed, data.KnowledgebasesSectionsArticlesID.DBValue));
            }
            if (!oldData.Title.Equals(data.Title))
            {
                cmd.Parameters.Add(new SqlParameter("@Title", SqlDbType.VarChar, 250, ParameterDirection.Input, false, 0, 0, "Title", DataRowVersion.Proposed, data.Title.DBValue));
            }
            if (!oldData.Id.Equals(data.Id))
            {
                cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Id", DataRowVersion.Proposed, data.Id.DBValue));
            }
            if (!oldData.SeeAlsoID.Equals(data.SeeAlsoID))
            {
                cmd.Parameters.Add(new SqlParameter("@SeeAlsoID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "SeeAlsoID", DataRowVersion.Proposed, data.SeeAlsoID.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        public static void Update(NewsArticlesLocationsNameData data)
        {
            // Create and execute the command
            NewsArticlesLocationsNameData oldData = Load();
            string sql = "Update " + TABLE + " set ";

            if (!oldData.Description.Equals(data.Description))
            {
                sql = sql + "Description=@Description,";
            }
            if (!oldData.NewsArticlesLocationsID.Equals(data.NewsArticlesLocationsID))
            {
                sql = sql + "NewsArticlesLocationsID=@NewsArticlesLocationsID,";
            }
            if (!oldData.NewsArticlesID.Equals(data.NewsArticlesID))
            {
                sql = sql + "NewsArticlesID=@NewsArticlesID,";
            }
            if (!oldData.OrgLocationsID.Equals(data.OrgLocationsID))
            {
                sql = sql + "OrgLocationsID=@OrgLocationsID,";
            }
            WhereClause w = new WhereClause();

            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.Description.Equals(data.Description))
            {
                cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Proposed, data.Description.DBValue));
            }
            if (!oldData.NewsArticlesLocationsID.Equals(data.NewsArticlesLocationsID))
            {
                cmd.Parameters.Add(new SqlParameter("@NewsArticlesLocationsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "NewsArticlesLocationsID", DataRowVersion.Proposed, data.NewsArticlesLocationsID.DBValue));
            }
            if (!oldData.NewsArticlesID.Equals(data.NewsArticlesID))
            {
                cmd.Parameters.Add(new SqlParameter("@NewsArticlesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "NewsArticlesID", DataRowVersion.Proposed, data.NewsArticlesID.DBValue));
            }
            if (!oldData.OrgLocationsID.Equals(data.OrgLocationsID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgLocationsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgLocationsID", DataRowVersion.Proposed, data.OrgLocationsID.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 12
0
        public static void Update(NewEmployeeRequestData data)
        {
            // Create and execute the command
            NewEmployeeRequestData oldData = Load(data.Id);
            string sql = "Update " + TABLE + " set ";

            if (!oldData.HireDate.Equals(data.HireDate))
            {
                sql = sql + "HireDate=@HireDate,";
            }
            if (!oldData.Text.Equals(data.Text))
            {
                sql = sql + "Text=@Text,";
            }
            if (!oldData.EmployeeID.Equals(data.EmployeeID))
            {
                sql = sql + "EmployeeID=@EmployeeID,";
            }
            WhereClause w = new WhereClause();

            w.And("Id", data.Id.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.Id.Equals(data.Id))
            {
                cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Id", DataRowVersion.Proposed, data.Id.DBValue));
            }
            if (!oldData.HireDate.Equals(data.HireDate))
            {
                cmd.Parameters.Add(new SqlParameter("@HireDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "HireDate", DataRowVersion.Proposed, data.HireDate.DBValue));
            }
            if (!oldData.Text.Equals(data.Text))
            {
                cmd.Parameters.Add(new SqlParameter("@Text", SqlDbType.Text, 0, ParameterDirection.Input, false, 0, 0, "Text", DataRowVersion.Proposed, data.Text.DBValue));
            }
            if (!oldData.EmployeeID.Equals(data.EmployeeID))
            {
                cmd.Parameters.Add(new SqlParameter("@EmployeeID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "EmployeeID", DataRowVersion.Proposed, data.EmployeeID.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 13
0
        public static void Update(UserRoleData data)
        {
            // Create and execute the command
            UserRoleData oldData = Load(data.UserRoleId);
            string       sql     = "Update " + TABLE + " set ";

            if (!oldData.UserId.Equals(data.UserId))
            {
                sql = sql + "UserId=@UserId,";
            }
            if (!oldData.RoleId.Equals(data.RoleId))
            {
                sql = sql + "RoleId=@RoleId,";
            }
            if (!oldData.PermitDeny.Equals(data.PermitDeny))
            {
                sql = sql + "PermitDeny=@PermitDeny,";
            }
            WhereClause w = new WhereClause();

            w.And("UserRoleId", data.UserRoleId.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.ORDERDB, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.UserRoleId.Equals(data.UserRoleId))
            {
                cmd.Parameters.Add(new SqlParameter("@UserRoleId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "UserRoleId", DataRowVersion.Proposed, data.UserRoleId.DBValue));
            }
            if (!oldData.UserId.Equals(data.UserId))
            {
                cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "UserId", DataRowVersion.Proposed, data.UserId.DBValue));
            }
            if (!oldData.RoleId.Equals(data.RoleId))
            {
                cmd.Parameters.Add(new SqlParameter("@RoleId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "RoleId", DataRowVersion.Proposed, data.RoleId.DBValue));
            }
            if (!oldData.PermitDeny.Equals(data.PermitDeny))
            {
                cmd.Parameters.Add(new SqlParameter("@PermitDeny", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "PermitDeny", DataRowVersion.Proposed, data.PermitDeny.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 14
0
        public static void Update(GroupNewsArticlesInfoData data)
        {
            // Create and execute the command
            GroupNewsArticlesInfoData oldData = Load();
            string sql = "Update " + TABLE + " set ";

            if (!oldData.OrgGroupsID.Equals(data.OrgGroupsID))
            {
                sql = sql + "OrgGroupsID=@OrgGroupsID,";
            }
            if (!oldData.ArticleCount.Equals(data.ArticleCount))
            {
                sql = sql + "ArticleCount=@ArticleCount,";
            }
            if (!oldData.LastModified.Equals(data.LastModified))
            {
                sql = sql + "LastModified=@LastModified,";
            }
            WhereClause w = new WhereClause();

            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.OrgGroupsID.Equals(data.OrgGroupsID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgGroupsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgGroupsID", DataRowVersion.Proposed, data.OrgGroupsID.DBValue));
            }
            if (!oldData.ArticleCount.Equals(data.ArticleCount))
            {
                cmd.Parameters.Add(new SqlParameter("@ArticleCount", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ArticleCount", DataRowVersion.Proposed, data.ArticleCount.DBValue));
            }
            if (!oldData.LastModified.Equals(data.LastModified))
            {
                cmd.Parameters.Add(new SqlParameter("@LastModified", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "LastModified", DataRowVersion.Proposed, data.LastModified.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        /// <summary>
        /// Returns a list of objects which match the values for the fields specified.
        /// </summary>
        /// <param name="TournamentId">A field value to be matched.</param>
        /// <param name="Key">A field value to be matched.</param>
        /// <returns>The list of TournamentFeeDAO objects found.</returns>
        public static IList FindByUserIdAndRolePattern(IdType tournamentId, StringType key)
        {
            OrderByClause sort   = new OrderByClause("TournamentId, Key");
            WhereClause   filter = new WhereClause("TournamentId = @TournamentId and Key like @Key");
            String        sql    = "Select * from " + VIEW + filter.FormatSql() + sort.FormatSql();
            SqlCommand    cmd    = GetSqlCommand(CONNECTION_STRING_KEY, sql, CommandType.Text);

            cmd.Parameters.Add(new SqlParameter("@TournamentId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, "TournamentId", DataRowVersion.Proposed, tournamentId.DBValue));
            cmd.Parameters.Add(new SqlParameter("@Key", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Key", DataRowVersion.Proposed, key.DBValue));
            SqlDataReader dataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            IList         list       = new ArrayList();

            while (dataReader.Read())
            {
                list.Add(GetDataObjectFromReader(dataReader));
            }
            dataReader.Close();
            return(list);
        }
Esempio n. 16
0
        public static void Update(GroupKnowledgebasesSubscriptionsData data)
        {
            // Create and execute the command
            GroupKnowledgebasesSubscriptionsData oldData = Load(data.Id);
            string sql = "Update " + TABLE + " set ";

            if (!oldData.OrgGroupID.Equals(data.OrgGroupID))
            {
                sql = sql + "OrgGroupID=@OrgGroupID,";
            }
            if (!oldData.KnowledgebasesID.Equals(data.KnowledgebasesID))
            {
                sql = sql + "KnowledgebasesID=@KnowledgebasesID,";
            }
            WhereClause w = new WhereClause();

            w.And("Id", data.Id.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.Id.Equals(data.Id))
            {
                cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Id", DataRowVersion.Proposed, data.Id.DBValue));
            }
            if (!oldData.OrgGroupID.Equals(data.OrgGroupID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgGroupID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgGroupID", DataRowVersion.Proposed, data.OrgGroupID.DBValue));
            }
            if (!oldData.KnowledgebasesID.Equals(data.KnowledgebasesID))
            {
                cmd.Parameters.Add(new SqlParameter("@KnowledgebasesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "KnowledgebasesID", DataRowVersion.Proposed, data.KnowledgebasesID.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 17
0
        public static void Update(MenuViewData data)
        {
            // Create and execute the command
            MenuViewData oldData = Load();
            string       sql     = "Update " + TABLE + " set ";

            if (!oldData.ParentMenuItemsID.Equals(data.ParentMenuItemsID))
            {
                sql = sql + "ParentMenuItemsID=@ParentMenuItemsID,";
            }
            if (!oldData.Description.Equals(data.Description))
            {
                sql = sql + "Description=@Description,";
            }
            if (!oldData.Url.Equals(data.Url))
            {
                sql = sql + "url=@url,";
            }
            if (!oldData.SortOrder.Equals(data.SortOrder))
            {
                sql = sql + "SortOrder=@SortOrder,";
            }
            if (!oldData.Target.Equals(data.Target))
            {
                sql = sql + "Target=@Target,";
            }
            if (!oldData.DateStart.Equals(data.DateStart))
            {
                sql = sql + "DateStart=@DateStart,";
            }
            if (!oldData.DateEnd.Equals(data.DateEnd))
            {
                sql = sql + "DateEnd=@DateEnd,";
            }
            if (!oldData.NodeImgSrc.Equals(data.NodeImgSrc))
            {
                sql = sql + "NodeImgSrc=@NodeImgSrc,";
            }
            if (!oldData.MenuItemsID.Equals(data.MenuItemsID))
            {
                sql = sql + "MenuItemsID=@MenuItemsID,";
            }
            WhereClause w = new WhereClause();

            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.ParentMenuItemsID.Equals(data.ParentMenuItemsID))
            {
                cmd.Parameters.Add(new SqlParameter("@ParentMenuItemsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ParentMenuItemsID", DataRowVersion.Proposed, data.ParentMenuItemsID.DBValue));
            }
            if (!oldData.Description.Equals(data.Description))
            {
                cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Proposed, data.Description.DBValue));
            }
            if (!oldData.Url.Equals(data.Url))
            {
                cmd.Parameters.Add(new SqlParameter("@url", SqlDbType.VarChar, 300, ParameterDirection.Input, false, 0, 0, "url", DataRowVersion.Proposed, data.Url.DBValue));
            }
            if (!oldData.SortOrder.Equals(data.SortOrder))
            {
                cmd.Parameters.Add(new SqlParameter("@SortOrder", SqlDbType.TinyInt, 0, ParameterDirection.Input, false, 0, 0, "SortOrder", DataRowVersion.Proposed, data.SortOrder.DBValue));
            }
            if (!oldData.Target.Equals(data.Target))
            {
                cmd.Parameters.Add(new SqlParameter("@Target", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "Target", DataRowVersion.Proposed, data.Target.DBValue));
            }
            if (!oldData.DateStart.Equals(data.DateStart))
            {
                cmd.Parameters.Add(new SqlParameter("@DateStart", SqlDbType.SmallDateTime, 0, ParameterDirection.Input, false, 0, 0, "DateStart", DataRowVersion.Proposed, data.DateStart.DBValue));
            }
            if (!oldData.DateEnd.Equals(data.DateEnd))
            {
                cmd.Parameters.Add(new SqlParameter("@DateEnd", SqlDbType.SmallDateTime, 0, ParameterDirection.Input, false, 0, 0, "DateEnd", DataRowVersion.Proposed, data.DateEnd.DBValue));
            }
            if (!oldData.NodeImgSrc.Equals(data.NodeImgSrc))
            {
                cmd.Parameters.Add(new SqlParameter("@NodeImgSrc", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "NodeImgSrc", DataRowVersion.Proposed, data.NodeImgSrc.DBValue));
            }
            if (!oldData.MenuItemsID.Equals(data.MenuItemsID))
            {
                cmd.Parameters.Add(new SqlParameter("@MenuItemsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "MenuItemsID", DataRowVersion.Proposed, data.MenuItemsID.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 18
0
        public static void Update(EmployeeOtherControlsSubscriptionsViewData data)
        {
            // Create and execute the command
            EmployeeOtherControlsSubscriptionsViewData oldData = Load();
            string sql = "Update " + TABLE + " set ";

            if (!oldData.Src.Equals(data.Src))
            {
                sql = sql + "Src=@Src,";
            }
            if (!oldData.Description.Equals(data.Description))
            {
                sql = sql + "Description=@Description,";
            }
            if (!oldData.ClassSrc.Equals(data.ClassSrc))
            {
                sql = sql + "ClassSrc=@ClassSrc,";
            }
            if (!oldData.ClassDescription.Equals(data.ClassDescription))
            {
                sql = sql + "ClassDescription=@ClassDescription,";
            }
            if (!oldData.AllowUnsubscribe.Equals(data.AllowUnsubscribe))
            {
                sql = sql + "AllowUnsubscribe=@AllowUnsubscribe,";
            }
            if (!oldData.SortOrder.Equals(data.SortOrder))
            {
                sql = sql + "SortOrder=@SortOrder,";
            }
            if (!oldData.OrgEmployeesID.Equals(data.OrgEmployeesID))
            {
                sql = sql + "OrgEmployeesID=@OrgEmployeesID,";
            }
            if (!oldData.ControlsID.Equals(data.ControlsID))
            {
                sql = sql + "ControlsID=@ControlsID,";
            }
            if (!oldData.ControlSubscriptionsID.Equals(data.ControlSubscriptionsID))
            {
                sql = sql + "ControlSubscriptionsID=@ControlSubscriptionsID,";
            }
            WhereClause w = new WhereClause();

            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.Src.Equals(data.Src))
            {
                cmd.Parameters.Add(new SqlParameter("@Src", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Src", DataRowVersion.Proposed, data.Src.DBValue));
            }
            if (!oldData.Description.Equals(data.Description))
            {
                cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Proposed, data.Description.DBValue));
            }
            if (!oldData.ClassSrc.Equals(data.ClassSrc))
            {
                cmd.Parameters.Add(new SqlParameter("@ClassSrc", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ClassSrc", DataRowVersion.Proposed, data.ClassSrc.DBValue));
            }
            if (!oldData.ClassDescription.Equals(data.ClassDescription))
            {
                cmd.Parameters.Add(new SqlParameter("@ClassDescription", SqlDbType.VarChar, 30, ParameterDirection.Input, false, 0, 0, "ClassDescription", DataRowVersion.Proposed, data.ClassDescription.DBValue));
            }
            if (!oldData.AllowUnsubscribe.Equals(data.AllowUnsubscribe))
            {
                cmd.Parameters.Add(new SqlParameter("@AllowUnsubscribe", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "AllowUnsubscribe", DataRowVersion.Proposed, !data.AllowUnsubscribe.IsValid ? data.AllowUnsubscribe.DBValue : data.AllowUnsubscribe.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.SortOrder.Equals(data.SortOrder))
            {
                cmd.Parameters.Add(new SqlParameter("@SortOrder", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "SortOrder", DataRowVersion.Proposed, data.SortOrder.DBValue));
            }
            if (!oldData.OrgEmployeesID.Equals(data.OrgEmployeesID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgEmployeesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgEmployeesID", DataRowVersion.Proposed, data.OrgEmployeesID.DBValue));
            }
            if (!oldData.ControlsID.Equals(data.ControlsID))
            {
                cmd.Parameters.Add(new SqlParameter("@ControlsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ControlsID", DataRowVersion.Proposed, data.ControlsID.DBValue));
            }
            if (!oldData.ControlSubscriptionsID.Equals(data.ControlSubscriptionsID))
            {
                cmd.Parameters.Add(new SqlParameter("@ControlSubscriptionsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ControlSubscriptionsID", DataRowVersion.Proposed, data.ControlSubscriptionsID.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 19
0
        public static void Update(ControlEditData data)
        {
            // Create and execute the command
            ControlEditData oldData = Load();
            string          sql     = "Update " + TABLE + " set ";

            if (!oldData.IsBasic.Equals(data.IsBasic))
            {
                sql = sql + "IsBasic=@IsBasic,";
            }
            if (!oldData.Summary.Equals(data.Summary))
            {
                sql = sql + "Summary=@Summary,";
            }
            if (!oldData.Description.Equals(data.Description))
            {
                sql = sql + "Description=@Description,";
            }
            if (!oldData.Src.Equals(data.Src))
            {
                sql = sql + "Src=@Src,";
            }
            if (!oldData.IconImage.Equals(data.IconImage))
            {
                sql = sql + "IconImage=@IconImage,";
            }
            if (!oldData.DisplayOnHomePage.Equals(data.DisplayOnHomePage))
            {
                sql = sql + "DisplayOnHomePage=@DisplayOnHomePage,";
            }
            if (!oldData.SortOrder.Equals(data.SortOrder))
            {
                sql = sql + "SortOrder=@SortOrder,";
            }
            if (!oldData.ControlsID.Equals(data.ControlsID))
            {
                sql = sql + "ControlsID=@ControlsID,";
            }
            if (!oldData.ControlsGroupsID.Equals(data.ControlsGroupsID))
            {
                sql = sql + "ControlsGroupsID=@ControlsGroupsID,";
            }
            if (!oldData.OrgGroupID.Equals(data.OrgGroupID))
            {
                sql = sql + "OrgGroupID=@OrgGroupID,";
            }
            if (!oldData.ManagePage.Equals(data.ManagePage))
            {
                sql = sql + "ManagePage=@ManagePage,";
            }
            if (!oldData.EntireCompany.Equals(data.EntireCompany))
            {
                sql = sql + "EntireCompany=@EntireCompany,";
            }
            if (!oldData.MustShow.Equals(data.MustShow))
            {
                sql = sql + "MustShow=@MustShow,";
            }
            WhereClause w = new WhereClause();

            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.IsBasic.Equals(data.IsBasic))
            {
                cmd.Parameters.Add(new SqlParameter("@IsBasic", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsBasic", DataRowVersion.Proposed, !data.IsBasic.IsValid ? data.IsBasic.DBValue : data.IsBasic.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.Summary.Equals(data.Summary))
            {
                cmd.Parameters.Add(new SqlParameter("@Summary", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "Summary", DataRowVersion.Proposed, data.Summary.DBValue));
            }
            if (!oldData.Description.Equals(data.Description))
            {
                cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Proposed, data.Description.DBValue));
            }
            if (!oldData.Src.Equals(data.Src))
            {
                cmd.Parameters.Add(new SqlParameter("@Src", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Src", DataRowVersion.Proposed, data.Src.DBValue));
            }
            if (!oldData.IconImage.Equals(data.IconImage))
            {
                cmd.Parameters.Add(new SqlParameter("@IconImage", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "IconImage", DataRowVersion.Proposed, data.IconImage.DBValue));
            }
            if (!oldData.DisplayOnHomePage.Equals(data.DisplayOnHomePage))
            {
                cmd.Parameters.Add(new SqlParameter("@DisplayOnHomePage", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "DisplayOnHomePage", DataRowVersion.Proposed, !data.DisplayOnHomePage.IsValid ? data.DisplayOnHomePage.DBValue : data.DisplayOnHomePage.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.SortOrder.Equals(data.SortOrder))
            {
                cmd.Parameters.Add(new SqlParameter("@SortOrder", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "SortOrder", DataRowVersion.Proposed, data.SortOrder.DBValue));
            }
            if (!oldData.ControlsID.Equals(data.ControlsID))
            {
                cmd.Parameters.Add(new SqlParameter("@ControlsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ControlsID", DataRowVersion.Proposed, data.ControlsID.DBValue));
            }
            if (!oldData.ControlsGroupsID.Equals(data.ControlsGroupsID))
            {
                cmd.Parameters.Add(new SqlParameter("@ControlsGroupsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ControlsGroupsID", DataRowVersion.Proposed, data.ControlsGroupsID.DBValue));
            }
            if (!oldData.OrgGroupID.Equals(data.OrgGroupID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgGroupID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgGroupID", DataRowVersion.Proposed, data.OrgGroupID.DBValue));
            }
            if (!oldData.ManagePage.Equals(data.ManagePage))
            {
                cmd.Parameters.Add(new SqlParameter("@ManagePage", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ManagePage", DataRowVersion.Proposed, data.ManagePage.DBValue));
            }
            if (!oldData.EntireCompany.Equals(data.EntireCompany))
            {
                cmd.Parameters.Add(new SqlParameter("@EntireCompany", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "EntireCompany", DataRowVersion.Proposed, !data.EntireCompany.IsValid ? data.EntireCompany.DBValue : data.EntireCompany.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.MustShow.Equals(data.MustShow))
            {
                cmd.Parameters.Add(new SqlParameter("@MustShow", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "MustShow", DataRowVersion.Proposed, !data.MustShow.IsValid ? data.MustShow.DBValue : data.MustShow.DBValue.Equals("Y") ? 1 : 0));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 20
0
        public static void Update(KnowledgebasesSectionsArticlesData data)
        {
            // Create and execute the command
            KnowledgebasesSectionsArticlesData oldData = Load(data.KnowledgebasesSectionsArticlesID);
            string sql = "Update " + TABLE + " set ";

            if (!oldData.Title.Equals(data.Title))
            {
                sql = sql + "Title=@Title,";
            }
            if (!oldData.DateStart.Equals(data.DateStart))
            {
                sql = sql + "DateStart=@DateStart,";
            }
            if (!oldData.DateEnd.Equals(data.DateEnd))
            {
                sql = sql + "DateEnd=@DateEnd,";
            }
            if (!oldData.ParentID.Equals(data.ParentID))
            {
                sql = sql + "ParentID=@ParentID,";
            }
            if (!oldData.KnowledgebasesID.Equals(data.KnowledgebasesID))
            {
                sql = sql + "KnowledgebasesID=@KnowledgebasesID,";
            }
            if (!oldData.HasChild.Equals(data.HasChild))
            {
                sql = sql + "HasChild=@HasChild,";
            }
            if (!oldData.PrevKnowledgebasesSectionsID.Equals(data.PrevKnowledgebasesSectionsID))
            {
                sql = sql + "PrevKnowledgebasesSectionsID=@PrevKnowledgebasesSectionsID,";
            }
            if (!oldData.NextKnowledgebasesSectionsID.Equals(data.NextKnowledgebasesSectionsID))
            {
                sql = sql + "NextKnowledgebasesSectionsID=@NextKnowledgebasesSectionsID,";
            }
            if (!oldData.ListInParentArticle.Equals(data.ListInParentArticle))
            {
                sql = sql + "ListInParentArticle=@ListInParentArticle,";
            }
            if (!oldData.IncludeSummaryinParent.Equals(data.IncludeSummaryinParent))
            {
                sql = sql + "IncludeSummaryinParent=@IncludeSummaryinParent,";
            }
            if (!oldData.Sort.Equals(data.Sort))
            {
                sql = sql + "Sort=@Sort,";
            }
            if (!oldData.IsSection.Equals(data.IsSection))
            {
                sql = sql + "IsSection=@IsSection,";
            }
            if (!oldData.IsTemp.Equals(data.IsTemp))
            {
                sql = sql + "IsTemp=@IsTemp,";
            }
            WhereClause w = new WhereClause();

            w.And("KnowledgebasesSectionsArticlesID", data.KnowledgebasesSectionsArticlesID.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.KnowledgebasesSectionsArticlesID.Equals(data.KnowledgebasesSectionsArticlesID))
            {
                cmd.Parameters.Add(new SqlParameter("@KnowledgebasesSectionsArticlesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "KnowledgebasesSectionsArticlesID", DataRowVersion.Proposed, data.KnowledgebasesSectionsArticlesID.DBValue));
            }
            if (!oldData.Title.Equals(data.Title))
            {
                cmd.Parameters.Add(new SqlParameter("@Title", SqlDbType.VarChar, 250, ParameterDirection.Input, false, 0, 0, "Title", DataRowVersion.Proposed, data.Title.DBValue));
            }
            if (!oldData.DateStart.Equals(data.DateStart))
            {
                cmd.Parameters.Add(new SqlParameter("@DateStart", SqlDbType.SmallDateTime, 0, ParameterDirection.Input, false, 0, 0, "DateStart", DataRowVersion.Proposed, data.DateStart.DBValue));
            }
            if (!oldData.DateEnd.Equals(data.DateEnd))
            {
                cmd.Parameters.Add(new SqlParameter("@DateEnd", SqlDbType.SmallDateTime, 0, ParameterDirection.Input, false, 0, 0, "DateEnd", DataRowVersion.Proposed, data.DateEnd.DBValue));
            }
            if (!oldData.ParentID.Equals(data.ParentID))
            {
                cmd.Parameters.Add(new SqlParameter("@ParentID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ParentID", DataRowVersion.Proposed, data.ParentID.DBValue));
            }
            if (!oldData.KnowledgebasesID.Equals(data.KnowledgebasesID))
            {
                cmd.Parameters.Add(new SqlParameter("@KnowledgebasesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "KnowledgebasesID", DataRowVersion.Proposed, data.KnowledgebasesID.DBValue));
            }
            if (!oldData.HasChild.Equals(data.HasChild))
            {
                cmd.Parameters.Add(new SqlParameter("@HasChild", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "HasChild", DataRowVersion.Proposed, !data.HasChild.IsValid ? data.HasChild.DBValue : data.HasChild.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.PrevKnowledgebasesSectionsID.Equals(data.PrevKnowledgebasesSectionsID))
            {
                cmd.Parameters.Add(new SqlParameter("@PrevKnowledgebasesSectionsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "PrevKnowledgebasesSectionsID", DataRowVersion.Proposed, data.PrevKnowledgebasesSectionsID.DBValue));
            }
            if (!oldData.NextKnowledgebasesSectionsID.Equals(data.NextKnowledgebasesSectionsID))
            {
                cmd.Parameters.Add(new SqlParameter("@NextKnowledgebasesSectionsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "NextKnowledgebasesSectionsID", DataRowVersion.Proposed, data.NextKnowledgebasesSectionsID.DBValue));
            }
            if (!oldData.ListInParentArticle.Equals(data.ListInParentArticle))
            {
                cmd.Parameters.Add(new SqlParameter("@ListInParentArticle", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "ListInParentArticle", DataRowVersion.Proposed, !data.ListInParentArticle.IsValid ? data.ListInParentArticle.DBValue : data.ListInParentArticle.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.IncludeSummaryinParent.Equals(data.IncludeSummaryinParent))
            {
                cmd.Parameters.Add(new SqlParameter("@IncludeSummaryinParent", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IncludeSummaryinParent", DataRowVersion.Proposed, !data.IncludeSummaryinParent.IsValid ? data.IncludeSummaryinParent.DBValue : data.IncludeSummaryinParent.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.Sort.Equals(data.Sort))
            {
                cmd.Parameters.Add(new SqlParameter("@Sort", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Sort", DataRowVersion.Proposed, data.Sort.DBValue));
            }
            if (!oldData.IsSection.Equals(data.IsSection))
            {
                cmd.Parameters.Add(new SqlParameter("@IsSection", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsSection", DataRowVersion.Proposed, !data.IsSection.IsValid ? data.IsSection.DBValue : data.IsSection.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.IsTemp.Equals(data.IsTemp))
            {
                cmd.Parameters.Add(new SqlParameter("@IsTemp", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsTemp", DataRowVersion.Proposed, !data.IsTemp.IsValid ? data.IsTemp.DBValue : data.IsTemp.DBValue.Equals("Y") ? 1 : 0));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 21
0
        public static void Update(EventData data)
        {
            // Create and execute the command
            EventData oldData = Load(data.EventId);
            string    sql     = "Update " + TABLE + " set ";

            if (!oldData.EventId.Equals(data.EventId))
            {
                sql = sql + "Event_Id=@Event_Id,";
            }
            if (!oldData.Description.Equals(data.Description))
            {
                sql = sql + "Description=@Description,";
            }
            if (!oldData.InternalAccess.Equals(data.InternalAccess))
            {
                sql = sql + "Internal=@Internal,";
            }
            if (!oldData.ExternalAccess.Equals(data.ExternalAccess))
            {
                sql = sql + "External=@External,";
            }
            if (!oldData.CloseDate.Equals(data.CloseDate))
            {
                sql = sql + "CloseDate=@CloseDate,";
            }
            if (!oldData.StartDate.Equals(data.StartDate))
            {
                sql = sql + "StartDate=@StartDate,";
            }
            if (!oldData.DemoItemId.Equals(data.DemoItemId))
            {
                sql = sql + "DemoItemId=@DemoItemId,";
            }
            if (!oldData.GuestItemId.Equals(data.GuestItemId))
            {
                sql = sql + "GuestItemId=@GuestItemId,";
            }
            if (!oldData.MaxRegistrations.Equals(data.MaxRegistrations))
            {
                sql = sql + "MaxRegistrations=@MaxRegistrations,";
            }
            if (!oldData.Warning.Equals(data.Warning))
            {
                sql = sql + "Warning=@Warning,";
            }
            if (!oldData.MinDemoLevel.Equals(data.MinDemoLevel))
            {
                sql = sql + "MinDemoLevel=@MinDemoLevel,";
            }
            if (!oldData.SpouseOnly.Equals(data.SpouseOnly))
            {
                sql = sql + "SpouseOnly=@SpouseOnly,";
            }
            if (!oldData.MaxGuests.Equals(data.MaxGuests))
            {
                sql = sql + "MaxGuests=@MaxGuests,";
            }
            if (!oldData.AskTerms.Equals(data.AskTerms))
            {
                sql = sql + "AskTerms=@AskTerms,";
            }
            if (!oldData.AskColor.Equals(data.AskColor))
            {
                sql = sql + "AskColor=@AskColor,";
            }
            if (!oldData.DemoFirstNameOnly.Equals(data.DemoFirstNameOnly))
            {
                sql = sql + "DemoFirstNameOnly=@DemoFirstNameOnly,";
            }
            if (!oldData.AskDemoMobility.Equals(data.AskDemoMobility))
            {
                sql = sql + "AskDemoMobility=@AskDemoMobility,";
            }
            if (!oldData.AskDemoHearing.Equals(data.AskDemoHearing))
            {
                sql = sql + "AskDemoHearing=@AskDemoHearing,";
            }
            if (!oldData.JointDemoOnly.Equals(data.JointDemoOnly))
            {
                sql = sql + "JointDemoOnly=@JointDemoOnly,";
            }
            if (!oldData.ShowFinalSplash.Equals(data.ShowFinalSplash))
            {
                sql = sql + "ShowFinalSplash=@ShowFinalSplash,";
            }
            if (!oldData.NoGuestMeal.Equals(data.NoGuestMeal))
            {
                sql = sql + "NoGuestMeal=@NoGuestMeal,";
            }
            if (!oldData.DependentEvent.Equals(data.DependentEvent))
            {
                sql = sql + "DependentEvent=@DependentEvent,";
            }
            if (!oldData.AllowCheckPayment.Equals(data.AllowCheckPayment))
            {
                sql = sql + "AllowCheckPayment=@AllowCheckPayment,";
            }
            if (!oldData.NoGuestPeriod.Equals(data.NoGuestPeriod))
            {
                sql = sql + "NoGuestPeriod=@NoGuestPeriod,";
            }
            if (!oldData.CountryCode.Equals(data.CountryCode))
            {
                sql = sql + "CountryCode=@CountryCode,";
            }
            if (!oldData.EventType.Equals(data.EventType))
            {
                sql = sql + "EventType=@EventType,";
            }
            if (!oldData.EventDate.Equals(data.EventDate))
            {
                sql = sql + "EventDate=@EventDate,";
            }
            if (!oldData.GLPostedDate.Equals(data.GLPostedDate))
            {
                sql = sql + "GLPostedDate=@GLPostedDate,";
            }
            if (!oldData.CancelFeeItemId.Equals(data.CancelFeeItemId))
            {
                sql = sql + "CancelFeeItemId=@CancelFeeItemId,";
            }
            if (!oldData.GuestCancelFeeItemId.Equals(data.GuestCancelFeeItemId))
            {
                sql = sql + "GuestCancelFeeItemId=@GuestCancelFeeItemId,";
            }
            WhereClause w = new WhereClause();

            w.And("Event_Id", data.EventId.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.ORDERDB, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.EventId.Equals(data.EventId))
            {
                cmd.Parameters.Add(new SqlParameter("@Event_Id", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "EventId", DataRowVersion.Proposed, data.EventId.DBValue));
            }
            if (!oldData.Description.Equals(data.Description))
            {
                cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.Char, 80, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Proposed, data.Description.DBValue));
            }
            if (!oldData.InternalAccess.Equals(data.InternalAccess))
            {
                cmd.Parameters.Add(new SqlParameter("@Internal", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "InternalAccess", DataRowVersion.Proposed, data.InternalAccess.DBValue));
            }
            if (!oldData.ExternalAccess.Equals(data.ExternalAccess))
            {
                cmd.Parameters.Add(new SqlParameter("@External", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ExternalAccess", DataRowVersion.Proposed, data.ExternalAccess.DBValue));
            }
            if (!oldData.CloseDate.Equals(data.CloseDate))
            {
                cmd.Parameters.Add(new SqlParameter("@CloseDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "CloseDate", DataRowVersion.Proposed, data.CloseDate.DBValue));
            }
            if (!oldData.StartDate.Equals(data.StartDate))
            {
                cmd.Parameters.Add(new SqlParameter("@StartDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "StartDate", DataRowVersion.Proposed, data.StartDate.DBValue));
            }
            if (!oldData.DemoItemId.Equals(data.DemoItemId))
            {
                cmd.Parameters.Add(new SqlParameter("@DemoItemId", SqlDbType.Char, 20, ParameterDirection.Input, false, 0, 0, "DemoItemId", DataRowVersion.Proposed, data.DemoItemId.DBValue));
            }
            if (!oldData.GuestItemId.Equals(data.GuestItemId))
            {
                cmd.Parameters.Add(new SqlParameter("@GuestItemId", SqlDbType.Char, 20, ParameterDirection.Input, false, 0, 0, "GuestItemId", DataRowVersion.Proposed, data.GuestItemId.DBValue));
            }
            if (!oldData.MaxRegistrations.Equals(data.MaxRegistrations))
            {
                cmd.Parameters.Add(new SqlParameter("@MaxRegistrations", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "MaxRegistrations", DataRowVersion.Proposed, data.MaxRegistrations.DBValue));
            }
            if (!oldData.Warning.Equals(data.Warning))
            {
                cmd.Parameters.Add(new SqlParameter("@Warning", SqlDbType.VarChar, 5000, ParameterDirection.Input, false, 0, 0, "Warning", DataRowVersion.Proposed, data.Warning.DBValue));
            }
            if (!oldData.MinDemoLevel.Equals(data.MinDemoLevel))
            {
                cmd.Parameters.Add(new SqlParameter("@MinDemoLevel", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "MinDemoLevel", DataRowVersion.Proposed, data.MinDemoLevel.DBValue));
            }
            if (!oldData.SpouseOnly.Equals(data.SpouseOnly))
            {
                cmd.Parameters.Add(new SqlParameter("@SpouseOnly", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "SpouseOnly", DataRowVersion.Proposed, data.SpouseOnly.DBValue));
            }
            if (!oldData.MaxGuests.Equals(data.MaxGuests))
            {
                cmd.Parameters.Add(new SqlParameter("@MaxGuests", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "MaxGuests", DataRowVersion.Proposed, data.MaxGuests.DBValue));
            }
            if (!oldData.AskTerms.Equals(data.AskTerms))
            {
                cmd.Parameters.Add(new SqlParameter("@AskTerms", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "AskTerms", DataRowVersion.Proposed, data.AskTerms.DBValue));
            }
            if (!oldData.AskColor.Equals(data.AskColor))
            {
                cmd.Parameters.Add(new SqlParameter("@AskColor", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "AskColor", DataRowVersion.Proposed, data.AskColor.DBValue));
            }
            if (!oldData.DemoFirstNameOnly.Equals(data.DemoFirstNameOnly))
            {
                cmd.Parameters.Add(new SqlParameter("@DemoFirstNameOnly", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "DemoFirstNameOnly", DataRowVersion.Proposed, data.DemoFirstNameOnly.DBValue));
            }
            if (!oldData.AskDemoMobility.Equals(data.AskDemoMobility))
            {
                cmd.Parameters.Add(new SqlParameter("@AskDemoMobility", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "AskDemoMobility", DataRowVersion.Proposed, data.AskDemoMobility.DBValue));
            }
            if (!oldData.AskDemoHearing.Equals(data.AskDemoHearing))
            {
                cmd.Parameters.Add(new SqlParameter("@AskDemoHearing", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "AskDemoHearing", DataRowVersion.Proposed, data.AskDemoHearing.DBValue));
            }
            if (!oldData.JointDemoOnly.Equals(data.JointDemoOnly))
            {
                cmd.Parameters.Add(new SqlParameter("@JointDemoOnly", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "JointDemoOnly", DataRowVersion.Proposed, data.JointDemoOnly.DBValue));
            }
            if (!oldData.ShowFinalSplash.Equals(data.ShowFinalSplash))
            {
                cmd.Parameters.Add(new SqlParameter("@ShowFinalSplash", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "ShowFinalSplash", DataRowVersion.Proposed, data.ShowFinalSplash.DBValue));
            }
            if (!oldData.NoGuestMeal.Equals(data.NoGuestMeal))
            {
                cmd.Parameters.Add(new SqlParameter("@NoGuestMeal", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "NoGuestMeal", DataRowVersion.Proposed, data.NoGuestMeal.DBValue));
            }
            if (!oldData.DependentEvent.Equals(data.DependentEvent))
            {
                cmd.Parameters.Add(new SqlParameter("@DependentEvent", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "DependentEvent", DataRowVersion.Proposed, data.DependentEvent.DBValue));
            }
            if (!oldData.AllowCheckPayment.Equals(data.AllowCheckPayment))
            {
                cmd.Parameters.Add(new SqlParameter("@AllowCheckPayment", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "AllowCheckPayment", DataRowVersion.Proposed, data.AllowCheckPayment.DBValue));
            }
            if (!oldData.NoGuestPeriod.Equals(data.NoGuestPeriod))
            {
                cmd.Parameters.Add(new SqlParameter("@NoGuestPeriod", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "NoGuestPeriod", DataRowVersion.Proposed, data.NoGuestPeriod.DBValue));
            }
            if (!oldData.CountryCode.Equals(data.CountryCode))
            {
                cmd.Parameters.Add(new SqlParameter("@CountryCode", SqlDbType.Char, 2, ParameterDirection.Input, false, 0, 0, "CountryCode", DataRowVersion.Proposed, data.CountryCode.DBValue));
            }
            if (!oldData.EventType.Equals(data.EventType))
            {
                cmd.Parameters.Add(new SqlParameter("@EventType", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "EventType", DataRowVersion.Proposed, data.EventType.DBValue));
            }
            if (!oldData.EventDate.Equals(data.EventDate))
            {
                cmd.Parameters.Add(new SqlParameter("@EventDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "EventDate", DataRowVersion.Proposed, data.EventDate.DBValue));
            }
            if (!oldData.GLPostedDate.Equals(data.GLPostedDate))
            {
                cmd.Parameters.Add(new SqlParameter("@GLPostedDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "GLPostedDate", DataRowVersion.Proposed, data.GLPostedDate.DBValue));
            }
            if (!oldData.CancelFeeItemId.Equals(data.CancelFeeItemId))
            {
                cmd.Parameters.Add(new SqlParameter("@CancelFeeItemId", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "CancelFeeItemId", DataRowVersion.Proposed, data.CancelFeeItemId.DBValue));
            }
            if (!oldData.GuestCancelFeeItemId.Equals(data.GuestCancelFeeItemId))
            {
                cmd.Parameters.Add(new SqlParameter("@GuestCancelFeeItemId", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "GuestCancelFeeItemId", DataRowVersion.Proposed, data.GuestCancelFeeItemId.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        public static void Update(MustShowControlViewData data)
        {
            // Create and execute the command
            MustShowControlViewData oldData = Load();
            string sql = "Update " + TABLE + " set ";

            if (!oldData.Src.Equals(data.Src))
            {
                sql = sql + "Src=@Src,";
            }
            if (!oldData.Description.Equals(data.Description))
            {
                sql = sql + "Description=@Description,";
            }
            if (!oldData.Summary.Equals(data.Summary))
            {
                sql = sql + "Summary=@Summary,";
            }
            if (!oldData.ClassSrc.Equals(data.ClassSrc))
            {
                sql = sql + "ClassSrc=@ClassSrc,";
            }
            if (!oldData.MustShow.Equals(data.MustShow))
            {
                sql = sql + "MustShow=@MustShow,";
            }
            if (!oldData.DateStart.Equals(data.DateStart))
            {
                sql = sql + "DateStart=@DateStart,";
            }
            if (!oldData.DateEnd.Equals(data.DateEnd))
            {
                sql = sql + "DateEnd=@DateEnd,";
            }
            if (!oldData.ControlsID.Equals(data.ControlsID))
            {
                sql = sql + "ControlsID=@ControlsID,";
            }
            WhereClause w = new WhereClause();

            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.Src.Equals(data.Src))
            {
                cmd.Parameters.Add(new SqlParameter("@Src", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Src", DataRowVersion.Proposed, data.Src.DBValue));
            }
            if (!oldData.Description.Equals(data.Description))
            {
                cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Proposed, data.Description.DBValue));
            }
            if (!oldData.Summary.Equals(data.Summary))
            {
                cmd.Parameters.Add(new SqlParameter("@Summary", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "Summary", DataRowVersion.Proposed, data.Summary.DBValue));
            }
            if (!oldData.ClassSrc.Equals(data.ClassSrc))
            {
                cmd.Parameters.Add(new SqlParameter("@ClassSrc", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ClassSrc", DataRowVersion.Proposed, data.ClassSrc.DBValue));
            }
            if (!oldData.MustShow.Equals(data.MustShow))
            {
                cmd.Parameters.Add(new SqlParameter("@MustShow", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "MustShow", DataRowVersion.Proposed, !data.MustShow.IsValid ? data.MustShow.DBValue : data.MustShow.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.DateStart.Equals(data.DateStart))
            {
                cmd.Parameters.Add(new SqlParameter("@DateStart", SqlDbType.SmallDateTime, 0, ParameterDirection.Input, false, 0, 0, "DateStart", DataRowVersion.Proposed, data.DateStart.DBValue));
            }
            if (!oldData.DateEnd.Equals(data.DateEnd))
            {
                cmd.Parameters.Add(new SqlParameter("@DateEnd", SqlDbType.SmallDateTime, 0, ParameterDirection.Input, false, 0, 0, "DateEnd", DataRowVersion.Proposed, data.DateEnd.DBValue));
            }
            if (!oldData.ControlsID.Equals(data.ControlsID))
            {
                cmd.Parameters.Add(new SqlParameter("@ControlsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "ControlsID", DataRowVersion.Proposed, data.ControlsID.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 23
0
        public static void Update(EmployeeManagerNotesData data)
        {
            // Create and execute the command
            EmployeeManagerNotesData oldData = Load(data.Id);
            string sql = "Update " + TABLE + " set ";

            if (!oldData.ChangeEmployeeName.Equals(data.ChangeEmployeeName))
            {
                sql = sql + "ChangeEmployeeName=@ChangeEmployeeName,";
            }
            if (!oldData.IsAutomated.Equals(data.IsAutomated))
            {
                sql = sql + "IsAutomated=@IsAutomated,";
            }
            if (!oldData.NoteDate.Equals(data.NoteDate))
            {
                sql = sql + "NoteDate=@NoteDate,";
            }
            if (!oldData.Notes.Equals(data.Notes))
            {
                sql = sql + "Notes=@Notes,";
            }
            if (!oldData.Type.Equals(data.Type))
            {
                sql = sql + "Type=@Type,";
            }
            if (!oldData.EmployeeID.Equals(data.EmployeeID))
            {
                sql = sql + "EmployeeID=@EmployeeID,";
            }
            WhereClause w = new WhereClause();

            w.And("Id", data.Id.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.Id.Equals(data.Id))
            {
                cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Id", DataRowVersion.Proposed, data.Id.DBValue));
            }
            if (!oldData.ChangeEmployeeName.Equals(data.ChangeEmployeeName))
            {
                cmd.Parameters.Add(new SqlParameter("@ChangeEmployeeName", SqlDbType.VarChar, 150, ParameterDirection.Input, false, 0, 0, "ChangeEmployeeName", DataRowVersion.Proposed, data.ChangeEmployeeName.DBValue));
            }
            if (!oldData.IsAutomated.Equals(data.IsAutomated))
            {
                cmd.Parameters.Add(new SqlParameter("@IsAutomated", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsAutomated", DataRowVersion.Proposed, !data.IsAutomated.IsValid ? data.IsAutomated.DBValue : data.IsAutomated.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.NoteDate.Equals(data.NoteDate))
            {
                cmd.Parameters.Add(new SqlParameter("@NoteDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "NoteDate", DataRowVersion.Proposed, data.NoteDate.DBValue));
            }
            if (!oldData.Notes.Equals(data.Notes))
            {
                cmd.Parameters.Add(new SqlParameter("@Notes", SqlDbType.VarChar, 300, ParameterDirection.Input, false, 0, 0, "Notes", DataRowVersion.Proposed, data.Notes.DBValue));
            }
            if (!oldData.Type.Equals(data.Type))
            {
                cmd.Parameters.Add(new SqlParameter("@Type", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Type", DataRowVersion.Proposed, data.Type.DBValue));
            }
            if (!oldData.EmployeeID.Equals(data.EmployeeID))
            {
                cmd.Parameters.Add(new SqlParameter("@EmployeeID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "EmployeeID", DataRowVersion.Proposed, data.EmployeeID.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        public static void Update(OrgLocationsData data)
        {
            // Create and execute the command
            OrgLocationsData oldData = Load(data.OrgLocationsID);
            string           sql     = "Update " + TABLE + " set ";

            if (!oldData.Description.Equals(data.Description))
            {
                sql = sql + "Description=@Description,";
            }
            if (!oldData.Address1.Equals(data.Address1))
            {
                sql = sql + "Address1=@Address1,";
            }
            if (!oldData.Address2.Equals(data.Address2))
            {
                sql = sql + "Address2=@Address2,";
            }
            if (!oldData.City.Equals(data.City))
            {
                sql = sql + "City=@City,";
            }
            if (!oldData.State.Equals(data.State))
            {
                sql = sql + "State=@State,";
            }
            if (!oldData.Country.Equals(data.Country))
            {
                sql = sql + "Country=@Country,";
            }
            if (!oldData.PostCode.Equals(data.PostCode))
            {
                sql = sql + "PostCode=@PostCode,";
            }
            if (!oldData.Prefix.Equals(data.Prefix))
            {
                sql = sql + "Prefix=@Prefix,";
            }
            if (!oldData.Image.Equals(data.Image))
            {
                sql = sql + "Image=@Image,";
            }
            WhereClause w = new WhereClause();

            w.And("OrgLocationsID", data.OrgLocationsID.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.OrgLocationsID.Equals(data.OrgLocationsID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgLocationsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgLocationsID", DataRowVersion.Proposed, data.OrgLocationsID.DBValue));
            }
            if (!oldData.Description.Equals(data.Description))
            {
                cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Proposed, data.Description.DBValue));
            }
            if (!oldData.Address1.Equals(data.Address1))
            {
                cmd.Parameters.Add(new SqlParameter("@Address1", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "Address1", DataRowVersion.Proposed, data.Address1.DBValue));
            }
            if (!oldData.Address2.Equals(data.Address2))
            {
                cmd.Parameters.Add(new SqlParameter("@Address2", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "Address2", DataRowVersion.Proposed, data.Address2.DBValue));
            }
            if (!oldData.City.Equals(data.City))
            {
                cmd.Parameters.Add(new SqlParameter("@City", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "City", DataRowVersion.Proposed, data.City.DBValue));
            }
            if (!oldData.State.Equals(data.State))
            {
                cmd.Parameters.Add(new SqlParameter("@State", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "State", DataRowVersion.Proposed, data.State.DBValue));
            }
            if (!oldData.Country.Equals(data.Country))
            {
                cmd.Parameters.Add(new SqlParameter("@Country", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Country", DataRowVersion.Proposed, data.Country.DBValue));
            }
            if (!oldData.PostCode.Equals(data.PostCode))
            {
                cmd.Parameters.Add(new SqlParameter("@PostCode", SqlDbType.VarChar, 15, ParameterDirection.Input, false, 0, 0, "PostCode", DataRowVersion.Proposed, data.PostCode.DBValue));
            }
            if (!oldData.Prefix.Equals(data.Prefix))
            {
                cmd.Parameters.Add(new SqlParameter("@Prefix", SqlDbType.VarChar, 10, ParameterDirection.Input, false, 0, 0, "Prefix", DataRowVersion.Proposed, data.Prefix.DBValue));
            }
            if (!oldData.Image.Equals(data.Image))
            {
                cmd.Parameters.Add(new SqlParameter("@Image", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Image", DataRowVersion.Proposed, data.Image.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Returns a list of objects which match the values for the fields specified.
        /// </summary>
        /// <param name="Name">A field value to be matched.</param>
        /// <returns>The list of TournamentDAO objects found.</returns>
        public static IList FindByName(StringType name, Int32 limit)
        {
            OrderByClause sort   = new OrderByClause("Name");
            WhereClause   filter = new WhereClause("Name like @Name + '%'");
            String        sql    = "Select top " + limit.ToString() + " * from " + VIEW + filter.FormatSql() + sort.FormatSql();
            SqlCommand    cmd    = GetSqlCommand(CONNECTION_STRING_KEY, sql, CommandType.Text);

            cmd.Parameters.Add(new SqlParameter("@Name", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Name", DataRowVersion.Proposed, name.DBValue));
            SqlDataReader dataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            IList         list       = new ArrayList();

            while (dataReader.Read())
            {
                list.Add(GetDataObjectFromReader(dataReader));
            }
            dataReader.Close();
            return(list);
        }
Esempio n. 26
0
        public static void Update(OrderDtlData data)
        {
            // Create and execute the command
            OrderDtlData oldData = Load(data.OrderDetailId);
            string       sql     = "Update " + TABLE + " set ";

            if (!oldData.OrderDetailId.Equals(data.OrderDetailId))
            {
                sql = sql + "Order_Detail_Id=@Order_Detail_Id,";
            }
            if (!oldData.OrderNo.Equals(data.OrderNo))
            {
                sql = sql + "Orderno=@Orderno,";
            }
            if (!oldData.TypeOrd.Equals(data.TypeOrd))
            {
                sql = sql + "Type_Ord=@Type_Ord,";
            }
            if (!oldData.ItemId.Equals(data.ItemId))
            {
                sql = sql + "Item_Id=@Item_Id,";
            }
            if (!oldData.ItemDescrip.Equals(data.ItemDescrip))
            {
                sql = sql + "Item_Descrip=@Item_Descrip,";
            }
            if (!oldData.BinNo.Equals(data.BinNo))
            {
                sql = sql + "Bin_No=@Bin_No,";
            }
            if (!oldData.QtyOrdered.Equals(data.QtyOrdered))
            {
                sql = sql + "Qty_Ordered=@Qty_Ordered,";
            }
            if (!oldData.QtyPicked.Equals(data.QtyPicked))
            {
                sql = sql + "Qty_Picked=@Qty_Picked,";
            }
            if (!oldData.QtyShipped.Equals(data.QtyShipped))
            {
                sql = sql + "Qty_Shipped=@Qty_Shipped,";
            }
            if (!oldData.ShippingNo.Equals(data.ShippingNo))
            {
                sql = sql + "Shipping_No=@Shipping_No,";
            }
            if (!oldData.ItemPrice.Equals(data.ItemPrice))
            {
                sql = sql + "Item_Price=@Item_Price,";
            }
            if (!oldData.Subtotal.Equals(data.Subtotal))
            {
                sql = sql + "Subtotal=@Subtotal,";
            }
            if (!oldData.Personal.Equals(data.Personal))
            {
                sql = sql + "Personal=@Personal,";
            }
            if (!oldData.TaxExempt.Equals(data.TaxExempt))
            {
                sql = sql + "Tax_Exempt=@Tax_Exempt,";
            }
            if (!oldData.TaxExemptNo.Equals(data.TaxExemptNo))
            {
                sql = sql + "Tax_Exempt_No=@Tax_Exempt_No,";
            }
            if (!oldData.ShipDate.Equals(data.ShipDate))
            {
                sql = sql + "Ship_Date=@Ship_Date,";
            }
            if (!oldData.Kit.Equals(data.Kit))
            {
                sql = sql + "Kit=@Kit,";
            }
            if (!oldData.GuestIdOld.Equals(data.GuestIdOld))
            {
                sql = sql + "Guest_Id_Old=@Guest_Id_Old,";
            }
            if (!oldData.ComponentId.Equals(data.ComponentId))
            {
                sql = sql + "Component_Id=@Component_Id,";
            }
            if (!oldData.GuestId.Equals(data.GuestId))
            {
                sql = sql + "Guest_Id=@Guest_Id,";
            }
            if (!oldData.Xxxsave.Equals(data.Xxxsave))
            {
                sql = sql + "Xxxsave=@Xxxsave,";
            }
            if (!oldData.StartkitCategory.Equals(data.StartkitCategory))
            {
                sql = sql + "Startkit_Category=@Startkit_Category,";
            }
            if (!oldData.GLPostedDate.Equals(data.GLPostedDate))
            {
                sql = sql + "GLPostedDate=@GLPostedDate,";
            }
            if (!oldData.Revenue.Equals(data.Revenue))
            {
                sql = sql + "Revenue=@Revenue,";
            }
            if (!oldData.DiscountAmount.Equals(data.DiscountAmount))
            {
                sql = sql + "DiscountAmount=@DiscountAmount,";
            }
            if (!oldData.QtyCanceled.Equals(data.QtyCanceled))
            {
                sql = sql + "QtyCanceled=@QtyCanceled,";
            }
            if (!oldData.CanceledDate.Equals(data.CanceledDate))
            {
                sql = sql + "CanceledDate=@CanceledDate,";
            }
            if (!oldData.ChargeForItem.Equals(data.ChargeForItem))
            {
                sql = sql + "ChargeForItem=@ChargeForItem,";
            }
            if (!oldData.ErrorCode.Equals(data.ErrorCode))
            {
                sql = sql + "ErrorCode=@ErrorCode,";
            }
            if (!oldData.ErrorDepartment.Equals(data.ErrorDepartment))
            {
                sql = sql + "ErrorDepartment=@ErrorDepartment,";
            }
            if (!oldData.WaitReturnBeginDate.Equals(data.WaitReturnBeginDate))
            {
                sql = sql + "WaitReturnBeginDate=@WaitReturnBeginDate,";
            }
            if (!oldData.WaitReturnDueDate.Equals(data.WaitReturnDueDate))
            {
                sql = sql + "WaitReturnDueDate=@WaitReturnDueDate,";
            }
            if (!oldData.WaitReturnReceivedDate.Equals(data.WaitReturnReceivedDate))
            {
                sql = sql + "WaitReturnReceivedDate=@WaitReturnReceivedDate,";
            }
            if (!oldData.ItemNotes.Equals(data.ItemNotes))
            {
                sql = sql + "ItemNotes=@ItemNotes,";
            }
            if (!oldData.SaveAsShipped.Equals(data.SaveAsShipped))
            {
                sql = sql + "SaveAsShipped=@SaveAsShipped,";
            }
            if (!oldData.PurchasedDate.Equals(data.PurchasedDate))
            {
                sql = sql + "PurchasedDate=@PurchasedDate,";
            }
            WhereClause w = new WhereClause();

            w.And("Order_Detail_Id", data.OrderDetailId.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.ORDERDB, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.OrderDetailId.Equals(data.OrderDetailId))
            {
                cmd.Parameters.Add(new SqlParameter("@Order_Detail_Id", SqlDbType.VarChar, 11, ParameterDirection.Input, false, 0, 0, "OrderDetailId", DataRowVersion.Proposed, data.OrderDetailId.DBValue));
            }
            if (!oldData.OrderNo.Equals(data.OrderNo))
            {
                cmd.Parameters.Add(new SqlParameter("@Orderno", SqlDbType.VarChar, 15, ParameterDirection.Input, false, 0, 0, "OrderNo", DataRowVersion.Proposed, data.OrderNo.DBValue));
            }
            if (!oldData.TypeOrd.Equals(data.TypeOrd))
            {
                cmd.Parameters.Add(new SqlParameter("@Type_Ord", SqlDbType.VarChar, 4, ParameterDirection.Input, false, 0, 0, "TypeOrd", DataRowVersion.Proposed, data.TypeOrd.DBValue));
            }
            if (!oldData.ItemId.Equals(data.ItemId))
            {
                cmd.Parameters.Add(new SqlParameter("@Item_Id", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "ItemId", DataRowVersion.Proposed, data.ItemId.DBValue));
            }
            if (!oldData.ItemDescrip.Equals(data.ItemDescrip))
            {
                cmd.Parameters.Add(new SqlParameter("@Item_Descrip", SqlDbType.VarChar, 60, ParameterDirection.Input, false, 0, 0, "ItemDescrip", DataRowVersion.Proposed, data.ItemDescrip.DBValue));
            }
            if (!oldData.BinNo.Equals(data.BinNo))
            {
                cmd.Parameters.Add(new SqlParameter("@Bin_No", SqlDbType.VarChar, 10, ParameterDirection.Input, false, 0, 0, "BinNo", DataRowVersion.Proposed, data.BinNo.DBValue));
            }
            if (!oldData.QtyOrdered.Equals(data.QtyOrdered))
            {
                cmd.Parameters.Add(new SqlParameter("@Qty_Ordered", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "QtyOrdered", DataRowVersion.Proposed, data.QtyOrdered.DBValue));
            }
            if (!oldData.QtyPicked.Equals(data.QtyPicked))
            {
                cmd.Parameters.Add(new SqlParameter("@Qty_Picked", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "QtyPicked", DataRowVersion.Proposed, data.QtyPicked.DBValue));
            }
            if (!oldData.QtyShipped.Equals(data.QtyShipped))
            {
                cmd.Parameters.Add(new SqlParameter("@Qty_Shipped", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "QtyShipped", DataRowVersion.Proposed, data.QtyShipped.DBValue));
            }
            if (!oldData.ShippingNo.Equals(data.ShippingNo))
            {
                cmd.Parameters.Add(new SqlParameter("@Shipping_No", SqlDbType.Float, 0, ParameterDirection.Input, false, 0, 0, "ShippingNo", DataRowVersion.Proposed, data.ShippingNo.DBValue));
            }
            if (!oldData.ItemPrice.Equals(data.ItemPrice))
            {
                cmd.Parameters.Add(new SqlParameter("@Item_Price", SqlDbType.Float, 0, ParameterDirection.Input, false, 0, 0, "ItemPrice", DataRowVersion.Proposed, data.ItemPrice.DBValue));
            }
            if (!oldData.Subtotal.Equals(data.Subtotal))
            {
                cmd.Parameters.Add(new SqlParameter("@Subtotal", SqlDbType.Float, 0, ParameterDirection.Input, false, 0, 0, "Subtotal", DataRowVersion.Proposed, data.Subtotal.DBValue));
            }
            if (!oldData.Personal.Equals(data.Personal))
            {
                cmd.Parameters.Add(new SqlParameter("@Personal", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "Personal", DataRowVersion.Proposed, !data.Personal.IsValid ? data.Personal.DBValue : data.Personal.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.TaxExempt.Equals(data.TaxExempt))
            {
                cmd.Parameters.Add(new SqlParameter("@Tax_Exempt", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "TaxExempt", DataRowVersion.Proposed, !data.TaxExempt.IsValid ? data.TaxExempt.DBValue : data.TaxExempt.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.TaxExemptNo.Equals(data.TaxExemptNo))
            {
                cmd.Parameters.Add(new SqlParameter("@Tax_Exempt_No", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "TaxExemptNo", DataRowVersion.Proposed, data.TaxExemptNo.DBValue));
            }
            if (!oldData.ShipDate.Equals(data.ShipDate))
            {
                cmd.Parameters.Add(new SqlParameter("@Ship_Date", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "ShipDate", DataRowVersion.Proposed, data.ShipDate.DBValue));
            }
            if (!oldData.Kit.Equals(data.Kit))
            {
                cmd.Parameters.Add(new SqlParameter("@Kit", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Kit", DataRowVersion.Proposed, data.Kit.DBValue));
            }
            if (!oldData.GuestIdOld.Equals(data.GuestIdOld))
            {
                cmd.Parameters.Add(new SqlParameter("@Guest_Id_Old", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "GuestIdOld", DataRowVersion.Proposed, data.GuestIdOld.DBValue));
            }
            if (!oldData.ComponentId.Equals(data.ComponentId))
            {
                cmd.Parameters.Add(new SqlParameter("@Component_Id", SqlDbType.Char, 11, ParameterDirection.Input, false, 0, 0, "ComponentId", DataRowVersion.Proposed, data.ComponentId.DBValue));
            }
            if (!oldData.GuestId.Equals(data.GuestId))
            {
                cmd.Parameters.Add(new SqlParameter("@Guest_Id", SqlDbType.VarChar, 7, ParameterDirection.Input, false, 0, 0, "GuestId", DataRowVersion.Proposed, data.GuestId.DBValue));
            }
            if (!oldData.Xxxsave.Equals(data.Xxxsave))
            {
                cmd.Parameters.Add(new SqlParameter("@Xxxsave", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Xxxsave", DataRowVersion.Proposed, data.Xxxsave.DBValue));
            }
            if (!oldData.StartkitCategory.Equals(data.StartkitCategory))
            {
                cmd.Parameters.Add(new SqlParameter("@Startkit_Category", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "StartkitCategory", DataRowVersion.Proposed, data.StartkitCategory.DBValue));
            }
            if (!oldData.GLPostedDate.Equals(data.GLPostedDate))
            {
                cmd.Parameters.Add(new SqlParameter("@GLPostedDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "GLPostedDate", DataRowVersion.Proposed, data.GLPostedDate.DBValue));
            }
            if (!oldData.Revenue.Equals(data.Revenue))
            {
                cmd.Parameters.Add(new SqlParameter("@Revenue", SqlDbType.Money, 0, ParameterDirection.Input, false, 0, 0, "Revenue", DataRowVersion.Proposed, data.Revenue.DBValue));
            }
            if (!oldData.DiscountAmount.Equals(data.DiscountAmount))
            {
                cmd.Parameters.Add(new SqlParameter("@DiscountAmount", SqlDbType.Money, 0, ParameterDirection.Input, false, 0, 0, "DiscountAmount", DataRowVersion.Proposed, data.DiscountAmount.DBValue));
            }
            if (!oldData.QtyCanceled.Equals(data.QtyCanceled))
            {
                cmd.Parameters.Add(new SqlParameter("@QtyCanceled", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "QtyCanceled", DataRowVersion.Proposed, data.QtyCanceled.DBValue));
            }
            if (!oldData.CanceledDate.Equals(data.CanceledDate))
            {
                cmd.Parameters.Add(new SqlParameter("@CanceledDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "CanceledDate", DataRowVersion.Proposed, data.CanceledDate.DBValue));
            }
            if (!oldData.ChargeForItem.Equals(data.ChargeForItem))
            {
                cmd.Parameters.Add(new SqlParameter("@ChargeForItem", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "ChargeForItem", DataRowVersion.Proposed, !data.ChargeForItem.IsValid ? data.ChargeForItem.DBValue : data.ChargeForItem.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.ErrorCode.Equals(data.ErrorCode))
            {
                cmd.Parameters.Add(new SqlParameter("@ErrorCode", SqlDbType.VarChar, 4, ParameterDirection.Input, false, 0, 0, "ErrorCode", DataRowVersion.Proposed, data.ErrorCode.DBValue));
            }
            if (!oldData.ErrorDepartment.Equals(data.ErrorDepartment))
            {
                cmd.Parameters.Add(new SqlParameter("@ErrorDepartment", SqlDbType.VarChar, 3, ParameterDirection.Input, false, 0, 0, "ErrorDepartment", DataRowVersion.Proposed, data.ErrorDepartment.DBValue));
            }
            if (!oldData.WaitReturnBeginDate.Equals(data.WaitReturnBeginDate))
            {
                cmd.Parameters.Add(new SqlParameter("@WaitReturnBeginDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "WaitReturnBeginDate", DataRowVersion.Proposed, data.WaitReturnBeginDate.DBValue));
            }
            if (!oldData.WaitReturnDueDate.Equals(data.WaitReturnDueDate))
            {
                cmd.Parameters.Add(new SqlParameter("@WaitReturnDueDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "WaitReturnDueDate", DataRowVersion.Proposed, data.WaitReturnDueDate.DBValue));
            }
            if (!oldData.WaitReturnReceivedDate.Equals(data.WaitReturnReceivedDate))
            {
                cmd.Parameters.Add(new SqlParameter("@WaitReturnReceivedDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "WaitReturnReceivedDate", DataRowVersion.Proposed, data.WaitReturnReceivedDate.DBValue));
            }
            if (!oldData.ItemNotes.Equals(data.ItemNotes))
            {
                cmd.Parameters.Add(new SqlParameter("@ItemNotes", SqlDbType.VarChar, 8000, ParameterDirection.Input, false, 0, 0, "ItemNotes", DataRowVersion.Proposed, data.ItemNotes.DBValue));
            }
            if (!oldData.SaveAsShipped.Equals(data.SaveAsShipped))
            {
                cmd.Parameters.Add(new SqlParameter("@SaveAsShipped", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "SaveAsShipped", DataRowVersion.Proposed, !data.SaveAsShipped.IsValid ? data.SaveAsShipped.DBValue : data.SaveAsShipped.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.PurchasedDate.Equals(data.PurchasedDate))
            {
                cmd.Parameters.Add(new SqlParameter("@PurchasedDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "PurchasedDate", DataRowVersion.Proposed, data.PurchasedDate.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        public static void Update(AllEmployeeWithGroupInfoViewData data)
        {
            // Create and execute the command
            AllEmployeeWithGroupInfoViewData oldData = Load();
            string sql = "Update " + TABLE + " set ";

            if (!oldData.OrgEmployeesID.Equals(data.OrgEmployeesID))
            {
                sql = sql + "OrgEmployeesID=@OrgEmployeesID,";
            }
            if (!oldData.FirstName.Equals(data.FirstName))
            {
                sql = sql + "FirstName=@FirstName,";
            }
            if (!oldData.LastName.Equals(data.LastName))
            {
                sql = sql + "LastName=@LastName,";
            }
            if (!oldData.EmployeeTitle.Equals(data.EmployeeTitle))
            {
                sql = sql + "EmployeeTitle=@EmployeeTitle,";
            }
            if (!oldData.DepartmentName.Equals(data.DepartmentName))
            {
                sql = sql + "DepartmentName=@DepartmentName,";
            }
            if (!oldData.LocationName.Equals(data.LocationName))
            {
                sql = sql + "LocationName=@LocationName,";
            }
            if (!oldData.PhoneNumber.Equals(data.PhoneNumber))
            {
                sql = sql + "PhoneNumber=@PhoneNumber,";
            }
            if (!oldData.PhoneDescription.Equals(data.PhoneDescription))
            {
                sql = sql + "PhoneDescription=@PhoneDescription,";
            }
            if (!oldData.Email.Equals(data.Email))
            {
                sql = sql + "Email=@Email,";
            }
            if (!oldData.DateHired.Equals(data.DateHired))
            {
                sql = sql + "DateHired=@DateHired,";
            }
            if (!oldData.DateTerminated.Equals(data.DateTerminated))
            {
                sql = sql + "DateTerminated=@DateTerminated,";
            }
            if (!oldData.Manager.Equals(data.Manager))
            {
                sql = sql + "Manager=@Manager,";
            }
            if (!oldData.EmployeeNumber.Equals(data.EmployeeNumber))
            {
                sql = sql + "EmployeeNumber=@EmployeeNumber,";
            }
            if (!oldData.Style.Equals(data.Style))
            {
                sql = sql + "Style=@Style,";
            }
            if (!oldData.IsActive.Equals(data.IsActive))
            {
                sql = sql + "IsActive=@IsActive,";
            }
            if (!oldData.NTUserAccount.Equals(data.NTUserAccount))
            {
                sql = sql + "NTUserAccount=@NTUserAccount,";
            }
            WhereClause w = new WhereClause();

            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.OrgEmployeesID.Equals(data.OrgEmployeesID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgEmployeesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgEmployeesID", DataRowVersion.Proposed, data.OrgEmployeesID.DBValue));
            }
            if (!oldData.FirstName.Equals(data.FirstName))
            {
                cmd.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.VarChar, 30, ParameterDirection.Input, false, 0, 0, "FirstName", DataRowVersion.Proposed, data.FirstName.DBValue));
            }
            if (!oldData.LastName.Equals(data.LastName))
            {
                cmd.Parameters.Add(new SqlParameter("@LastName", SqlDbType.VarChar, 30, ParameterDirection.Input, false, 0, 0, "LastName", DataRowVersion.Proposed, data.LastName.DBValue));
            }
            if (!oldData.EmployeeTitle.Equals(data.EmployeeTitle))
            {
                cmd.Parameters.Add(new SqlParameter("@EmployeeTitle", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "EmployeeTitle", DataRowVersion.Proposed, data.EmployeeTitle.DBValue));
            }
            if (!oldData.DepartmentName.Equals(data.DepartmentName))
            {
                cmd.Parameters.Add(new SqlParameter("@DepartmentName", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "DepartmentName", DataRowVersion.Proposed, data.DepartmentName.DBValue));
            }
            if (!oldData.LocationName.Equals(data.LocationName))
            {
                cmd.Parameters.Add(new SqlParameter("@LocationName", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "LocationName", DataRowVersion.Proposed, data.LocationName.DBValue));
            }
            if (!oldData.PhoneNumber.Equals(data.PhoneNumber))
            {
                cmd.Parameters.Add(new SqlParameter("@PhoneNumber", SqlDbType.VarChar, 15, ParameterDirection.Input, false, 0, 0, "PhoneNumber", DataRowVersion.Proposed, data.PhoneNumber.DBValue));
            }
            if (!oldData.PhoneDescription.Equals(data.PhoneDescription))
            {
                cmd.Parameters.Add(new SqlParameter("@PhoneDescription", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "PhoneDescription", DataRowVersion.Proposed, data.PhoneDescription.DBValue));
            }
            if (!oldData.Email.Equals(data.Email))
            {
                cmd.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar, 30, ParameterDirection.Input, false, 0, 0, "Email", DataRowVersion.Proposed, data.Email.DBValue));
            }
            if (!oldData.DateHired.Equals(data.DateHired))
            {
                cmd.Parameters.Add(new SqlParameter("@DateHired", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "DateHired", DataRowVersion.Proposed, data.DateHired.DBValue));
            }
            if (!oldData.DateTerminated.Equals(data.DateTerminated))
            {
                cmd.Parameters.Add(new SqlParameter("@DateTerminated", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "DateTerminated", DataRowVersion.Proposed, data.DateTerminated.DBValue));
            }
            if (!oldData.Manager.Equals(data.Manager))
            {
                cmd.Parameters.Add(new SqlParameter("@Manager", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "Manager", DataRowVersion.Proposed, data.Manager.DBValue));
            }
            if (!oldData.EmployeeNumber.Equals(data.EmployeeNumber))
            {
                cmd.Parameters.Add(new SqlParameter("@EmployeeNumber", SqlDbType.VarChar, 30, ParameterDirection.Input, false, 0, 0, "EmployeeNumber", DataRowVersion.Proposed, data.EmployeeNumber.DBValue));
            }
            if (!oldData.Style.Equals(data.Style))
            {
                cmd.Parameters.Add(new SqlParameter("@Style", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Style", DataRowVersion.Proposed, data.Style.DBValue));
            }
            if (!oldData.IsActive.Equals(data.IsActive))
            {
                cmd.Parameters.Add(new SqlParameter("@IsActive", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsActive", DataRowVersion.Proposed, !data.IsActive.IsValid ? data.IsActive.DBValue : data.IsActive.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.NTUserAccount.Equals(data.NTUserAccount))
            {
                cmd.Parameters.Add(new SqlParameter("@NTUserAccount", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "NTUserAccount", DataRowVersion.Proposed, data.NTUserAccount.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 28
0
        public static void Update(WebConfigData data)
        {
            // Create and execute the command
            WebConfigData oldData = Load(data.WebConfigID);
            string        sql     = "Update " + TABLE + " set ";

            if (!oldData.CreateDate.Equals(data.CreateDate))
            {
                sql = sql + "CreateDate=@CreateDate,";
            }
            if (!oldData.LeftNavBGColor.Equals(data.LeftNavBGColor))
            {
                sql = sql + "LeftNavBGColor=@LeftNavBGColor,";
            }
            if (!oldData.HeaderTextColor.Equals(data.HeaderTextColor))
            {
                sql = sql + "HeaderTextColor=@HeaderTextColor,";
            }
            if (!oldData.MainPic.Equals(data.MainPic))
            {
                sql = sql + "MainPic=@MainPic,";
            }
            if (!oldData.LeftNavPic.Equals(data.LeftNavPic))
            {
                sql = sql + "LeftNavPic=@LeftNavPic,";
            }
            if (!oldData.Active.Equals(data.Active))
            {
                sql = sql + "Active=@Active,";
            }
            WhereClause w = new WhereClause();

            w.And("WebConfigID", data.WebConfigID.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTERNET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.WebConfigID.Equals(data.WebConfigID))
            {
                cmd.Parameters.Add(new SqlParameter("@WebConfigID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "WebConfigID", DataRowVersion.Proposed, data.WebConfigID.DBValue));
            }
            if (!oldData.CreateDate.Equals(data.CreateDate))
            {
                cmd.Parameters.Add(new SqlParameter("@CreateDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "CreateDate", DataRowVersion.Proposed, data.CreateDate.DBValue));
            }
            if (!oldData.LeftNavBGColor.Equals(data.LeftNavBGColor))
            {
                cmd.Parameters.Add(new SqlParameter("@LeftNavBGColor", SqlDbType.NVarChar, 12, ParameterDirection.Input, false, 0, 0, "LeftNavBGColor", DataRowVersion.Proposed, data.LeftNavBGColor.DBValue));
            }
            if (!oldData.HeaderTextColor.Equals(data.HeaderTextColor))
            {
                cmd.Parameters.Add(new SqlParameter("@HeaderTextColor", SqlDbType.NVarChar, 12, ParameterDirection.Input, false, 0, 0, "HeaderTextColor", DataRowVersion.Proposed, data.HeaderTextColor.DBValue));
            }
            if (!oldData.MainPic.Equals(data.MainPic))
            {
                cmd.Parameters.Add(new SqlParameter("@MainPic", SqlDbType.NVarChar, 100, ParameterDirection.Input, false, 0, 0, "MainPic", DataRowVersion.Proposed, data.MainPic.DBValue));
            }
            if (!oldData.LeftNavPic.Equals(data.LeftNavPic))
            {
                cmd.Parameters.Add(new SqlParameter("@LeftNavPic", SqlDbType.NVarChar, 100, ParameterDirection.Input, false, 0, 0, "LeftNavPic", DataRowVersion.Proposed, data.LeftNavPic.DBValue));
            }
            if (!oldData.Active.Equals(data.Active))
            {
                cmd.Parameters.Add(new SqlParameter("@Active", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "Active", DataRowVersion.Proposed, !data.Active.IsValid ? data.Active.DBValue : data.Active.DBValue.Equals("Y") ? 1 : 0));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        public static void Update(NewsArticlesData data)
        {
            // Create and execute the command
            NewsArticlesData oldData = Load(data.NewsArticlesID);
            string           sql     = "Update " + TABLE + " set ";

            if (!oldData.OrgGroupsID.Equals(data.OrgGroupsID))
            {
                sql = sql + "OrgGroupsID=@OrgGroupsID,";
            }
            if (!oldData.Title.Equals(data.Title))
            {
                sql = sql + "Title=@Title,";
            }
            if (!oldData.Summary.Equals(data.Summary))
            {
                sql = sql + "Summary=@Summary,";
            }
            if (!oldData.Text.Equals(data.Text))
            {
                sql = sql + "Text=@Text,";
            }
            if (!oldData.DateCreated.Equals(data.DateCreated))
            {
                sql = sql + "DateCreated=@DateCreated,";
            }
            if (!oldData.DateModified.Equals(data.DateModified))
            {
                sql = sql + "DateModified=@DateModified,";
            }
            if (!oldData.DateStart.Equals(data.DateStart))
            {
                sql = sql + "DateStart=@DateStart,";
            }
            if (!oldData.DateEnd.Equals(data.DateEnd))
            {
                sql = sql + "DateEnd=@DateEnd,";
            }
            if (!oldData.OrgEmployeesID.Equals(data.OrgEmployeesID))
            {
                sql = sql + "OrgEmployeesID=@OrgEmployeesID,";
            }
            if (!oldData.IsArchived.Equals(data.IsArchived))
            {
                sql = sql + "IsArchived=@IsArchived,";
            }
            if (!oldData.AllowDiscussion.Equals(data.AllowDiscussion))
            {
                sql = sql + "AllowDiscussion=@AllowDiscussion,";
            }
            if (!oldData.IsNew.Equals(data.IsNew))
            {
                sql = sql + "IsNew=@IsNew,";
            }
            if (!oldData.IsPublic.Equals(data.IsPublic))
            {
                sql = sql + "IsPublic=@IsPublic,";
            }
            if (!oldData.LastModifiedOrgEmployeesID.Equals(data.LastModifiedOrgEmployeesID))
            {
                sql = sql + "LastModifiedOrgEmployeesID=@LastModifiedOrgEmployeesID,";
            }
            if (!oldData.NewsImage.Equals(data.NewsImage))
            {
                sql = sql + "NewsImage=@NewsImage,";
            }
            if (!oldData.TemplateType.Equals(data.TemplateType))
            {
                sql = sql + "TemplateType=@TemplateType,";
            }
            WhereClause w = new WhereClause();

            w.And("NewsArticlesID", data.NewsArticlesID.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.NewsArticlesID.Equals(data.NewsArticlesID))
            {
                cmd.Parameters.Add(new SqlParameter("@NewsArticlesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "NewsArticlesID", DataRowVersion.Proposed, data.NewsArticlesID.DBValue));
            }
            if (!oldData.OrgGroupsID.Equals(data.OrgGroupsID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgGroupsID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgGroupsID", DataRowVersion.Proposed, data.OrgGroupsID.DBValue));
            }
            if (!oldData.Title.Equals(data.Title))
            {
                cmd.Parameters.Add(new SqlParameter("@Title", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "Title", DataRowVersion.Proposed, data.Title.DBValue));
            }
            if (!oldData.Summary.Equals(data.Summary))
            {
                cmd.Parameters.Add(new SqlParameter("@Summary", SqlDbType.VarChar, 500, ParameterDirection.Input, false, 0, 0, "Summary", DataRowVersion.Proposed, data.Summary.DBValue));
            }
            if (!oldData.Text.Equals(data.Text))
            {
                cmd.Parameters.Add(new SqlParameter("@Text", SqlDbType.Text, 0, ParameterDirection.Input, false, 0, 0, "Text", DataRowVersion.Proposed, data.Text.DBValue));
            }
            if (!oldData.DateCreated.Equals(data.DateCreated))
            {
                cmd.Parameters.Add(new SqlParameter("@DateCreated", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "DateCreated", DataRowVersion.Proposed, data.DateCreated.DBValue));
            }
            if (!oldData.DateModified.Equals(data.DateModified))
            {
                cmd.Parameters.Add(new SqlParameter("@DateModified", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "DateModified", DataRowVersion.Proposed, data.DateModified.DBValue));
            }
            if (!oldData.DateStart.Equals(data.DateStart))
            {
                cmd.Parameters.Add(new SqlParameter("@DateStart", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "DateStart", DataRowVersion.Proposed, data.DateStart.DBValue));
            }
            if (!oldData.DateEnd.Equals(data.DateEnd))
            {
                cmd.Parameters.Add(new SqlParameter("@DateEnd", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "DateEnd", DataRowVersion.Proposed, data.DateEnd.DBValue));
            }
            if (!oldData.OrgEmployeesID.Equals(data.OrgEmployeesID))
            {
                cmd.Parameters.Add(new SqlParameter("@OrgEmployeesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrgEmployeesID", DataRowVersion.Proposed, data.OrgEmployeesID.DBValue));
            }
            if (!oldData.IsArchived.Equals(data.IsArchived))
            {
                cmd.Parameters.Add(new SqlParameter("@IsArchived", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsArchived", DataRowVersion.Proposed, !data.IsArchived.IsValid ? data.IsArchived.DBValue : data.IsArchived.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.AllowDiscussion.Equals(data.AllowDiscussion))
            {
                cmd.Parameters.Add(new SqlParameter("@AllowDiscussion", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "AllowDiscussion", DataRowVersion.Proposed, !data.AllowDiscussion.IsValid ? data.AllowDiscussion.DBValue : data.AllowDiscussion.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.IsNew.Equals(data.IsNew))
            {
                cmd.Parameters.Add(new SqlParameter("@IsNew", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsNew", DataRowVersion.Proposed, !data.IsNew.IsValid ? data.IsNew.DBValue : data.IsNew.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.IsPublic.Equals(data.IsPublic))
            {
                cmd.Parameters.Add(new SqlParameter("@IsPublic", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "IsPublic", DataRowVersion.Proposed, !data.IsPublic.IsValid ? data.IsPublic.DBValue : data.IsPublic.DBValue.Equals("Y") ? 1 : 0));
            }
            if (!oldData.LastModifiedOrgEmployeesID.Equals(data.LastModifiedOrgEmployeesID))
            {
                cmd.Parameters.Add(new SqlParameter("@LastModifiedOrgEmployeesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "LastModifiedOrgEmployeesID", DataRowVersion.Proposed, data.LastModifiedOrgEmployeesID.DBValue));
            }
            if (!oldData.NewsImage.Equals(data.NewsImage))
            {
                cmd.Parameters.Add(new SqlParameter("@NewsImage", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "NewsImage", DataRowVersion.Proposed, data.NewsImage.DBValue));
            }
            if (!oldData.TemplateType.Equals(data.TemplateType))
            {
                cmd.Parameters.Add(new SqlParameter("@TemplateType", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "TemplateType", DataRowVersion.Proposed, data.TemplateType.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
        public static void Update(KnowledgebasesArticleTextData data)
        {
            // Create and execute the command
            KnowledgebasesArticleTextData oldData = Load(data.KnowledgebasesArticlesTextID);
            string sql = "Update " + TABLE + " set ";

            if (!oldData.KnowledgebasesSectionsArticlesID.Equals(data.KnowledgebasesSectionsArticlesID))
            {
                sql = sql + "KnowledgebasesSectionsArticlesID=@KnowledgebasesSectionsArticlesID,";
            }
            if (!oldData.KnowledgebasesID.Equals(data.KnowledgebasesID))
            {
                sql = sql + "KnowledgebasesID=@KnowledgebasesID,";
            }
            if (!oldData.Text.Equals(data.Text))
            {
                sql = sql + "Text=@Text,";
            }
            if (!oldData.StartDate.Equals(data.StartDate))
            {
                sql = sql + "StartDate=@StartDate,";
            }
            if (!oldData.EndDate.Equals(data.EndDate))
            {
                sql = sql + "EndDate=@EndDate,";
            }
            if (!oldData.Keywords.Equals(data.Keywords))
            {
                sql = sql + "Keywords=@Keywords,";
            }
            WhereClause w = new WhereClause();

            w.And("KnowledgebasesArticlesTextID", data.KnowledgebasesArticlesTextID.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.INTRANET, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.KnowledgebasesArticlesTextID.Equals(data.KnowledgebasesArticlesTextID))
            {
                cmd.Parameters.Add(new SqlParameter("@KnowledgebasesArticlesTextID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "KnowledgebasesArticlesTextID", DataRowVersion.Proposed, data.KnowledgebasesArticlesTextID.DBValue));
            }
            if (!oldData.KnowledgebasesSectionsArticlesID.Equals(data.KnowledgebasesSectionsArticlesID))
            {
                cmd.Parameters.Add(new SqlParameter("@KnowledgebasesSectionsArticlesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "KnowledgebasesSectionsArticlesID", DataRowVersion.Proposed, data.KnowledgebasesSectionsArticlesID.DBValue));
            }
            if (!oldData.KnowledgebasesID.Equals(data.KnowledgebasesID))
            {
                cmd.Parameters.Add(new SqlParameter("@KnowledgebasesID", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "KnowledgebasesID", DataRowVersion.Proposed, data.KnowledgebasesID.DBValue));
            }
            if (!oldData.Text.Equals(data.Text))
            {
                cmd.Parameters.Add(new SqlParameter("@Text", SqlDbType.Text, 0, ParameterDirection.Input, false, 0, 0, "Text", DataRowVersion.Proposed, data.Text.DBValue));
            }
            if (!oldData.StartDate.Equals(data.StartDate))
            {
                cmd.Parameters.Add(new SqlParameter("@StartDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "StartDate", DataRowVersion.Proposed, data.StartDate.DBValue));
            }
            if (!oldData.EndDate.Equals(data.EndDate))
            {
                cmd.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "EndDate", DataRowVersion.Proposed, data.EndDate.DBValue));
            }
            if (!oldData.Keywords.Equals(data.Keywords))
            {
                cmd.Parameters.Add(new SqlParameter("@Keywords", SqlDbType.VarChar, 300, ParameterDirection.Input, false, 0, 0, "Keywords", DataRowVersion.Proposed, data.Keywords.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }