Example #1
0
        public static string F3Label()
        {
            var o = CustomEventFields.FetchObject();

            if (!o.Use3)
            {
                return("Custom Field 3 (Not Active)");
            }
            return(o.Label3);
        }
Example #2
0
        public static int Update(CustomEventFields o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[24];

            arrParams[0]  = new SqlParameter("@CID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.CID, o.CID.GetTypeCode()));
            arrParams[1]  = new SqlParameter("@Use1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use1, o.Use1.GetTypeCode()));
            arrParams[2]  = new SqlParameter("@Label1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label1, o.Label1.GetTypeCode()));
            arrParams[3]  = new SqlParameter("@DDValues1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues1, o.DDValues1.GetTypeCode()));
            arrParams[4]  = new SqlParameter("@Use2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use2, o.Use2.GetTypeCode()));
            arrParams[5]  = new SqlParameter("@Use3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use3, o.Use3.GetTypeCode()));
            arrParams[6]  = new SqlParameter("@Label2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label2, o.Label2.GetTypeCode()));
            arrParams[7]  = new SqlParameter("@Label3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label3, o.Label3.GetTypeCode()));
            arrParams[8]  = new SqlParameter("@DDValues2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues2, o.DDValues2.GetTypeCode()));
            arrParams[9]  = new SqlParameter("@DDValues3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues3, o.DDValues3.GetTypeCode()));
            arrParams[10] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[11] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[12] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[13] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));

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

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

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

            return(iReturn);
        }
Example #3
0
        public static int Delete(CustomEventFields o)
        {
            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[1];

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

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

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

            return(iReturn);
        }
Example #4
0
        public static int Insert(CustomEventFields o)
        {
            SqlParameter[] arrParams = new SqlParameter[24];

            arrParams[0]  = new SqlParameter("@Use1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use1, o.Use1.GetTypeCode()));
            arrParams[1]  = new SqlParameter("@Label1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label1, o.Label1.GetTypeCode()));
            arrParams[2]  = new SqlParameter("@DDValues1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues1, o.DDValues1.GetTypeCode()));
            arrParams[3]  = new SqlParameter("@Use2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use2, o.Use2.GetTypeCode()));
            arrParams[4]  = new SqlParameter("@Use3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use3, o.Use3.GetTypeCode()));
            arrParams[5]  = new SqlParameter("@Label2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label2, o.Label2.GetTypeCode()));
            arrParams[6]  = new SqlParameter("@Label3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label3, o.Label3.GetTypeCode()));
            arrParams[7]  = new SqlParameter("@DDValues2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues2, o.DDValues2.GetTypeCode()));
            arrParams[8]  = new SqlParameter("@DDValues3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues3, o.DDValues3.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()));

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

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

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

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

            return(o.CID);
        }
        public static void InitializeCustFields(int TID, int MTID) {
            var srcObj = new CustomEventFields();
            /* ------------------------------------*/
            srcObj.TenID = TID;
            srcObj.AddedDate = srcObj.LastModDate = DateTime.Now;
            srcObj.AddedUser = srcObj.LastModUser = ((SRPUser)HttpContext.Current.Session[SessionData.UserProfile.ToString()]).Username;
            /* ------------------------------------*/
            srcObj.Insert();


            var srcObj2 = new CustomRegistrationFields();
            /* ------------------------------------*/
            srcObj2.TenID = TID;
            srcObj2.AddedDate = srcObj2.LastModDate = DateTime.Now;
            srcObj2.AddedUser = srcObj2.LastModUser = ((SRPUser)HttpContext.Current.Session[SessionData.UserProfile.ToString()]).Username;
            /* ------------------------------------*/
            srcObj2.Insert();

        }
        public static int Delete(CustomEventFields o)
        {

            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[1];

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

            try
            {

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

            }

            catch (SqlException exx)
            {

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

            }

            return iReturn;

        }
        public static int Update(CustomEventFields o)
        {

            int iReturn = -1; //assume the worst

            SqlParameter[] arrParams = new SqlParameter[24];

            arrParams[0] = new SqlParameter("@CID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.CID, o.CID.GetTypeCode()));
            arrParams[1] = new SqlParameter("@Use1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use1, o.Use1.GetTypeCode()));
            arrParams[2] = new SqlParameter("@Label1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label1, o.Label1.GetTypeCode()));
            arrParams[3] = new SqlParameter("@DDValues1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues1, o.DDValues1.GetTypeCode()));
            arrParams[4] = new SqlParameter("@Use2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use2, o.Use2.GetTypeCode()));
            arrParams[5] = new SqlParameter("@Use3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use3, o.Use3.GetTypeCode()));
            arrParams[6] = new SqlParameter("@Label2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label2, o.Label2.GetTypeCode()));
            arrParams[7] = new SqlParameter("@Label3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label3, o.Label3.GetTypeCode()));
            arrParams[8] = new SqlParameter("@DDValues2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues2, o.DDValues2.GetTypeCode()));
            arrParams[9] = new SqlParameter("@DDValues3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues3, o.DDValues3.GetTypeCode()));
            arrParams[10] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode()));
            arrParams[11] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode()));
            arrParams[12] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode()));
            arrParams[13] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode()));

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

            try
            {

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

            }

            catch (SqlException exx)
            {

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

            }

            return iReturn;

        }
        public static int Insert(CustomEventFields o)
        {

            SqlParameter[] arrParams = new SqlParameter[24];

            arrParams[0] = new SqlParameter("@Use1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use1, o.Use1.GetTypeCode()));
            arrParams[1] = new SqlParameter("@Label1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label1, o.Label1.GetTypeCode()));
            arrParams[2] = new SqlParameter("@DDValues1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues1, o.DDValues1.GetTypeCode()));
            arrParams[3] = new SqlParameter("@Use2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use2, o.Use2.GetTypeCode()));
            arrParams[4] = new SqlParameter("@Use3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Use3, o.Use3.GetTypeCode()));
            arrParams[5] = new SqlParameter("@Label2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label2, o.Label2.GetTypeCode()));
            arrParams[6] = new SqlParameter("@Label3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Label3, o.Label3.GetTypeCode()));
            arrParams[7] = new SqlParameter("@DDValues2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues2, o.DDValues2.GetTypeCode()));
            arrParams[8] = new SqlParameter("@DDValues3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DDValues3, o.DDValues3.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()));

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

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

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

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

            return o.CID;

        }
        public bool Fetch()
        {

            // declare reader

            SqlDataReader dr;

            var arrParams = new SqlParameter[1];
            arrParams[0] = new SqlParameter("@TenID",
                                (HttpContext.Current.Session["TenantID"] == null || HttpContext.Current.Session["TenantID"].ToString() == "" ?
                                        -1 :
                                        (int)HttpContext.Current.Session["TenantID"])
                            );


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

            if (dr.Read())
            {

                // declare return value

                CustomEventFields result = new CustomEventFields();

                DateTime _datetime;

                int _int;

                //decimal _decimal;

                if (int.TryParse(dr["CID"].ToString(), out _int)) this.CID = _int;
                this.Use1 = bool.Parse(dr["Use1"].ToString());
                this.Label1 = dr["Label1"].ToString();
                this.DDValues1 = dr["DDValues1"].ToString();
                this.Use2 = bool.Parse(dr["Use2"].ToString());
                this.Use3 = bool.Parse(dr["Use3"].ToString());
                this.Label2 = dr["Label2"].ToString();
                this.Label3 = dr["Label3"].ToString();
                this.DDValues2 = dr["DDValues2"].ToString();
                this.DDValues3 = dr["DDValues3"].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();

                if (int.TryParse(dr["TenID"].ToString(), out _int)) this.TenID = _int;
                if (int.TryParse(dr["FldInt1"].ToString(), out _int)) this.FldInt1 = _int;
                if (int.TryParse(dr["FldInt2"].ToString(), out _int)) this.FldInt2 = _int;
                if (int.TryParse(dr["FldInt3"].ToString(), out _int)) this.FldInt3 = _int;
                this.FldBit1 = bool.Parse(dr["FldBit1"].ToString());
                this.FldBit2 = bool.Parse(dr["FldBit2"].ToString());
                this.FldBit3 = bool.Parse(dr["FldBit3"].ToString());
                this.FldText1 = dr["FldText1"].ToString();
                this.FldText2 = dr["FldText2"].ToString();
                this.FldText3 = dr["FldText3"].ToString();
                dr.Close();

                return true;

            }

            dr.Close();

            return false;

        }
Example #10
0
        public bool Fetch()
        {
            // declare reader

            SqlDataReader dr;

            var arrParams = new SqlParameter[1];

            arrParams[0] = new SqlParameter("@TenID",
                                            (HttpContext.Current.Session["TenantID"] == null || HttpContext.Current.Session["TenantID"].ToString() == "" ?
                                             -1 :
                                             (int)HttpContext.Current.Session["TenantID"])
                                            );


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

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

                CustomEventFields result = new CustomEventFields();

                DateTime _datetime;

                int _int;

                //decimal _decimal;

                if (int.TryParse(dr["CID"].ToString(), out _int))
                {
                    this.CID = _int;
                }
                this.Use1      = bool.Parse(dr["Use1"].ToString());
                this.Label1    = dr["Label1"].ToString();
                this.DDValues1 = dr["DDValues1"].ToString();
                this.Use2      = bool.Parse(dr["Use2"].ToString());
                this.Use3      = bool.Parse(dr["Use3"].ToString());
                this.Label2    = dr["Label2"].ToString();
                this.Label3    = dr["Label3"].ToString();
                this.DDValues2 = dr["DDValues2"].ToString();
                this.DDValues3 = dr["DDValues3"].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();

                if (int.TryParse(dr["TenID"].ToString(), out _int))
                {
                    this.TenID = _int;
                }
                if (int.TryParse(dr["FldInt1"].ToString(), out _int))
                {
                    this.FldInt1 = _int;
                }
                if (int.TryParse(dr["FldInt2"].ToString(), out _int))
                {
                    this.FldInt2 = _int;
                }
                if (int.TryParse(dr["FldInt3"].ToString(), out _int))
                {
                    this.FldInt3 = _int;
                }
                this.FldBit1  = bool.Parse(dr["FldBit1"].ToString());
                this.FldBit2  = bool.Parse(dr["FldBit2"].ToString());
                this.FldBit3  = bool.Parse(dr["FldBit3"].ToString());
                this.FldText1 = dr["FldText1"].ToString();
                this.FldText2 = dr["FldText2"].ToString();
                this.FldText3 = dr["FldText3"].ToString();
                dr.Close();

                return(true);
            }

            dr.Close();

            return(false);
        }