Esempio n. 1
0
        private UserHeckTotal UserHeckTotalColumnMapper(DataTable dataTable)
        {
            UserHeckTotal item = new UserHeckTotal();

            item.HeckTotal      = float.Parse(Convert.ToString(dataTable.Rows[0][0]));
            item.WeightTotal    = float.Parse(Convert.ToString(dataTable.Rows[0][1]));
            item.HecksWeighted  = float.Parse(Convert.ToString(dataTable.Rows[0][2]));
            item.AvailableHecks = float.Parse(Convert.ToString(dataTable.Rows[0][3]));
            return(item);
        }
Esempio n. 2
0
        public DataResponse GetUserHeckTotal(int UserID)
        {
            DataResponse resp;

            connection.Open();
            DataTable dt = new DataTable();

            using (MySqlCommand cmd = new MySqlCommand("GetUserHeckTotals"))
            {
                cmd.Connection  = connection;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@UserID", UserID);
                using (MySqlDataAdapter sda = new MySqlDataAdapter(cmd))
                {
                    sda.Fill(dt);
                }
            }
            UserHeckTotal item = ColumnMapper(dt) as UserHeckTotal;

            if (item != null)
            {
                HeckUserModel mdl     = new HeckUserModel(null);
                DataResponse  usrResp = mdl.GetUserByID(UserID);
                if (usrResp.Result)
                {
                    item.User = usrResp.Item as HeckUser;
                }
                mdl.Dispose();
                resp      = new DataResponse("User Heck Total Found", true);
                resp.Item = item;
            }
            else
            {
                resp = new DataResponse("User Heck Total could not be found.", true);
            }
            return(resp);
        }