コード例 #1
0
        public static int Insert(MGMatchingGameTiles o)
        {
            SqlParameter[] arrParams = new SqlParameter[13];

            arrParams[0]            = new SqlParameter("@MAGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MAGID, o.MAGID.GetTypeCode()));
            arrParams[1]            = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[2]            = new SqlParameter("@Tile1UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile1UseMedium, o.Tile1UseMedium.GetTypeCode()));
            arrParams[3]            = new SqlParameter("@Tile1UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile1UseHard, o.Tile1UseHard.GetTypeCode()));
            arrParams[4]            = new SqlParameter("@Tile2UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile2UseMedium, o.Tile2UseMedium.GetTypeCode()));
            arrParams[5]            = new SqlParameter("@Tile2UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile2UseHard, o.Tile2UseHard.GetTypeCode()));
            arrParams[6]            = new SqlParameter("@Tile3UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile3UseMedium, o.Tile3UseMedium.GetTypeCode()));
            arrParams[7]            = new SqlParameter("@Tile3UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile3UseHard, o.Tile3UseHard.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("@MAGTID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MAGTID, o.MAGTID.GetTypeCode()));
            arrParams[12].Direction = ParameterDirection.Output;

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

            o.MAGTID = int.Parse(arrParams[12].Value.ToString());

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

            SqlParameter[] arrParams = new SqlParameter[13];

            arrParams[0]  = new SqlParameter("@MAGTID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MAGTID, o.MAGTID.GetTypeCode()));
            arrParams[1]  = new SqlParameter("@MAGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MAGID, o.MAGID.GetTypeCode()));
            arrParams[2]  = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[3]  = new SqlParameter("@Tile1UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile1UseMedium, o.Tile1UseMedium.GetTypeCode()));
            arrParams[4]  = new SqlParameter("@Tile1UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile1UseHard, o.Tile1UseHard.GetTypeCode()));
            arrParams[5]  = new SqlParameter("@Tile2UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile2UseMedium, o.Tile2UseMedium.GetTypeCode()));
            arrParams[6]  = new SqlParameter("@Tile2UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile2UseHard, o.Tile2UseHard.GetTypeCode()));
            arrParams[7]  = new SqlParameter("@Tile3UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile3UseMedium, o.Tile3UseMedium.GetTypeCode()));
            arrParams[8]  = new SqlParameter("@Tile3UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile3UseHard, o.Tile3UseHard.GetTypeCode()));
            arrParams[9]  = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[10] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[11] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[12] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));

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

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

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

            SqlParameter[] arrParams = new SqlParameter[1];

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

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

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

            return(iReturn);
        }
        protected void DvItemCommand(object sender, DetailsViewCommandEventArgs e)
        {
            var returnUrl = "~/ControlRoom/Modules/Setup/MGMatchingGameTilesList.aspx?MGID=" + lblMGID.Text;
            
            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;
                    if (masterPage != null)
                        masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                }
            }
            if (e.CommandName.ToLower() == "add" || e.CommandName.ToLower() == "addandback")
            {
                try
                {
                    var obj = new MGMatchingGameTiles();

                    obj.MAGID = FormatHelper.SafeToInt(lblMAGID.Text);
                    obj.MGID = FormatHelper.SafeToInt(lblMGID.Text);

                    obj.Tile1UseMedium = ((CheckBox)((DetailsView)sender).FindControl("Tile1UseMedium")).Checked;
                    obj.Tile1UseHard = ((CheckBox)((DetailsView)sender).FindControl("Tile1UseHard")).Checked;
                    obj.Tile2UseMedium = ((CheckBox)((DetailsView)sender).FindControl("Tile2UseMedium")).Checked;
                    obj.Tile2UseHard = ((CheckBox)((DetailsView)sender).FindControl("Tile2UseHard")).Checked;
                    obj.Tile3UseMedium = ((CheckBox)((DetailsView)sender).FindControl("Tile3UseMedium")).Checked;
                    obj.Tile3UseHard = ((CheckBox)((DetailsView)sender).FindControl("Tile3UseHard")).Checked;

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

                    if (obj.IsValid(BusinessRulesValidationMode.INSERT))
                    {
                        obj.Insert();
                        if (e.CommandName.ToLower() == "addandback")
                        {
                            Response.Redirect(returnUrl);
                        }

                        lblPK.Text = obj.MAGTID.ToString();

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

                        var masterPage = (IControlRoomMaster)Master;
                        if (masterPage != null) masterPage.PageMessage = SRPResources.AddedOK;
                    }
                    else
                    {
                        var masterPage = (IControlRoomMaster)Master;
                        var message = String.Format(SRPResources.ApplicationError1, "<ul>");
                        message = obj.ErrorCodes.Aggregate(message, (current, m) => string.Format(String.Format("{0}<li>{{0}}</li>", current), m.ErrorMessage));
                        message = string.Format("{0}</ul>", message);
                        if (masterPage != null) masterPage.PageError = message;
                    }
                }
                catch (Exception ex)
                {
                    var masterPage = (IControlRoomMaster)Master;
                    if (masterPage != null)
                        masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                }
            }
            if (e.CommandName.ToLower() == "save" || e.CommandName.ToLower() == "saveandback")
            {
                try
                {
                    var obj = new MGMatchingGameTiles();
                    var pk = int.Parse(((TextBox)((DetailsView)sender).FindControl("MAGTID")).Text);
                    obj.Fetch(pk);

                    obj.MAGID = FormatHelper.SafeToInt(lblMAGID.Text);
                    obj.MGID = FormatHelper.SafeToInt(lblMGID.Text);

                    obj.Tile1UseMedium = ((CheckBox)((DetailsView)sender).FindControl("Tile1UseMedium")).Checked;
                    obj.Tile1UseHard = ((CheckBox)((DetailsView)sender).FindControl("Tile1UseHard")).Checked;
                    obj.Tile2UseMedium = ((CheckBox)((DetailsView)sender).FindControl("Tile2UseMedium")).Checked;
                    obj.Tile2UseHard = ((CheckBox)((DetailsView)sender).FindControl("Tile2UseHard")).Checked;
                    obj.Tile3UseMedium = ((CheckBox)((DetailsView)sender).FindControl("Tile3UseMedium")).Checked;
                    obj.Tile3UseHard = ((CheckBox)((DetailsView)sender).FindControl("Tile3UseHard")).Checked;

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

                    if (obj.IsValid(BusinessRulesValidationMode.UPDATE))
                    {
                        obj.Update();
                        if (e.CommandName.ToLower() == "saveandback")
                        {
                            Response.Redirect(returnUrl);
                        }

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

                        var masterPage = (IControlRoomMaster)Master;
                        if (masterPage != null) masterPage.PageMessage = SRPResources.SaveOK;
                    }
                    else
                    {
                        var masterPage = (IControlRoomMaster)Master;
                        var message = String.Format(SRPResources.ApplicationError1, "<ul>");
                        message = obj.ErrorCodes.Aggregate(message, (current, m) => string.Format(String.Format("{0}<li>{{0}}</li>", current), m.ErrorMessage));
                        message = string.Format("{0}</ul>", message);
                        if (masterPage != null) masterPage.PageError = message;
                    }
                }
                catch (Exception ex)
                {
                    var masterPage = (IControlRoomMaster)Master;
                    if (masterPage != null)
                        masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                }
            }
        }
        protected void GvRowCommand(object sender, GridViewCommandEventArgs e)
        {
            string editpage = "~/ControlRoom/Modules/Setup/MGMatchingGameTilesAddEdit.aspx";
            if (e.CommandName.ToLower() == "addrecord")
            {
                Response.Redirect(String.Format("{0}?MGID={1}&MAGID={2}", editpage, lblMGID.Text, lblMAGID.Text));
            }

            if (e.CommandName.ToLower() == "editrecord")
            {
                int key = Convert.ToInt32(e.CommandArgument);
                Response.Redirect(String.Format("{0}?PK={1}", editpage, key));
            }

            if (e.CommandName.ToLower() == "back")
            {
                //Response.Redirect(String.Format("~/ControlRoom/Modules/Setup/MGMatchingGameAddEdit.aspx?PK={0}", lblMGID.Text));
                Response.Redirect("~/ControlRoom/Modules/Setup/MGMatchingGameAddEdit.aspx");
            }
            

            if (e.CommandName.ToLower() == "deleterecord")
            {
                var key = Convert.ToInt32(e.CommandArgument);
                try
                {
                    var obj = new MGMatchingGameTiles();
                    if (obj.IsValid(BusinessRulesValidationMode.DELETE))
                    {
                        MGMatchingGameTiles.FetchObject(key).Delete();

                        LoadData();
                        var masterPage = (IControlRoomMaster)Master;
                        if (masterPage != null) masterPage.PageMessage = SRPResources.DeleteOK;
                    }
                    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);
                        if (masterPage != null) masterPage.PageError = message;
                    }
                }
                catch (Exception ex)
                {
                    var masterPage = (IControlRoomMaster)Master;
                    if (masterPage != null)
                        masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                }
            }
        }
コード例 #6
0
        public bool Fetch(int MAGTID)
        {
            // declare reader

            SqlDataReader dr;

            SqlParameter[] arrParams = new SqlParameter[1];

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

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

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

                MGMatchingGameTiles result = new MGMatchingGameTiles();

                DateTime _datetime;

                int _int;

                //decimal _decimal;

                if (int.TryParse(dr["MAGTID"].ToString(), out _int))
                {
                    this.MAGTID = _int;
                }
                if (int.TryParse(dr["MAGID"].ToString(), out _int))
                {
                    this.MAGID = _int;
                }
                if (int.TryParse(dr["MGID"].ToString(), out _int))
                {
                    this.MGID = _int;
                }
                this.Tile1UseMedium = bool.Parse(dr["Tile1UseMedium"].ToString());
                this.Tile1UseHard   = bool.Parse(dr["Tile1UseHard"].ToString());
                this.Tile2UseMedium = bool.Parse(dr["Tile2UseMedium"].ToString());
                this.Tile2UseHard   = bool.Parse(dr["Tile2UseHard"].ToString());
                this.Tile3UseMedium = bool.Parse(dr["Tile3UseMedium"].ToString());
                this.Tile3UseHard   = bool.Parse(dr["Tile3UseHard"].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);
        }
コード例 #7
0
        public static int Delete(MGMatchingGameTiles o)
        {

            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[1];

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

            try
            {

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

            }

            catch (SqlException exx)
            {

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

            }

            return iReturn;

        }
コード例 #8
0
        public static int Update(MGMatchingGameTiles o)
        {

            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[13];

            arrParams[0] = new SqlParameter("@MAGTID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MAGTID, o.MAGTID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@MAGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MAGID, o.MAGID.GetTypeCode()));
            arrParams[2] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[3] = new SqlParameter("@Tile1UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile1UseMedium, o.Tile1UseMedium.GetTypeCode()));
            arrParams[4] = new SqlParameter("@Tile1UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile1UseHard, o.Tile1UseHard.GetTypeCode()));
            arrParams[5] = new SqlParameter("@Tile2UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile2UseMedium, o.Tile2UseMedium.GetTypeCode()));
            arrParams[6] = new SqlParameter("@Tile2UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile2UseHard, o.Tile2UseHard.GetTypeCode()));
            arrParams[7] = new SqlParameter("@Tile3UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile3UseMedium, o.Tile3UseMedium.GetTypeCode()));
            arrParams[8] = new SqlParameter("@Tile3UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile3UseHard, o.Tile3UseHard.GetTypeCode()));
            arrParams[9] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[10] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[11] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[12] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));

            try
            {

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

            }

            catch (SqlException exx)
            {

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

            }

            return iReturn;

        }
コード例 #9
0
        public static int Insert(MGMatchingGameTiles o)
        {

            SqlParameter[] arrParams = new SqlParameter[13];

            arrParams[0] = new SqlParameter("@MAGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MAGID, o.MAGID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode()));
            arrParams[2] = new SqlParameter("@Tile1UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile1UseMedium, o.Tile1UseMedium.GetTypeCode()));
            arrParams[3] = new SqlParameter("@Tile1UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile1UseHard, o.Tile1UseHard.GetTypeCode()));
            arrParams[4] = new SqlParameter("@Tile2UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile2UseMedium, o.Tile2UseMedium.GetTypeCode()));
            arrParams[5] = new SqlParameter("@Tile2UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile2UseHard, o.Tile2UseHard.GetTypeCode()));
            arrParams[6] = new SqlParameter("@Tile3UseMedium", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile3UseMedium, o.Tile3UseMedium.GetTypeCode()));
            arrParams[7] = new SqlParameter("@Tile3UseHard", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Tile3UseHard, o.Tile3UseHard.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("@MAGTID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MAGTID, o.MAGTID.GetTypeCode()));
            arrParams[12].Direction = ParameterDirection.Output;

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

            o.MAGTID = int.Parse(arrParams[12].Value.ToString());

            return o.MAGTID;

        }
コード例 #10
0
        public bool Fetch(int MAGTID)
        {

            // declare reader

            SqlDataReader dr;

            SqlParameter[] arrParams = new SqlParameter[1];

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

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

            if (dr.Read())
            {

                // declare return value

                MGMatchingGameTiles result = new MGMatchingGameTiles();

                DateTime _datetime;

                int _int;

                //decimal _decimal;

                if (int.TryParse(dr["MAGTID"].ToString(), out _int)) this.MAGTID = _int;
                if (int.TryParse(dr["MAGID"].ToString(), out _int)) this.MAGID = _int;
                if (int.TryParse(dr["MGID"].ToString(), out _int)) this.MGID = _int;
                this.Tile1UseMedium = bool.Parse(dr["Tile1UseMedium"].ToString());
                this.Tile1UseHard = bool.Parse(dr["Tile1UseHard"].ToString());
                this.Tile2UseMedium = bool.Parse(dr["Tile2UseMedium"].ToString());
                this.Tile2UseHard = bool.Parse(dr["Tile2UseHard"].ToString());
                this.Tile3UseMedium = bool.Parse(dr["Tile3UseMedium"].ToString());
                this.Tile3UseHard = bool.Parse(dr["Tile3UseHard"].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;

        }