コード例 #1
0
        public static int Update(MGWordMatch o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[10];

            arrParams[0] = new SqlParameter("@WMID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.WMID, o.WMID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[2] = new SqlParameter("@CorrectRoundsToWinCount", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.CorrectRoundsToWinCount, o.CorrectRoundsToWinCount.GetTypeCode()));
            arrParams[3] = new SqlParameter("@NumOptionsToChooseFrom", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumOptionsToChooseFrom, o.NumOptionsToChooseFrom.GetTypeCode()));
            arrParams[4] = new SqlParameter("@EnableMediumDifficulty", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.EnableMediumDifficulty, o.EnableMediumDifficulty.GetTypeCode()));
            arrParams[5] = new SqlParameter("@EnableHardDifficulty", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.EnableHardDifficulty, o.EnableHardDifficulty.GetTypeCode()));
            arrParams[6] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[7] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[8] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[9] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));

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

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

            return(iReturn);
        }
コード例 #2
0
        public static int Delete(MGWordMatch o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[1];

            arrParams[0] = new SqlParameter("@WMID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.WMID, o.WMID.GetTypeCode()));

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

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

            return(iReturn);
        }
コード例 #3
0
        public static int Insert(MGWordMatch o)
        {
            SqlParameter[] arrParams = new SqlParameter[10];

            arrParams[0]           = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[1]           = new SqlParameter("@CorrectRoundsToWinCount", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.CorrectRoundsToWinCount, o.CorrectRoundsToWinCount.GetTypeCode()));
            arrParams[2]           = new SqlParameter("@NumOptionsToChooseFrom", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumOptionsToChooseFrom, o.NumOptionsToChooseFrom.GetTypeCode()));
            arrParams[3]           = new SqlParameter("@EnableMediumDifficulty", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.EnableMediumDifficulty, o.EnableMediumDifficulty.GetTypeCode()));
            arrParams[4]           = new SqlParameter("@EnableHardDifficulty", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.EnableHardDifficulty, o.EnableHardDifficulty.GetTypeCode()));
            arrParams[5]           = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[6]           = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[7]           = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[8]           = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));
            arrParams[9]           = new SqlParameter("@WMID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.WMID, o.WMID.GetTypeCode()));
            arrParams[9].Direction = ParameterDirection.Output;

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

            o.WMID = int.Parse(arrParams[9].Value.ToString());

            return(o.WMID);
        }
コード例 #4
0
        public static int Insert(Minigame o)
        {

            SqlParameter[] arrParams = new SqlParameter[23];

            arrParams[0] = new SqlParameter("@MiniGameType", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameType, o.MiniGameType.GetTypeCode()));
            arrParams[1] = new SqlParameter("@MiniGameTypeName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameTypeName, o.MiniGameTypeName.GetTypeCode()));
            arrParams[2] = new SqlParameter("@AdminName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode()));
            arrParams[3] = new SqlParameter("@GameName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.GameName, o.GameName.GetTypeCode()));
            arrParams[4] = new SqlParameter("@isActive", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.isActive, o.isActive.GetTypeCode()));
            arrParams[5] = new SqlParameter("@NumberPoints", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode()));
            arrParams[6] = new SqlParameter("@AwardedBadgeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AwardedBadgeID, o.AwardedBadgeID.GetTypeCode()));
            arrParams[7] = new SqlParameter("@Acknowledgements", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Acknowledgements, o.Acknowledgements.GetTypeCode())); 
            arrParams[8] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[9] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[10] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[11] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));

            arrParams[12] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()));
            arrParams[13] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()));
            arrParams[14] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()));
            arrParams[15] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()));
            arrParams[16] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()));
            arrParams[17] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()));
            arrParams[18] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()));
            arrParams[19] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()));
            arrParams[20] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()));
            arrParams[21] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()));

            arrParams[22] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[22].Direction = ParameterDirection.Output;

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

            o.MGID = int.Parse(arrParams[22].Value.ToString());


            if (o.MiniGameType == 1)
            {
                var o2 = new MGOnlineBook {MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate,LastModUser = o.LastModUser };
                o2.Insert();
            }
            if (o.MiniGameType == 2)
            {
                var o2 = new MGMixAndMatch() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser };
                o2.Insert();
            }
            if (o.MiniGameType == 3)
            {
                var o2 = new MGCodeBreaker() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser };
                o2.Insert();
            }            
            
            if (o.MiniGameType == 4)
            {
                var o2 = new MGWordMatch() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser };
                o2.Insert();
            }


            if (o.MiniGameType == 5)
            {
                var o2 = new MGMatchingGame() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser };
                o2.Insert();
            }


            if (o.MiniGameType == 6)
            {
                var o2 = new MGHiddenPic() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser };
                o2.Insert();
            }


            if (o.MiniGameType == 7)
            {
                var o2 = new MGChooseAdv() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser };
                o2.Insert();
            }
            

            return o.MGID;

        }
コード例 #5
0
        protected void DvItemCommand(object sender, DetailsViewCommandEventArgs e)
        {
            string returnURL = "~/ControlRoom/Modules/Setup/MiniGameList.aspx";

            if (e.CommandName.ToLower() == "more")
            {
                Response.Redirect("~/ControlRoom/Modules/Setup/MGWordMatchItemsList.aspx");
            }

            if (e.CommandName.ToLower() == "preview")
            {
                Session["MGID"] = e.CommandArgument;
                int key = Convert.ToInt32(e.CommandArgument);
                var obj = Minigame.FetchObject(key);
                Session["CRGoToUrl"] = Minigame.GetEditPage(obj.MiniGameType) + "?PK=" + e.CommandArgument;
                Response.Redirect("~/ControlRoom/Modules/Setup/MinigamePreview.aspx?MGID=" + e.CommandArgument);
            }

            if (e.CommandName.ToLower() == "back")
            {
                Response.Redirect(returnURL);
            }
            if (e.CommandName.ToLower() == "refresh")
            {
                try
                {
                    odsData.DataBind();
                    dv.DataBind();
                    dv.ChangeMode(DetailsViewMode.Edit);

                    var masterPage = (IControlRoomMaster)Master;
                    if (masterPage != null) masterPage.PageMessage = SRPResources.RefreshOK;
                }
                catch (Exception ex)
                {
                    var masterPage = (IControlRoomMaster)Master;
                    masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                }
            }

            if (e.CommandName.ToLower() == "save" || e.CommandName.ToLower() == "saveandback")
            {
                try
                {
                    var obj = new MGWordMatch();
                    //int pk = int.Parse(((DetailsView)sender).Rows[0].Cells[1].Text);
                    int pk = int.Parse(((TextBox) ((DetailsView) sender).FindControl("WMID")).Text);
                    obj.Fetch(pk);

                    var obj2 = Minigame.FetchObject(obj.MGID);

                    obj2.AdminName = ((TextBox)((DetailsView)sender).FindControl("AdminName")).Text;
                    obj2.GameName = ((TextBox)((DetailsView)sender).FindControl("GameName")).Text;
                    obj2.isActive = ((CheckBox)((DetailsView)sender).FindControl("isActive")).Checked;
                    obj2.NumberPoints = FormatHelper.SafeToInt(((TextBox)((DetailsView)sender).FindControl("NumberPoints")).Text);
                    obj2.AwardedBadgeID = FormatHelper.SafeToInt(((DropDownList)((DetailsView)sender).FindControl("AwardedBadgeID")).SelectedValue);
                    obj2.Acknowledgements = ((HtmlTextArea)((DetailsView)sender).FindControl("Acknowledgements")).InnerHtml;

                    obj.CorrectRoundsToWinCount = FormatHelper.SafeToInt(((TextBox)((DetailsView)sender).FindControl("CorrectRoundsToWinCount")).Text);
                    obj.NumOptionsToChooseFrom = FormatHelper.SafeToInt(((TextBox)((DetailsView)sender).FindControl("NumOptionsToChooseFrom")).Text);
                    obj.EnableMediumDifficulty = ((CheckBox)((DetailsView)sender).FindControl("EnableMediumDifficulty")).Checked;
                    obj.EnableHardDifficulty = ((CheckBox)((DetailsView)sender).FindControl("EnableHardDifficulty")).Checked;

                    obj2.LastModDate = obj.LastModDate = DateTime.Now;
                    obj2.LastModUser = obj.LastModUser = ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username;  //"N/A";  // Get from session

                    if (obj.IsValid(BusinessRulesValidationMode.UPDATE) && obj2.IsValid(BusinessRulesValidationMode.UPDATE))
                    {
                        obj.Update();
                        obj2.Update();
                        Cache[CacheKey.AdventuresActive] = true;

                        if(e.CommandName.ToLower() == "saveandback")
                        {
                            Response.Redirect(returnURL);
                        }

                        odsData.DataBind();
                        dv.DataBind();
                        dv.ChangeMode(DetailsViewMode.Edit);

                        var masterPage = (IControlRoomMaster)Master;
                        masterPage.PageMessage = SRPResources.SaveOK;
                    }
                    else
                    {
                        var masterPage = (IControlRoomMaster)Master;
                        string message = String.Format(SRPResources.ApplicationError1, "<ul>");
                        foreach (BusinessRulesValidationMessage m in obj.ErrorCodes)
                        {
                            message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage);
                        }
                        message = string.Format("{0}</ul>", message);
                        masterPage.PageError = message;
                    }
                }
                catch (Exception ex)
                {
                    var masterPage = (IControlRoomMaster)Master;
                    masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                }
            }
        }
コード例 #6
0
        public static int Insert(Minigame o)
        {
            SqlParameter[] arrParams = new SqlParameter[23];

            arrParams[0]  = new SqlParameter("@MiniGameType", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameType, o.MiniGameType.GetTypeCode()));
            arrParams[1]  = new SqlParameter("@MiniGameTypeName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameTypeName, o.MiniGameTypeName.GetTypeCode()));
            arrParams[2]  = new SqlParameter("@AdminName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode()));
            arrParams[3]  = new SqlParameter("@GameName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.GameName, o.GameName.GetTypeCode()));
            arrParams[4]  = new SqlParameter("@isActive", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.isActive, o.isActive.GetTypeCode()));
            arrParams[5]  = new SqlParameter("@NumberPoints", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode()));
            arrParams[6]  = new SqlParameter("@AwardedBadgeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AwardedBadgeID, o.AwardedBadgeID.GetTypeCode()));
            arrParams[7]  = new SqlParameter("@Acknowledgements", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Acknowledgements, o.Acknowledgements.GetTypeCode()));
            arrParams[8]  = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[9]  = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[10] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[11] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));

            arrParams[12] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()));
            arrParams[13] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()));
            arrParams[14] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()));
            arrParams[15] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()));
            arrParams[16] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()));
            arrParams[17] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()));
            arrParams[18] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()));
            arrParams[19] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()));
            arrParams[20] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()));
            arrParams[21] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()));

            arrParams[22]           = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[22].Direction = ParameterDirection.Output;

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

            o.MGID = int.Parse(arrParams[22].Value.ToString());


            if (o.MiniGameType == 1)
            {
                var o2 = new MGOnlineBook {
                    MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser
                };
                o2.Insert();
            }
            if (o.MiniGameType == 2)
            {
                var o2 = new MGMixAndMatch()
                {
                    MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser
                };
                o2.Insert();
            }
            if (o.MiniGameType == 3)
            {
                var o2 = new MGCodeBreaker()
                {
                    MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser
                };
                o2.Insert();
            }

            if (o.MiniGameType == 4)
            {
                var o2 = new MGWordMatch()
                {
                    MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser
                };
                o2.Insert();
            }


            if (o.MiniGameType == 5)
            {
                var o2 = new MGMatchingGame()
                {
                    MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser
                };
                o2.Insert();
            }


            if (o.MiniGameType == 6)
            {
                var o2 = new MGHiddenPic()
                {
                    MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser
                };
                o2.Insert();
            }


            if (o.MiniGameType == 7)
            {
                var o2 = new MGChooseAdv()
                {
                    MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser
                };
                o2.Insert();
            }


            return(o.MGID);
        }
コード例 #7
0
        public bool Fetch(int WMID)
        {
            // declare reader

            SqlDataReader dr;

            SqlParameter[] arrParams = new SqlParameter[1];

            arrParams[0] = new SqlParameter("@WMID", WMID);

            dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, "app_MGWordMatch_GetByID", arrParams);

            if (dr.Read())
            {
                // declare return value

                MGWordMatch result = new MGWordMatch();

                DateTime _datetime;

                int _int;

                //decimal _decimal;

                if (int.TryParse(dr["WMID"].ToString(), out _int))
                {
                    this.WMID = _int;
                }
                if (int.TryParse(dr["MGID"].ToString(), out _int))
                {
                    this.MGID = _int;
                }
                if (int.TryParse(dr["CorrectRoundsToWinCount"].ToString(), out _int))
                {
                    this.CorrectRoundsToWinCount = _int;
                }
                if (int.TryParse(dr["NumOptionsToChooseFrom"].ToString(), out _int))
                {
                    this.NumOptionsToChooseFrom = _int;
                }
                this.EnableMediumDifficulty = bool.Parse(dr["EnableMediumDifficulty"].ToString());
                this.EnableHardDifficulty   = bool.Parse(dr["EnableHardDifficulty"].ToString());
                if (DateTime.TryParse(dr["LastModDate"].ToString(), out _datetime))
                {
                    this.LastModDate = _datetime;
                }
                this.LastModUser = dr["LastModUser"].ToString();
                if (DateTime.TryParse(dr["AddedDate"].ToString(), out _datetime))
                {
                    this.AddedDate = _datetime;
                }
                this.AddedUser = dr["AddedUser"].ToString();

                dr.Close();

                return(true);
            }

            dr.Close();

            return(false);
        }
コード例 #8
0
        public static int Delete(MGWordMatch o)
        {

            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[1];

            arrParams[0] = new SqlParameter("@WMID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.WMID, o.WMID.GetTypeCode()));

            try
            {

                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_MGWordMatch_Delete", arrParams);

            }

            catch (SqlException exx)
            {

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

            }

            return iReturn;

        }
コード例 #9
0
        public static int Update(MGWordMatch o)
        {

            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[10];

            arrParams[0] = new SqlParameter("@WMID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.WMID, o.WMID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[2] = new SqlParameter("@CorrectRoundsToWinCount", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.CorrectRoundsToWinCount, o.CorrectRoundsToWinCount.GetTypeCode()));
            arrParams[3] = new SqlParameter("@NumOptionsToChooseFrom", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumOptionsToChooseFrom, o.NumOptionsToChooseFrom.GetTypeCode()));
            arrParams[4] = new SqlParameter("@EnableMediumDifficulty", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.EnableMediumDifficulty, o.EnableMediumDifficulty.GetTypeCode()));
            arrParams[5] = new SqlParameter("@EnableHardDifficulty", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.EnableHardDifficulty, o.EnableHardDifficulty.GetTypeCode()));
            arrParams[6] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[7] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[8] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[9] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));

            try
            {

                iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_MGWordMatch_Update", arrParams);

            }

            catch (SqlException exx)
            {

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

            }

            return iReturn;

        }
コード例 #10
0
        public static int Insert(MGWordMatch o)
        {

            SqlParameter[] arrParams = new SqlParameter[10];

            arrParams[0] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@CorrectRoundsToWinCount", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.CorrectRoundsToWinCount, o.CorrectRoundsToWinCount.GetTypeCode()));
            arrParams[2] = new SqlParameter("@NumOptionsToChooseFrom", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumOptionsToChooseFrom, o.NumOptionsToChooseFrom.GetTypeCode()));
            arrParams[3] = new SqlParameter("@EnableMediumDifficulty", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.EnableMediumDifficulty, o.EnableMediumDifficulty.GetTypeCode()));
            arrParams[4] = new SqlParameter("@EnableHardDifficulty", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.EnableHardDifficulty, o.EnableHardDifficulty.GetTypeCode()));
            arrParams[5] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[6] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[7] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[8] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));
            arrParams[9] = new SqlParameter("@WMID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.WMID, o.WMID.GetTypeCode()));
            arrParams[9].Direction = ParameterDirection.Output;

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

            o.WMID = int.Parse(arrParams[9].Value.ToString());

            return o.WMID;

        }
コード例 #11
0
        public bool Fetch(int WMID)
        {

            // declare reader

            SqlDataReader dr;

            SqlParameter[] arrParams = new SqlParameter[1];

            arrParams[0] = new SqlParameter("@WMID", WMID);

            dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, "app_MGWordMatch_GetByID", arrParams);

            if (dr.Read())
            {

                // declare return value

                MGWordMatch result = new MGWordMatch();

                DateTime _datetime;

                int _int;

                //decimal _decimal;

                if (int.TryParse(dr["WMID"].ToString(), out _int)) this.WMID = _int;
                if (int.TryParse(dr["MGID"].ToString(), out _int)) this.MGID = _int;
                if (int.TryParse(dr["CorrectRoundsToWinCount"].ToString(), out _int)) this.CorrectRoundsToWinCount = _int;
                if (int.TryParse(dr["NumOptionsToChooseFrom"].ToString(), out _int)) this.NumOptionsToChooseFrom = _int;
                this.EnableMediumDifficulty = bool.Parse(dr["EnableMediumDifficulty"].ToString());
                this.EnableHardDifficulty = bool.Parse(dr["EnableHardDifficulty"].ToString());
                if (DateTime.TryParse(dr["LastModDate"].ToString(), out _datetime)) this.LastModDate = _datetime;
                this.LastModUser = dr["LastModUser"].ToString();
                if (DateTime.TryParse(dr["AddedDate"].ToString(), out _datetime)) this.AddedDate = _datetime;
                this.AddedUser = dr["AddedUser"].ToString();

                dr.Close();

                return true;

            }

            dr.Close();

            return false;

        }