예제 #1
0
        public static int Insert(SchoolCrosswalk o)
        {
            SqlParameter[] arrParams = new SqlParameter[19];

            arrParams[0] = new SqlParameter("@SchoolID", GlobalUtilities.DBSafeValue(o.SchoolID, o.SchoolID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@SchTypeID", GlobalUtilities.DBSafeValue(o.SchTypeID, o.SchTypeID.GetTypeCode()));
            arrParams[2] = new SqlParameter("@DistrictID", GlobalUtilities.DBSafeValue(o.DistrictID, o.DistrictID.GetTypeCode()));
            arrParams[3] = new SqlParameter("@City", GlobalUtilities.DBSafeValue(o.City, o.City.GetTypeCode()));
            arrParams[4] = new SqlParameter("@MinGrade", GlobalUtilities.DBSafeValue(o.MinGrade, o.MinGrade.GetTypeCode()));
            arrParams[5] = new SqlParameter("@MaxGrade", GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode()));
            arrParams[6] = new SqlParameter("@MinAge", GlobalUtilities.DBSafeValue(o.MinAge, o.MinAge.GetTypeCode()));
            arrParams[7] = new SqlParameter("@MaxAge", GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode()));

            arrParams[8]  = new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()));
            arrParams[9]  = new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()));
            arrParams[10] = new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()));
            arrParams[11] = new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()));
            arrParams[12] = new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()));
            arrParams[13] = new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()));
            arrParams[14] = new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()));
            arrParams[15] = new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()));
            arrParams[16] = new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()));
            arrParams[17] = new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()));

            arrParams[18]           = new SqlParameter("@ID", GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode()));
            arrParams[18].Direction = ParameterDirection.Output;

            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Insert", arrParams);

            o.ID = int.Parse(arrParams[18].Value.ToString());

            return(o.ID);
        }
예제 #2
0
        public static int Update(Event o)
        {
            int iReturn   = -1; //assume the worst
            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@EID", GlobalUtilities.DBSafeValue(o.EID, o.EID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventTitle", GlobalUtilities.DBSafeValue(o.EventTitle, o.EventTitle.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventDate", GlobalUtilities.DBSafeValue(o.EventDate, o.EventDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventTime", GlobalUtilities.DBSafeValue(o.EventTime, o.EventTime.GetTypeCode())));
            string html = o.HTML;

            if (!string.IsNullOrWhiteSpace(html) && html.EndsWith(TrailingBr))
            {
                html = html.Substring(0, html.Length - TrailingBr.Length);
            }
            arrParams.Add(new SqlParameter("@HTML", GlobalUtilities.DBSafeValue(html, html.GetTypeCode())));
            arrParams.Add(new SqlParameter("@SecretCode", GlobalUtilities.DBSafeValue(o.SecretCode, o.SecretCode.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NumberPoints", GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgeID", GlobalUtilities.DBSafeValue(o.BadgeID, o.BadgeID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BranchID", GlobalUtilities.DBSafeValue(o.BranchID, o.BranchID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom1", GlobalUtilities.DBSafeValue(o.Custom1, o.Custom1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom2", GlobalUtilities.DBSafeValue(o.Custom2, o.Custom2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom3", GlobalUtilities.DBSafeValue(o.Custom3, o.Custom3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            arrParams.Add(new SqlParameter("@ShortDescription", GlobalUtilities.DBSafeValue(o.ShortDescription, o.ShortDescription.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndDate", GlobalUtilities.DBSafeValue(o.EndDate, o.EndDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndTime", GlobalUtilities.DBSafeValue(o.EndTime, o.EndTime.GetTypeCode())));

            arrParams.Add(new SqlParameter("@ExternalLinkToEvent", GlobalUtilities.DBSafeValue(o.ExternalLinkToEvent, o.ExternalLinkToEvent.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HiddenFromPublic", GlobalUtilities.DBSafeValue(o.HiddenFromPublic, o.HiddenFromPublic.GetTypeCode())));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Event_Update", arrParams.ToArray());
            }
            catch (SqlException exx)
            {
                "GRA.SRP.DAL.Event".Log().Error("Error updating Event: {0} - {1}",
                                                exx.Message,
                                                exx.StackTrace);
                System.Diagnostics.Debug.Write(exx.Message);
            }

            return(iReturn);
        }
예제 #3
0
        public static int Update(Codes o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[14];

            arrParams[0] = new SqlParameter("@CID", GlobalUtilities.DBSafeValue(o.CID, o.CID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@CTID", GlobalUtilities.DBSafeValue(o.CTID, o.CTID.GetTypeCode()));
            arrParams[2] = new SqlParameter("@Code", GlobalUtilities.DBSafeValue(o.Code, o.Code.GetTypeCode()));
            arrParams[3] = new SqlParameter("@Description", GlobalUtilities.DBSafeValue(o.Description, o.Description.GetTypeCode()));

            arrParams[4]  = new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()));
            arrParams[5]  = new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()));
            arrParams[6]  = new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()));
            arrParams[7]  = new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()));
            arrParams[8]  = new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()));
            arrParams[9]  = new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()));
            arrParams[10] = new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()));
            arrParams[11] = new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()));
            arrParams[12] = new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()));
            arrParams[13] = new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Code_Update", arrParams);
            }

            catch (SqlException exx)
            {
                System.Diagnostics.Debug.Write(exx.Message);
            }

            return(iReturn);
        }
예제 #4
0
        public static int Insert(Codes o)
        {
            SqlParameter[] arrParams = new SqlParameter[14];

            arrParams[0]  = new SqlParameter("@CTID", GlobalUtilities.DBSafeValue(o.CTID, o.CTID.GetTypeCode()));
            arrParams[1]  = new SqlParameter("@Code", GlobalUtilities.DBSafeValue(o.Code, o.Code.GetTypeCode()));
            arrParams[2]  = new SqlParameter("@Description", GlobalUtilities.DBSafeValue(o.Description, o.Description.GetTypeCode()));
            arrParams[3]  = new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()));
            arrParams[4]  = new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()));
            arrParams[5]  = new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()));
            arrParams[6]  = new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()));
            arrParams[7]  = new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()));
            arrParams[8]  = new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()));
            arrParams[9]  = new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()));
            arrParams[10] = new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()));
            arrParams[11] = new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()));
            arrParams[12] = new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()));

            arrParams[13]           = new SqlParameter("@CID", GlobalUtilities.DBSafeValue(o.CID, o.CID.GetTypeCode()));
            arrParams[13].Direction = ParameterDirection.Output;

            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Code_Insert", arrParams);

            o.CID = int.Parse(arrParams[13].Value.ToString());

            return(o.CID);
        }
예제 #5
0
        public static void TenantInitialize(int src, int dst)
        {
            SqlParameter[] arrParams = new SqlParameter[2];

            arrParams[0] = new SqlParameter("@src", GlobalUtilities.DBSafeValue(src, src.GetTypeCode()));
            arrParams[1] = new SqlParameter("@dst", GlobalUtilities.DBSafeValue(dst, dst.GetTypeCode()));
            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Event_InitTenant", arrParams);
        }
예제 #6
0
        public static int Insert(Event o)
        {
            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@EventTitle", GlobalUtilities.DBSafeValue(o.EventTitle, o.EventTitle.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventDate", GlobalUtilities.DBSafeValue(o.EventDate, o.EventDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EventTime", GlobalUtilities.DBSafeValue(o.EventTime, o.EventTime.GetTypeCode())));

            string html = o.HTML;

            if (!string.IsNullOrWhiteSpace(html) && html.EndsWith(TrailingBr))
            {
                html = html.Substring(0, html.Length - TrailingBr.Length);
            }

            arrParams.Add(new SqlParameter("@HTML", GlobalUtilities.DBSafeValue(html, html.GetTypeCode())));
            arrParams.Add(new SqlParameter("@SecretCode", GlobalUtilities.DBSafeValue(o.SecretCode, o.SecretCode.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NumberPoints", GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgeID", GlobalUtilities.DBSafeValue(o.BadgeID, o.BadgeID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BranchID", GlobalUtilities.DBSafeValue(o.BranchID, o.BranchID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom1", GlobalUtilities.DBSafeValue(o.Custom1, o.Custom1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom2", GlobalUtilities.DBSafeValue(o.Custom2, o.Custom2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Custom3", GlobalUtilities.DBSafeValue(o.Custom3, o.Custom3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            arrParams.Add(new SqlParameter("@ShortDescription", GlobalUtilities.DBSafeValue(o.ShortDescription, o.ShortDescription.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndDate", GlobalUtilities.DBSafeValue(o.EndDate, o.EndDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndTime", GlobalUtilities.DBSafeValue(o.EndTime, o.EndTime.GetTypeCode())));

            arrParams.Add(new SqlParameter("@ExternalLinkToEvent", GlobalUtilities.DBSafeValue(o.ExternalLinkToEvent, o.ExternalLinkToEvent.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HiddenFromPublic", GlobalUtilities.DBSafeValue(o.HiddenFromPublic, o.HiddenFromPublic.GetTypeCode())));

            var param = new SqlParameter("@EID", GlobalUtilities.DBSafeValue(o.EID, o.EID.GetTypeCode()));

            param.Direction = ParameterDirection.Output;
            arrParams.Add(param);

            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Event_Insert", arrParams.ToArray());

            o.EID = int.Parse(param.Value.ToString());

            return(o.EID);
        }
예제 #7
0
        public static int Update(Badge o)
        {
            int iReturn = -1; //assume the worst

            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@BID", GlobalUtilities.DBSafeValue(o.BID, o.BID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AdminName", GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@UserName", GlobalUtilities.DBSafeValue(o.UserName, o.UserName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GenNotificationFlag", GlobalUtilities.DBSafeValue(o.GenNotificationFlag, o.GenNotificationFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NotificationSubject", GlobalUtilities.DBSafeValue(o.NotificationSubject, o.NotificationSubject.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NotificationBody", GlobalUtilities.DBSafeValue(o.NotificationBody, o.NotificationBody.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HideDefaultDescriptionFlag", GlobalUtilities.DBSafeValue(o.HideDefaultDescriptionFlag, o.HideDefaultDescriptionFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@CustomDescription", GlobalUtilities.DBSafeValue(o.CustomDescription, o.CustomDescription.GetTypeCode())));
            arrParams.Add(new SqlParameter("@CustomEarnedMessage", GlobalUtilities.DBSafeValue(o.CustomEarnedMessage, o.CustomEarnedMessage.GetTypeCode())));
            arrParams.Add(new SqlParameter("@IncludesPhysicalPrizeFlag", GlobalUtilities.DBSafeValue(o.IncludesPhysicalPrizeFlag, o.IncludesPhysicalPrizeFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PhysicalPrizeName", GlobalUtilities.DBSafeValue(o.PhysicalPrizeName, o.PhysicalPrizeName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AssignProgramPrizeCode", GlobalUtilities.DBSafeValue(o.AssignProgramPrizeCode, o.AssignProgramPrizeCode.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PCNotificationSubject", GlobalUtilities.DBSafeValue(o.PCNotificationSubject, o.PCNotificationSubject.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PCNotificationBody", GlobalUtilities.DBSafeValue(o.PCNotificationBody, o.PCNotificationBody.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            arrParams.Add(new SqlParameter("@HiddenFromPublic", GlobalUtilities.DBSafeValue(o.HiddenFromPublic, o.HiddenFromPublic.GetTypeCode())));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Badge_Update", arrParams.ToArray());
            }

            catch (SqlException exx)
            {
                "GRA.SRP.DAL.Badge".Log().Error("Error updating Badge: {0} - {1}",
                                                exx.Message,
                                                exx.StackTrace);

                System.Diagnostics.Debug.Write(exx.Message);
            }

            return(iReturn);
        }
예제 #8
0
 public static DataSet GetBadgeLocations(int BID)
 {
     SqlParameter[] arrParams = new SqlParameter[2];
     arrParams[0] = new SqlParameter("@BID", GlobalUtilities.DBSafeValue(BID, BID.GetTypeCode()));
     arrParams[1] = new SqlParameter("@TenID",
                                     (HttpContext.Current.Session["TenantID"] == null || HttpContext.Current.Session["TenantID"].ToString() == "" ?
                                      -1 :
                                      (int)HttpContext.Current.Session["TenantID"])
                                     );
     return(SqlHelper.ExecuteDataset(conn, CommandType.StoredProcedure, "app_Badge_GetBadgeLocations", arrParams));
 }
예제 #9
0
 public static void UpdateBadgeLocations(int BID, string checkedMembers)
 {
     SqlParameter[] arrParams = new SqlParameter[3];
     arrParams[0] = new SqlParameter("@BID", GlobalUtilities.DBSafeValue(BID, BID.GetTypeCode()));
     arrParams[1] = new SqlParameter("@TenID",
                                     (HttpContext.Current.Session["TenantID"] == null || HttpContext.Current.Session["TenantID"].ToString() == "" ?
                                      -1 :
                                      (int)HttpContext.Current.Session["TenantID"])
                                     );
     arrParams[2] = new SqlParameter("@CID_LIST", checkedMembers);
     SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Badge_UpdateBadgeLocations", arrParams);
 }
예제 #10
0
        public static int Update(Award o)
        {
            int iReturn = -1; //assume the worst

            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@AID", GlobalUtilities.DBSafeValue(o.AID, o.AID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AwardName", GlobalUtilities.DBSafeValue(o.AwardName, o.AwardName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgeID", GlobalUtilities.DBSafeValue(o.BadgeID, o.BadgeID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NumPoints", GlobalUtilities.DBSafeValue(o.NumPoints, o.NumPoints.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BranchID", GlobalUtilities.DBSafeValue(o.BranchID, o.BranchID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@ProgramID", GlobalUtilities.DBSafeValue(o.ProgramID, o.ProgramID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@District", GlobalUtilities.DBSafeValue(o.District, o.District.GetTypeCode())));
            arrParams.Add(new SqlParameter("@SchoolName", GlobalUtilities.DBSafeValue(o.SchoolName, o.SchoolName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgesAchieved", GlobalUtilities.DBSafeValue(o.BadgesAchieved, o.BadgesAchieved.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgeList", GlobalUtilities.DBSafeValue(o.BadgeList, o.BadgeList.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalPercent", GlobalUtilities.DBSafeValue(o.GoalPercent, o.GoalPercent.GetTypeCode())));


            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn,
                                                    CommandType.StoredProcedure,
                                                    "app_Award_Update",
                                                    arrParams.ToArray());
            }

            catch (SqlException exx)
            {
                "Award".Log().Debug("An error occurred updating Award id {0}: {1} - {2}",
                                    o.AID,
                                    exx.Message,
                                    exx.StackTrace);
            }

            return(iReturn);
        }
예제 #11
0
        public static int Insert(Award o)
        {
            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@AwardName", GlobalUtilities.DBSafeValue(o.AwardName, o.AwardName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgeID", GlobalUtilities.DBSafeValue(o.BadgeID, o.BadgeID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NumPoints", GlobalUtilities.DBSafeValue(o.NumPoints, o.NumPoints.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BranchID", GlobalUtilities.DBSafeValue(o.BranchID, o.BranchID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@ProgramID", GlobalUtilities.DBSafeValue(o.ProgramID, o.ProgramID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@District", GlobalUtilities.DBSafeValue(o.District, o.District.GetTypeCode())));
            arrParams.Add(new SqlParameter("@SchoolName", GlobalUtilities.DBSafeValue(o.SchoolName, o.SchoolName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgeList", GlobalUtilities.DBSafeValue(o.BadgeList, o.BadgeList.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BadgesAchieved", GlobalUtilities.DBSafeValue(o.BadgesAchieved, o.BadgesAchieved.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalPercent", GlobalUtilities.DBSafeValue(o.GoalPercent, o.GoalPercent.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            var outputParam = new SqlParameter("@AID", GlobalUtilities.DBSafeValue(o.AID, o.AID.GetTypeCode()));

            outputParam.Direction = ParameterDirection.Output;
            arrParams.Add(outputParam);

            SqlHelper.ExecuteNonQuery(conn,
                                      CommandType.StoredProcedure,
                                      "app_Award_Insert",
                                      arrParams.ToArray());

            o.AID = int.Parse(outputParam.Value.ToString());

            return(o.AID);
        }
예제 #12
0
        public static int Insert(Badge o)
        {
            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@AdminName", GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@UserName", GlobalUtilities.DBSafeValue(o.UserName, o.UserName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GenNotificationFlag", GlobalUtilities.DBSafeValue(o.GenNotificationFlag, o.GenNotificationFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NotificationSubject", GlobalUtilities.DBSafeValue(o.NotificationSubject, o.NotificationSubject.GetTypeCode())));
            arrParams.Add(new SqlParameter("@NotificationBody", GlobalUtilities.DBSafeValue(o.NotificationBody, o.NotificationBody.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HideDefaultDescriptionFlag", GlobalUtilities.DBSafeValue(o.HideDefaultDescriptionFlag, o.HideDefaultDescriptionFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@CustomDescription", GlobalUtilities.DBSafeValue(o.CustomDescription, o.CustomDescription.GetTypeCode())));
            arrParams.Add(new SqlParameter("@CustomEarnedMessage", GlobalUtilities.DBSafeValue(o.CustomEarnedMessage, o.CustomEarnedMessage.GetTypeCode())));
            arrParams.Add(new SqlParameter("@IncludesPhysicalPrizeFlag", GlobalUtilities.DBSafeValue(o.IncludesPhysicalPrizeFlag, o.IncludesPhysicalPrizeFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PhysicalPrizeName", GlobalUtilities.DBSafeValue(o.PhysicalPrizeName, o.PhysicalPrizeName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AssignProgramPrizeCode", GlobalUtilities.DBSafeValue(o.AssignProgramPrizeCode, o.AssignProgramPrizeCode.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PCNotificationSubject", GlobalUtilities.DBSafeValue(o.PCNotificationSubject, o.PCNotificationSubject.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PCNotificationBody", GlobalUtilities.DBSafeValue(o.PCNotificationBody, o.PCNotificationBody.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            arrParams.Add(new SqlParameter("@HiddenFromPublic", GlobalUtilities.DBSafeValue(o.HiddenFromPublic, o.HiddenFromPublic.GetTypeCode())));

            var param = new SqlParameter("@BID", GlobalUtilities.DBSafeValue(o.BID, o.BID.GetTypeCode()));

            param.Direction = ParameterDirection.Output;
            arrParams.Add(param);

            SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Badge_Insert", arrParams.ToArray());
            o.BID = int.Parse(param.Value.ToString());
            return(o.BID);
        }
        public static int Delete(LibraryCrosswalk o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[1];

            arrParams[0] = new SqlParameter("@ID", GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode()));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_LibraryCrosswalk_Delete", arrParams);
            }

            catch (SqlException exx)
            {
                System.Diagnostics.Debug.Write(exx.Message);
            }

            return(iReturn);
        }
예제 #14
0
        public static int Delete(Event o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[1];
            arrParams[0] = new SqlParameter("@EID", GlobalUtilities.DBSafeValue(o.EID, o.EID.GetTypeCode()));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Event_Delete", arrParams);
            }
            catch (SqlException exx)
            {
                "GRA.SRP.DAL.Event".Log().Error("Error deleting Event: {0} - {1}",
                    exx.Message,
                    exx.StackTrace);
                System.Diagnostics.Debug.Write(exx.Message);
            }

            return iReturn;
        }
        public static int Update(SchoolCrosswalk o)
        {
            int iReturn = -1; //assume the worst

            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@ID", GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@SchoolID", GlobalUtilities.DBSafeValue(o.SchoolID, o.SchoolID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@SchTypeID", GlobalUtilities.DBSafeValue(o.SchTypeID, o.SchTypeID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@DistrictID", GlobalUtilities.DBSafeValue(o.DistrictID, o.DistrictID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@City", GlobalUtilities.DBSafeValue(o.City, o.City.GetTypeCode())));
            arrParams.Add(new SqlParameter("@MinGrade", GlobalUtilities.DBSafeValue(o.MinGrade, o.MinGrade.GetTypeCode())));
            arrParams.Add(new SqlParameter("@MaxGrade", GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode())));
            arrParams.Add(new SqlParameter("@MinAge", GlobalUtilities.DBSafeValue(o.MinAge, o.MinAge.GetTypeCode())));
            arrParams.Add(new SqlParameter("@MaxAge", GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode())));
            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Update", arrParams.ToArray());
            }

            catch (SqlException exx)
            {
                System.Diagnostics.Debug.Write(exx.Message);
            }

            return(iReturn);
        }
예제 #16
0
        public static int Delete(Award o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[1];

            arrParams[0] = new SqlParameter("@AID", GlobalUtilities.DBSafeValue(o.AID, o.AID.GetTypeCode()));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Award_Delete", arrParams);
            }

            catch (SqlException exx)
            {
                "Award".Log().Debug("An error occurred deleting Award id {0}: {1} - {2}",
                                    o.AID,
                                    exx.Message,
                                    exx.StackTrace);
            }

            return(iReturn);
        }
예제 #17
0
        public static int Insert(Programs o)
        {
            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@AdminName", GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Title", GlobalUtilities.DBSafeValue(o.Title, o.Title.GetTypeCode())));
            arrParams.Add(new SqlParameter("@TabName", GlobalUtilities.DBSafeValue(o.TabName, o.TabName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@POrder", GlobalUtilities.DBSafeValue(o.POrder, o.POrder.GetTypeCode())));
            arrParams.Add(new SqlParameter("@IsActive", GlobalUtilities.DBSafeValue(o.IsActive, o.IsActive.GetTypeCode())));
            arrParams.Add(new SqlParameter("@IsHidden", GlobalUtilities.DBSafeValue(o.IsHidden, o.IsHidden.GetTypeCode())));
            arrParams.Add(new SqlParameter("@StartDate", GlobalUtilities.DBSafeValue(o.StartDate, o.StartDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndDate", GlobalUtilities.DBSafeValue(o.EndDate, o.EndDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@MaxAge", GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode())));
            arrParams.Add(new SqlParameter("@MaxGrade", GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LoggingStart", GlobalUtilities.DBSafeValue(o.LoggingStart, o.LoggingStart.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LoggingEnd", GlobalUtilities.DBSafeValue(o.LoggingEnd, o.LoggingEnd.GetTypeCode())));
            arrParams.Add(new SqlParameter("@ParentalConsentFlag", GlobalUtilities.DBSafeValue(o.ParentalConsentFlag, o.ParentalConsentFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@ParentalConsentText", GlobalUtilities.DBSafeValue(o.ParentalConsentText, o.ParentalConsentText.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PatronReviewFlag", GlobalUtilities.DBSafeValue(o.PatronReviewFlag, o.PatronReviewFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@RequireBookDetails", GlobalUtilities.DBSafeValue(o.RequireBookDetails, o.RequireBookDetails.GetTypeCode())));

            arrParams.Add(new SqlParameter("@LogoutURL", GlobalUtilities.DBSafeValue(o.LogoutURL, o.LogoutURL.GetTypeCode())));
            arrParams.Add(new SqlParameter("@ProgramGameID", GlobalUtilities.DBSafeValue(o.ProgramGameID, o.ProgramGameID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML1", GlobalUtilities.DBSafeValue(o.HTML1, o.HTML1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML2", GlobalUtilities.DBSafeValue(o.HTML2, o.HTML2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML3", GlobalUtilities.DBSafeValue(o.HTML3, o.HTML3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML4", GlobalUtilities.DBSafeValue(o.HTML4, o.HTML4.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML5", GlobalUtilities.DBSafeValue(o.HTML5, o.HTML5.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML6", GlobalUtilities.DBSafeValue(o.HTML6, o.HTML6.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BannerImage", GlobalUtilities.DBSafeValue(o.BannerImage, o.BannerImage.GetTypeCode())));
            arrParams.Add(new SqlParameter("@RegistrationBadgeID", GlobalUtilities.DBSafeValue(o.RegistrationBadgeID, o.RegistrationBadgeID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@CompletionPoints", GlobalUtilities.DBSafeValue(o.CompletionPoints, o.CompletionPoints.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            arrParams.Add(new SqlParameter("@PreTestID", GlobalUtilities.DBSafeValue(o.PreTestID, o.PreTestID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PostTestID", GlobalUtilities.DBSafeValue(o.PostTestID, o.PostTestID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PreTestMandatory", GlobalUtilities.DBSafeValue(o.PreTestMandatory, o.PreTestMandatory.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PreTestEndDate", GlobalUtilities.DBSafeValue(o.PreTestEndDate, o.PreTestEndDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PostTestStartDate", GlobalUtilities.DBSafeValue(o.PostTestStartDate, o.PostTestStartDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalDefault", GlobalUtilities.DBSafeValue(o.GoalDefault, o.GoalDefault.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalMin", GlobalUtilities.DBSafeValue(o.GoalMin, o.GoalMin.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalMax", GlobalUtilities.DBSafeValue(o.GoalMax, o.GoalMax.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalIntervalId", GlobalUtilities.DBSafeValue(o.GoalIntervalId, o.GoalIntervalId.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HideSchoolInRegistration", GlobalUtilities.DBSafeValue(o.HideSchoolInRegistration, o.HideSchoolInRegistration.GetTypeCode())));
            arrParams.Add(new SqlParameter("@DisplayDailyImage", GlobalUtilities.DBSafeValue(o.DisplayDailyImage, o.DisplayDailyImage.GetTypeCode())));

            var newIdParam = new SqlParameter("@PID", GlobalUtilities.DBSafeValue(o.PID, o.PID.GetTypeCode()));

            newIdParam.Direction = ParameterDirection.Output;
            arrParams.Add(newIdParam);

            SqlHelper.ExecuteNonQuery(conn,
                                      CommandType.StoredProcedure,
                                      "app_Programs_Insert",
                                      arrParams.ToArray());

            o.PID = int.Parse(newIdParam.Value.ToString());

            return(o.PID);
        }
예제 #18
0
        public static int Update(Programs o)
        {
            int iReturn = -1; //assume the worst

            var arrParams = new List <SqlParameter>();

            arrParams.Add(new SqlParameter("@PID", GlobalUtilities.DBSafeValue(o.PID, o.PID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AdminName", GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@Title", GlobalUtilities.DBSafeValue(o.Title, o.Title.GetTypeCode())));
            arrParams.Add(new SqlParameter("@TabName", GlobalUtilities.DBSafeValue(o.TabName, o.TabName.GetTypeCode())));
            arrParams.Add(new SqlParameter("@POrder", GlobalUtilities.DBSafeValue(o.POrder, o.POrder.GetTypeCode())));
            arrParams.Add(new SqlParameter("@IsActive", GlobalUtilities.DBSafeValue(o.IsActive, o.IsActive.GetTypeCode())));
            arrParams.Add(new SqlParameter("@IsHidden", GlobalUtilities.DBSafeValue(o.IsHidden, o.IsHidden.GetTypeCode())));
            arrParams.Add(new SqlParameter("@StartDate", GlobalUtilities.DBSafeValue(o.StartDate, o.StartDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@EndDate", GlobalUtilities.DBSafeValue(o.EndDate, o.EndDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@MaxAge", GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode())));
            arrParams.Add(new SqlParameter("@MaxGrade", GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LoggingStart", GlobalUtilities.DBSafeValue(o.LoggingStart, o.LoggingStart.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LoggingEnd", GlobalUtilities.DBSafeValue(o.LoggingEnd, o.LoggingEnd.GetTypeCode())));
            arrParams.Add(new SqlParameter("@ParentalConsentFlag", GlobalUtilities.DBSafeValue(o.ParentalConsentFlag, o.ParentalConsentFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@ParentalConsentText", GlobalUtilities.DBSafeValue(o.ParentalConsentText, o.ParentalConsentText.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PatronReviewFlag", GlobalUtilities.DBSafeValue(o.PatronReviewFlag, o.PatronReviewFlag.GetTypeCode())));
            arrParams.Add(new SqlParameter("@RequireBookDetails", GlobalUtilities.DBSafeValue(o.RequireBookDetails, o.RequireBookDetails.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LogoutURL", GlobalUtilities.DBSafeValue(o.LogoutURL, o.LogoutURL.GetTypeCode())));
            arrParams.Add(new SqlParameter("@ProgramGameID", GlobalUtilities.DBSafeValue(o.ProgramGameID, o.ProgramGameID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML1", GlobalUtilities.DBSafeValue(o.HTML1, o.HTML1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML2", GlobalUtilities.DBSafeValue(o.HTML2, o.HTML2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML3", GlobalUtilities.DBSafeValue(o.HTML3, o.HTML3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML4", GlobalUtilities.DBSafeValue(o.HTML4, o.HTML4.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML5", GlobalUtilities.DBSafeValue(o.HTML5, o.HTML5.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HTML6", GlobalUtilities.DBSafeValue(o.HTML6, o.HTML6.GetTypeCode())));
            arrParams.Add(new SqlParameter("@BannerImage", GlobalUtilities.DBSafeValue(o.BannerImage, o.BannerImage.GetTypeCode())));
            arrParams.Add(new SqlParameter("@RegistrationBadgeID", GlobalUtilities.DBSafeValue(o.RegistrationBadgeID, o.RegistrationBadgeID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@CompletionPoints", GlobalUtilities.DBSafeValue(o.CompletionPoints, o.CompletionPoints.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModUser", GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedDate", GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@AddedUser", GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())));
            arrParams.Add(new SqlParameter("@LastModDate", GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())));

            arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())));
            arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())));

            arrParams.Add(new SqlParameter("@PreTestID", GlobalUtilities.DBSafeValue(o.PreTestID, o.PreTestID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PostTestID", GlobalUtilities.DBSafeValue(o.PostTestID, o.PostTestID.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PreTestMandatory", GlobalUtilities.DBSafeValue(o.PreTestMandatory, o.PreTestMandatory.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PreTestEndDate", GlobalUtilities.DBSafeValue(o.PreTestEndDate, o.PreTestEndDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@PostTestStartDate", GlobalUtilities.DBSafeValue(o.PostTestStartDate, o.PostTestStartDate.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalDefault", GlobalUtilities.DBSafeValue(o.GoalDefault, o.GoalDefault.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalMin", GlobalUtilities.DBSafeValue(o.GoalMin, o.GoalMin.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalMax", GlobalUtilities.DBSafeValue(o.GoalMax, o.GoalMax.GetTypeCode())));
            arrParams.Add(new SqlParameter("@GoalIntervalId", GlobalUtilities.DBSafeValue(o.GoalIntervalId, o.GoalIntervalId.GetTypeCode())));
            arrParams.Add(new SqlParameter("@HideSchoolInRegistration", GlobalUtilities.DBSafeValue(o.HideSchoolInRegistration, o.HideSchoolInRegistration.GetTypeCode())));
            arrParams.Add(new SqlParameter("@DisplayDailyImage", GlobalUtilities.DBSafeValue(o.DisplayDailyImage, o.DisplayDailyImage.GetTypeCode())));

            try
            {
                iReturn = SqlHelper.ExecuteNonQuery(conn,
                                                    CommandType.StoredProcedure,
                                                    "app_Programs_Update",
                                                    arrParams.ToArray());
            }

            catch (SqlException exx)
            {
                System.Diagnostics.Debug.Write(exx.Message);
            }

            return(iReturn);
        }